iclient-leaflet-es6.js 4.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994
  1. /*!
  2. *
  3. * iclient-leaflet
  4. * Copyright© 2000 - 2023 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v11.1.0
  7. *
  8. */
  9. /******/ (() => { // webpackBootstrap
  10. /******/ var __webpack_modules__ = ({
  11. /***/ 550:
  12. /***/ ((module) => {
  13. "use strict";
  14. module.exports = Point;
  15. /**
  16. * A standalone point geometry with useful accessor, comparison, and
  17. * modification methods.
  18. *
  19. * @class Point
  20. * @param {Number} x the x-coordinate. this could be longitude or screen
  21. * pixels, or any other sort of unit.
  22. * @param {Number} y the y-coordinate. this could be latitude or screen
  23. * pixels, or any other sort of unit.
  24. * @example
  25. * var point = new Point(-77, 38);
  26. */
  27. function Point(x, y) {
  28. this.x = x;
  29. this.y = y;
  30. }
  31. Point.prototype = {
  32. /**
  33. * Clone this point, returning a new point that can be modified
  34. * without affecting the old one.
  35. * @return {Point} the clone
  36. */
  37. clone: function() { return new Point(this.x, this.y); },
  38. /**
  39. * Add this point's x & y coordinates to another point,
  40. * yielding a new point.
  41. * @param {Point} p the other point
  42. * @return {Point} output point
  43. */
  44. add: function(p) { return this.clone()._add(p); },
  45. /**
  46. * Subtract this point's x & y coordinates to from point,
  47. * yielding a new point.
  48. * @param {Point} p the other point
  49. * @return {Point} output point
  50. */
  51. sub: function(p) { return this.clone()._sub(p); },
  52. /**
  53. * Multiply this point's x & y coordinates by point,
  54. * yielding a new point.
  55. * @param {Point} p the other point
  56. * @return {Point} output point
  57. */
  58. multByPoint: function(p) { return this.clone()._multByPoint(p); },
  59. /**
  60. * Divide this point's x & y coordinates by point,
  61. * yielding a new point.
  62. * @param {Point} p the other point
  63. * @return {Point} output point
  64. */
  65. divByPoint: function(p) { return this.clone()._divByPoint(p); },
  66. /**
  67. * Multiply this point's x & y coordinates by a factor,
  68. * yielding a new point.
  69. * @param {Point} k factor
  70. * @return {Point} output point
  71. */
  72. mult: function(k) { return this.clone()._mult(k); },
  73. /**
  74. * Divide this point's x & y coordinates by a factor,
  75. * yielding a new point.
  76. * @param {Point} k factor
  77. * @return {Point} output point
  78. */
  79. div: function(k) { return this.clone()._div(k); },
  80. /**
  81. * Rotate this point around the 0, 0 origin by an angle a,
  82. * given in radians
  83. * @param {Number} a angle to rotate around, in radians
  84. * @return {Point} output point
  85. */
  86. rotate: function(a) { return this.clone()._rotate(a); },
  87. /**
  88. * Rotate this point around p point by an angle a,
  89. * given in radians
  90. * @param {Number} a angle to rotate around, in radians
  91. * @param {Point} p Point to rotate around
  92. * @return {Point} output point
  93. */
  94. rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },
  95. /**
  96. * Multiply this point by a 4x1 transformation matrix
  97. * @param {Array<Number>} m transformation matrix
  98. * @return {Point} output point
  99. */
  100. matMult: function(m) { return this.clone()._matMult(m); },
  101. /**
  102. * Calculate this point but as a unit vector from 0, 0, meaning
  103. * that the distance from the resulting point to the 0, 0
  104. * coordinate will be equal to 1 and the angle from the resulting
  105. * point to the 0, 0 coordinate will be the same as before.
  106. * @return {Point} unit vector point
  107. */
  108. unit: function() { return this.clone()._unit(); },
  109. /**
  110. * Compute a perpendicular point, where the new y coordinate
  111. * is the old x coordinate and the new x coordinate is the old y
  112. * coordinate multiplied by -1
  113. * @return {Point} perpendicular point
  114. */
  115. perp: function() { return this.clone()._perp(); },
  116. /**
  117. * Return a version of this point with the x & y coordinates
  118. * rounded to integers.
  119. * @return {Point} rounded point
  120. */
  121. round: function() { return this.clone()._round(); },
  122. /**
  123. * Return the magitude of this point: this is the Euclidean
  124. * distance from the 0, 0 coordinate to this point's x and y
  125. * coordinates.
  126. * @return {Number} magnitude
  127. */
  128. mag: function() {
  129. return Math.sqrt(this.x * this.x + this.y * this.y);
  130. },
  131. /**
  132. * Judge whether this point is equal to another point, returning
  133. * true or false.
  134. * @param {Point} other the other point
  135. * @return {boolean} whether the points are equal
  136. */
  137. equals: function(other) {
  138. return this.x === other.x &&
  139. this.y === other.y;
  140. },
  141. /**
  142. * Calculate the distance from this point to another point
  143. * @param {Point} p the other point
  144. * @return {Number} distance
  145. */
  146. dist: function(p) {
  147. return Math.sqrt(this.distSqr(p));
  148. },
  149. /**
  150. * Calculate the distance from this point to another point,
  151. * without the square root step. Useful if you're comparing
  152. * relative distances.
  153. * @param {Point} p the other point
  154. * @return {Number} distance
  155. */
  156. distSqr: function(p) {
  157. var dx = p.x - this.x,
  158. dy = p.y - this.y;
  159. return dx * dx + dy * dy;
  160. },
  161. /**
  162. * Get the angle from the 0, 0 coordinate to this point, in radians
  163. * coordinates.
  164. * @return {Number} angle
  165. */
  166. angle: function() {
  167. return Math.atan2(this.y, this.x);
  168. },
  169. /**
  170. * Get the angle from this point to another point, in radians
  171. * @param {Point} b the other point
  172. * @return {Number} angle
  173. */
  174. angleTo: function(b) {
  175. return Math.atan2(this.y - b.y, this.x - b.x);
  176. },
  177. /**
  178. * Get the angle between this point and another point, in radians
  179. * @param {Point} b the other point
  180. * @return {Number} angle
  181. */
  182. angleWith: function(b) {
  183. return this.angleWithSep(b.x, b.y);
  184. },
  185. /*
  186. * Find the angle of the two vectors, solving the formula for
  187. * the cross product a x b = |a||b|sin(θ) for θ.
  188. * @param {Number} x the x-coordinate
  189. * @param {Number} y the y-coordinate
  190. * @return {Number} the angle in radians
  191. */
  192. angleWithSep: function(x, y) {
  193. return Math.atan2(
  194. this.x * y - this.y * x,
  195. this.x * x + this.y * y);
  196. },
  197. _matMult: function(m) {
  198. var x = m[0] * this.x + m[1] * this.y,
  199. y = m[2] * this.x + m[3] * this.y;
  200. this.x = x;
  201. this.y = y;
  202. return this;
  203. },
  204. _add: function(p) {
  205. this.x += p.x;
  206. this.y += p.y;
  207. return this;
  208. },
  209. _sub: function(p) {
  210. this.x -= p.x;
  211. this.y -= p.y;
  212. return this;
  213. },
  214. _mult: function(k) {
  215. this.x *= k;
  216. this.y *= k;
  217. return this;
  218. },
  219. _div: function(k) {
  220. this.x /= k;
  221. this.y /= k;
  222. return this;
  223. },
  224. _multByPoint: function(p) {
  225. this.x *= p.x;
  226. this.y *= p.y;
  227. return this;
  228. },
  229. _divByPoint: function(p) {
  230. this.x /= p.x;
  231. this.y /= p.y;
  232. return this;
  233. },
  234. _unit: function() {
  235. this._div(this.mag());
  236. return this;
  237. },
  238. _perp: function() {
  239. var y = this.y;
  240. this.y = this.x;
  241. this.x = -y;
  242. return this;
  243. },
  244. _rotate: function(angle) {
  245. var cos = Math.cos(angle),
  246. sin = Math.sin(angle),
  247. x = cos * this.x - sin * this.y,
  248. y = sin * this.x + cos * this.y;
  249. this.x = x;
  250. this.y = y;
  251. return this;
  252. },
  253. _rotateAround: function(angle, p) {
  254. var cos = Math.cos(angle),
  255. sin = Math.sin(angle),
  256. x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),
  257. y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
  258. this.x = x;
  259. this.y = y;
  260. return this;
  261. },
  262. _round: function() {
  263. this.x = Math.round(this.x);
  264. this.y = Math.round(this.y);
  265. return this;
  266. }
  267. };
  268. /**
  269. * Construct a point from an array if necessary, otherwise if the input
  270. * is already a Point, or an unknown type, return it unchanged
  271. * @param {Array<Number>|Point|*} a any kind of input value
  272. * @return {Point} constructed point, or passed-through value.
  273. * @example
  274. * // this
  275. * var point = Point.convert([0, 1]);
  276. * // is equivalent to
  277. * var point = new Point(0, 1);
  278. */
  279. Point.convert = function (a) {
  280. if (a instanceof Point) {
  281. return a;
  282. }
  283. if (Array.isArray(a)) {
  284. return new Point(a[0], a[1]);
  285. }
  286. return a;
  287. };
  288. /***/ }),
  289. /***/ 929:
  290. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  291. module.exports.VectorTile = __webpack_require__(779);
  292. /* unused reexport */ __webpack_require__(24);
  293. /* unused reexport */ __webpack_require__(701);
  294. /***/ }),
  295. /***/ 779:
  296. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  297. "use strict";
  298. var VectorTileLayer = __webpack_require__(701);
  299. module.exports = VectorTile;
  300. function VectorTile(pbf, end) {
  301. this.layers = pbf.readFields(readTile, {}, end);
  302. }
  303. function readTile(tag, layers, pbf) {
  304. if (tag === 3) {
  305. var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
  306. if (layer.length) layers[layer.name] = layer;
  307. }
  308. }
  309. /***/ }),
  310. /***/ 24:
  311. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  312. "use strict";
  313. var Point = __webpack_require__(550);
  314. module.exports = VectorTileFeature;
  315. function VectorTileFeature(pbf, end, extent, keys, values) {
  316. // Public
  317. this.properties = {};
  318. this.extent = extent;
  319. this.type = 0;
  320. // Private
  321. this._pbf = pbf;
  322. this._geometry = -1;
  323. this._keys = keys;
  324. this._values = values;
  325. pbf.readFields(readFeature, this, end);
  326. }
  327. function readFeature(tag, feature, pbf) {
  328. if (tag == 1) feature.id = pbf.readVarint();
  329. else if (tag == 2) readTag(pbf, feature);
  330. else if (tag == 3) feature.type = pbf.readVarint();
  331. else if (tag == 4) feature._geometry = pbf.pos;
  332. }
  333. function readTag(pbf, feature) {
  334. var end = pbf.readVarint() + pbf.pos;
  335. while (pbf.pos < end) {
  336. var key = feature._keys[pbf.readVarint()],
  337. value = feature._values[pbf.readVarint()];
  338. feature.properties[key] = value;
  339. }
  340. }
  341. VectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];
  342. VectorTileFeature.prototype.loadGeometry = function() {
  343. var pbf = this._pbf;
  344. pbf.pos = this._geometry;
  345. var end = pbf.readVarint() + pbf.pos,
  346. cmd = 1,
  347. length = 0,
  348. x = 0,
  349. y = 0,
  350. lines = [],
  351. line;
  352. while (pbf.pos < end) {
  353. if (length <= 0) {
  354. var cmdLen = pbf.readVarint();
  355. cmd = cmdLen & 0x7;
  356. length = cmdLen >> 3;
  357. }
  358. length--;
  359. if (cmd === 1 || cmd === 2) {
  360. x += pbf.readSVarint();
  361. y += pbf.readSVarint();
  362. if (cmd === 1) { // moveTo
  363. if (line) lines.push(line);
  364. line = [];
  365. }
  366. line.push(new Point(x, y));
  367. } else if (cmd === 7) {
  368. // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
  369. if (line) {
  370. line.push(line[0].clone()); // closePolygon
  371. }
  372. } else {
  373. throw new Error('unknown command ' + cmd);
  374. }
  375. }
  376. if (line) lines.push(line);
  377. return lines;
  378. };
  379. VectorTileFeature.prototype.bbox = function() {
  380. var pbf = this._pbf;
  381. pbf.pos = this._geometry;
  382. var end = pbf.readVarint() + pbf.pos,
  383. cmd = 1,
  384. length = 0,
  385. x = 0,
  386. y = 0,
  387. x1 = Infinity,
  388. x2 = -Infinity,
  389. y1 = Infinity,
  390. y2 = -Infinity;
  391. while (pbf.pos < end) {
  392. if (length <= 0) {
  393. var cmdLen = pbf.readVarint();
  394. cmd = cmdLen & 0x7;
  395. length = cmdLen >> 3;
  396. }
  397. length--;
  398. if (cmd === 1 || cmd === 2) {
  399. x += pbf.readSVarint();
  400. y += pbf.readSVarint();
  401. if (x < x1) x1 = x;
  402. if (x > x2) x2 = x;
  403. if (y < y1) y1 = y;
  404. if (y > y2) y2 = y;
  405. } else if (cmd !== 7) {
  406. throw new Error('unknown command ' + cmd);
  407. }
  408. }
  409. return [x1, y1, x2, y2];
  410. };
  411. VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
  412. var size = this.extent * Math.pow(2, z),
  413. x0 = this.extent * x,
  414. y0 = this.extent * y,
  415. coords = this.loadGeometry(),
  416. type = VectorTileFeature.types[this.type],
  417. i, j;
  418. function project(line) {
  419. for (var j = 0; j < line.length; j++) {
  420. var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;
  421. line[j] = [
  422. (p.x + x0) * 360 / size - 180,
  423. 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
  424. ];
  425. }
  426. }
  427. switch (this.type) {
  428. case 1:
  429. var points = [];
  430. for (i = 0; i < coords.length; i++) {
  431. points[i] = coords[i][0];
  432. }
  433. coords = points;
  434. project(coords);
  435. break;
  436. case 2:
  437. for (i = 0; i < coords.length; i++) {
  438. project(coords[i]);
  439. }
  440. break;
  441. case 3:
  442. coords = classifyRings(coords);
  443. for (i = 0; i < coords.length; i++) {
  444. for (j = 0; j < coords[i].length; j++) {
  445. project(coords[i][j]);
  446. }
  447. }
  448. break;
  449. }
  450. if (coords.length === 1) {
  451. coords = coords[0];
  452. } else {
  453. type = 'Multi' + type;
  454. }
  455. var result = {
  456. type: "Feature",
  457. geometry: {
  458. type: type,
  459. coordinates: coords
  460. },
  461. properties: this.properties
  462. };
  463. if ('id' in this) {
  464. result.id = this.id;
  465. }
  466. return result;
  467. };
  468. // classifies an array of rings into polygons with outer rings and holes
  469. function classifyRings(rings) {
  470. var len = rings.length;
  471. if (len <= 1) return [rings];
  472. var polygons = [],
  473. polygon,
  474. ccw;
  475. for (var i = 0; i < len; i++) {
  476. var area = signedArea(rings[i]);
  477. if (area === 0) continue;
  478. if (ccw === undefined) ccw = area < 0;
  479. if (ccw === area < 0) {
  480. if (polygon) polygons.push(polygon);
  481. polygon = [rings[i]];
  482. } else {
  483. polygon.push(rings[i]);
  484. }
  485. }
  486. if (polygon) polygons.push(polygon);
  487. return polygons;
  488. }
  489. function signedArea(ring) {
  490. var sum = 0;
  491. for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
  492. p1 = ring[i];
  493. p2 = ring[j];
  494. sum += (p2.x - p1.x) * (p1.y + p2.y);
  495. }
  496. return sum;
  497. }
  498. /***/ }),
  499. /***/ 701:
  500. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  501. "use strict";
  502. var VectorTileFeature = __webpack_require__(24);
  503. module.exports = VectorTileLayer;
  504. function VectorTileLayer(pbf, end) {
  505. // Public
  506. this.version = 1;
  507. this.name = null;
  508. this.extent = 4096;
  509. this.length = 0;
  510. // Private
  511. this._pbf = pbf;
  512. this._keys = [];
  513. this._values = [];
  514. this._features = [];
  515. pbf.readFields(readLayer, this, end);
  516. this.length = this._features.length;
  517. }
  518. function readLayer(tag, layer, pbf) {
  519. if (tag === 15) layer.version = pbf.readVarint();
  520. else if (tag === 1) layer.name = pbf.readString();
  521. else if (tag === 5) layer.extent = pbf.readVarint();
  522. else if (tag === 2) layer._features.push(pbf.pos);
  523. else if (tag === 3) layer._keys.push(pbf.readString());
  524. else if (tag === 4) layer._values.push(readValueMessage(pbf));
  525. }
  526. function readValueMessage(pbf) {
  527. var value = null,
  528. end = pbf.readVarint() + pbf.pos;
  529. while (pbf.pos < end) {
  530. var tag = pbf.readVarint() >> 3;
  531. value = tag === 1 ? pbf.readString() :
  532. tag === 2 ? pbf.readFloat() :
  533. tag === 3 ? pbf.readDouble() :
  534. tag === 4 ? pbf.readVarint64() :
  535. tag === 5 ? pbf.readVarint() :
  536. tag === 6 ? pbf.readSVarint() :
  537. tag === 7 ? pbf.readBoolean() : null;
  538. }
  539. return value;
  540. }
  541. // return feature `i` from this layer as a `VectorTileFeature`
  542. VectorTileLayer.prototype.feature = function(i) {
  543. if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');
  544. this._pbf.pos = this._features[i];
  545. var end = this._pbf.readVarint() + this._pbf.pos;
  546. return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
  547. };
  548. /***/ }),
  549. /***/ 693:
  550. /***/ (function(module) {
  551. (function(self) {
  552. 'use strict';
  553. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  554. // with Ajax.
  555. if (!self.__disableNativeFetch && self.fetch) {
  556. return
  557. }
  558. function normalizeName(name) {
  559. if (typeof name !== 'string') {
  560. name = String(name)
  561. }
  562. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  563. throw new TypeError('Invalid character in header field name')
  564. }
  565. return name.toLowerCase()
  566. }
  567. function normalizeValue(value) {
  568. if (typeof value !== 'string') {
  569. value = String(value)
  570. }
  571. return value
  572. }
  573. function Headers(headers) {
  574. this.map = {}
  575. if (headers instanceof Headers) {
  576. headers.forEach(function(value, name) {
  577. this.append(name, value)
  578. }, this)
  579. } else if (headers) {
  580. Object.getOwnPropertyNames(headers).forEach(function(name) {
  581. this.append(name, headers[name])
  582. }, this)
  583. }
  584. }
  585. Headers.prototype.append = function(name, value) {
  586. name = normalizeName(name)
  587. value = normalizeValue(value)
  588. var list = this.map[name]
  589. if (!list) {
  590. list = []
  591. this.map[name] = list
  592. }
  593. list.push(value)
  594. }
  595. Headers.prototype['delete'] = function(name) {
  596. delete this.map[normalizeName(name)]
  597. }
  598. Headers.prototype.get = function(name) {
  599. var values = this.map[normalizeName(name)]
  600. return values ? values[0] : null
  601. }
  602. Headers.prototype.getAll = function(name) {
  603. return this.map[normalizeName(name)] || []
  604. }
  605. Headers.prototype.has = function(name) {
  606. return this.map.hasOwnProperty(normalizeName(name))
  607. }
  608. Headers.prototype.set = function(name, value) {
  609. this.map[normalizeName(name)] = [normalizeValue(value)]
  610. }
  611. Headers.prototype.forEach = function(callback, thisArg) {
  612. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  613. this.map[name].forEach(function(value) {
  614. callback.call(thisArg, value, name, this)
  615. }, this)
  616. }, this)
  617. }
  618. function consumed(body) {
  619. if (body.bodyUsed) {
  620. return Promise.reject(new TypeError('Already read'))
  621. }
  622. body.bodyUsed = true
  623. }
  624. function fileReaderReady(reader) {
  625. return new Promise(function(resolve, reject) {
  626. reader.onload = function() {
  627. resolve(reader.result)
  628. }
  629. reader.onerror = function() {
  630. reject(reader.error)
  631. }
  632. })
  633. }
  634. function readBlobAsArrayBuffer(blob) {
  635. var reader = new FileReader()
  636. reader.readAsArrayBuffer(blob)
  637. return fileReaderReady(reader)
  638. }
  639. function readBlobAsText(blob, options) {
  640. var reader = new FileReader()
  641. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  642. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  643. var _charset = blob.type.match(regex) || contentType.match(regex)
  644. var args = [blob]
  645. if(_charset) {
  646. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  647. }
  648. reader.readAsText.apply(reader, args)
  649. return fileReaderReady(reader)
  650. }
  651. var support = {
  652. blob: 'FileReader' in self && 'Blob' in self && (function() {
  653. try {
  654. new Blob();
  655. return true
  656. } catch(e) {
  657. return false
  658. }
  659. })(),
  660. formData: 'FormData' in self,
  661. arrayBuffer: 'ArrayBuffer' in self
  662. }
  663. function Body() {
  664. this.bodyUsed = false
  665. this._initBody = function(body, options) {
  666. this._bodyInit = body
  667. if (typeof body === 'string') {
  668. this._bodyText = body
  669. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  670. this._bodyBlob = body
  671. this._options = options
  672. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  673. this._bodyFormData = body
  674. } else if (!body) {
  675. this._bodyText = ''
  676. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  677. // Only support ArrayBuffers for POST method.
  678. // Receiving ArrayBuffers happens via Blobs, instead.
  679. } else {
  680. throw new Error('unsupported BodyInit type')
  681. }
  682. }
  683. if (support.blob) {
  684. this.blob = function() {
  685. var rejected = consumed(this)
  686. if (rejected) {
  687. return rejected
  688. }
  689. if (this._bodyBlob) {
  690. return Promise.resolve(this._bodyBlob)
  691. } else if (this._bodyFormData) {
  692. throw new Error('could not read FormData body as blob')
  693. } else {
  694. return Promise.resolve(new Blob([this._bodyText]))
  695. }
  696. }
  697. this.arrayBuffer = function() {
  698. return this.blob().then(readBlobAsArrayBuffer)
  699. }
  700. this.text = function() {
  701. var rejected = consumed(this)
  702. if (rejected) {
  703. return rejected
  704. }
  705. if (this._bodyBlob) {
  706. return readBlobAsText(this._bodyBlob, this._options)
  707. } else if (this._bodyFormData) {
  708. throw new Error('could not read FormData body as text')
  709. } else {
  710. return Promise.resolve(this._bodyText)
  711. }
  712. }
  713. } else {
  714. this.text = function() {
  715. var rejected = consumed(this)
  716. return rejected ? rejected : Promise.resolve(this._bodyText)
  717. }
  718. }
  719. if (support.formData) {
  720. this.formData = function() {
  721. return this.text().then(decode)
  722. }
  723. }
  724. this.json = function() {
  725. return this.text().then(JSON.parse)
  726. }
  727. return this
  728. }
  729. // HTTP methods whose capitalization should be normalized
  730. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  731. function normalizeMethod(method) {
  732. var upcased = method.toUpperCase()
  733. return (methods.indexOf(upcased) > -1) ? upcased : method
  734. }
  735. function Request(input, options) {
  736. options = options || {}
  737. var body = options.body
  738. if (Request.prototype.isPrototypeOf(input)) {
  739. if (input.bodyUsed) {
  740. throw new TypeError('Already read')
  741. }
  742. this.url = input.url
  743. this.credentials = input.credentials
  744. if (!options.headers) {
  745. this.headers = new Headers(input.headers)
  746. }
  747. this.method = input.method
  748. this.mode = input.mode
  749. if (!body) {
  750. body = input._bodyInit
  751. input.bodyUsed = true
  752. }
  753. } else {
  754. this.url = input
  755. }
  756. this.credentials = options.credentials || this.credentials || 'omit'
  757. if (options.headers || !this.headers) {
  758. this.headers = new Headers(options.headers)
  759. }
  760. this.method = normalizeMethod(options.method || this.method || 'GET')
  761. this.mode = options.mode || this.mode || null
  762. this.referrer = null
  763. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  764. throw new TypeError('Body not allowed for GET or HEAD requests')
  765. }
  766. this._initBody(body, options)
  767. }
  768. Request.prototype.clone = function() {
  769. return new Request(this)
  770. }
  771. function decode(body) {
  772. var form = new FormData()
  773. body.trim().split('&').forEach(function(bytes) {
  774. if (bytes) {
  775. var split = bytes.split('=')
  776. var name = split.shift().replace(/\+/g, ' ')
  777. var value = split.join('=').replace(/\+/g, ' ')
  778. form.append(decodeURIComponent(name), decodeURIComponent(value))
  779. }
  780. })
  781. return form
  782. }
  783. function headers(xhr) {
  784. var head = new Headers()
  785. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  786. pairs.forEach(function(header) {
  787. var split = header.trim().split(':')
  788. var key = split.shift().trim()
  789. var value = split.join(':').trim()
  790. head.append(key, value)
  791. })
  792. return head
  793. }
  794. Body.call(Request.prototype)
  795. function Response(bodyInit, options) {
  796. if (!options) {
  797. options = {}
  798. }
  799. this._initBody(bodyInit, options)
  800. this.type = 'default'
  801. this.status = options.status
  802. this.ok = this.status >= 200 && this.status < 300
  803. this.statusText = options.statusText
  804. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  805. this.url = options.url || ''
  806. }
  807. Body.call(Response.prototype)
  808. Response.prototype.clone = function() {
  809. return new Response(this._bodyInit, {
  810. status: this.status,
  811. statusText: this.statusText,
  812. headers: new Headers(this.headers),
  813. url: this.url
  814. })
  815. }
  816. Response.error = function() {
  817. var response = new Response(null, {status: 0, statusText: ''})
  818. response.type = 'error'
  819. return response
  820. }
  821. var redirectStatuses = [301, 302, 303, 307, 308]
  822. Response.redirect = function(url, status) {
  823. if (redirectStatuses.indexOf(status) === -1) {
  824. throw new RangeError('Invalid status code')
  825. }
  826. return new Response(null, {status: status, headers: {location: url}})
  827. }
  828. self.Headers = Headers;
  829. self.Request = Request;
  830. self.Response = Response;
  831. self.fetch = function(input, init) {
  832. return new Promise(function(resolve, reject) {
  833. var request
  834. if (Request.prototype.isPrototypeOf(input) && !init) {
  835. request = input
  836. } else {
  837. request = new Request(input, init)
  838. }
  839. var xhr = new XMLHttpRequest()
  840. function responseURL() {
  841. if ('responseURL' in xhr) {
  842. return xhr.responseURL
  843. }
  844. // Avoid security warnings on getResponseHeader when not allowed by CORS
  845. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  846. return xhr.getResponseHeader('X-Request-URL')
  847. }
  848. return;
  849. }
  850. var __onLoadHandled = false;
  851. function onload() {
  852. if (xhr.readyState !== 4) {
  853. return
  854. }
  855. var status = (xhr.status === 1223) ? 204 : xhr.status
  856. if (status < 100 || status > 599) {
  857. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  858. reject(new TypeError('Network request failed'))
  859. return
  860. }
  861. var options = {
  862. status: status,
  863. statusText: xhr.statusText,
  864. headers: headers(xhr),
  865. url: responseURL()
  866. }
  867. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  868. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  869. resolve(new Response(body, options))
  870. }
  871. xhr.onreadystatechange = onload;
  872. xhr.onload = onload;
  873. xhr.onerror = function() {
  874. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  875. reject(new TypeError('Network request failed'))
  876. }
  877. xhr.open(request.method, request.url, true)
  878. // `withCredentials` should be setted after calling `.open` in IE10
  879. // http://stackoverflow.com/a/19667959/1219343
  880. try {
  881. if (request.credentials === 'include') {
  882. if ('withCredentials' in xhr) {
  883. xhr.withCredentials = true;
  884. } else {
  885. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  886. }
  887. }
  888. } catch (e) {
  889. console && console.warn && console.warn('set withCredentials error:' + e);
  890. }
  891. if ('responseType' in xhr && support.blob) {
  892. xhr.responseType = 'blob'
  893. }
  894. request.headers.forEach(function(value, name) {
  895. xhr.setRequestHeader(name, value)
  896. })
  897. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  898. })
  899. }
  900. self.fetch.polyfill = true
  901. // Support CommonJS
  902. if ( true && module.exports) {
  903. module.exports = self.fetch;
  904. }
  905. })(typeof self !== 'undefined' ? self : this);
  906. /***/ }),
  907. /***/ 144:
  908. /***/ (function(module, exports) {
  909. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  910. if (true) {
  911. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  912. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  913. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  914. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  915. } else { var mod; }
  916. })(this, function (exports, module) {
  917. 'use strict';
  918. var defaultOptions = {
  919. timeout: 5000,
  920. jsonpCallback: 'callback',
  921. jsonpCallbackFunction: null
  922. };
  923. function generateCallbackFunction() {
  924. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  925. }
  926. function clearFunction(functionName) {
  927. // IE8 throws an exception when you try to delete a property on window
  928. // http://stackoverflow.com/a/1824228/751089
  929. try {
  930. delete window[functionName];
  931. } catch (e) {
  932. window[functionName] = undefined;
  933. }
  934. }
  935. function removeScript(scriptId) {
  936. var script = document.getElementById(scriptId);
  937. if (script) {
  938. document.getElementsByTagName('head')[0].removeChild(script);
  939. }
  940. }
  941. function fetchJsonp(_url) {
  942. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  943. // to avoid param reassign
  944. var url = _url;
  945. var timeout = options.timeout || defaultOptions.timeout;
  946. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  947. var timeoutId = undefined;
  948. return new Promise(function (resolve, reject) {
  949. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  950. var scriptId = jsonpCallback + '_' + callbackFunction;
  951. window[callbackFunction] = function (response) {
  952. resolve({
  953. ok: true,
  954. // keep consistent with fetch API
  955. json: function json() {
  956. return Promise.resolve(response);
  957. }
  958. });
  959. if (timeoutId) clearTimeout(timeoutId);
  960. removeScript(scriptId);
  961. clearFunction(callbackFunction);
  962. };
  963. // Check if the user set their own params, and if not add a ? to start a list of params
  964. url += url.indexOf('?') === -1 ? '?' : '&';
  965. var jsonpScript = document.createElement('script');
  966. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  967. if (options.charset) {
  968. jsonpScript.setAttribute('charset', options.charset);
  969. }
  970. jsonpScript.id = scriptId;
  971. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  972. timeoutId = setTimeout(function () {
  973. reject(new Error('JSONP request to ' + _url + ' timed out'));
  974. clearFunction(callbackFunction);
  975. removeScript(scriptId);
  976. window[callbackFunction] = function () {
  977. clearFunction(callbackFunction);
  978. };
  979. }, timeout);
  980. // Caught if got 404/500
  981. jsonpScript.onerror = function () {
  982. reject(new Error('JSONP request to ' + _url + ' failed'));
  983. clearFunction(callbackFunction);
  984. removeScript(scriptId);
  985. if (timeoutId) clearTimeout(timeoutId);
  986. };
  987. });
  988. }
  989. // export as global function
  990. /*
  991. let local;
  992. if (typeof global !== 'undefined') {
  993. local = global;
  994. } else if (typeof self !== 'undefined') {
  995. local = self;
  996. } else {
  997. try {
  998. local = Function('return this')();
  999. } catch (e) {
  1000. throw new Error('polyfill failed because global object is unavailable in this environment');
  1001. }
  1002. }
  1003. local.fetchJsonp = fetchJsonp;
  1004. */
  1005. module.exports = fetchJsonp;
  1006. });
  1007. /***/ }),
  1008. /***/ 962:
  1009. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1010. "use strict";
  1011. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1012. exports.Builder = void 0;
  1013. var byte_buffer_js_1 = __webpack_require__(505);
  1014. var constants_js_1 = __webpack_require__(147);
  1015. var Builder = /** @class */ (function () {
  1016. /**
  1017. * Create a FlatBufferBuilder.
  1018. */
  1019. function Builder(opt_initial_size) {
  1020. /** Minimum alignment encountered so far. */
  1021. this.minalign = 1;
  1022. /** The vtable for the current table. */
  1023. this.vtable = null;
  1024. /** The amount of fields we're actually using. */
  1025. this.vtable_in_use = 0;
  1026. /** Whether we are currently serializing a table. */
  1027. this.isNested = false;
  1028. /** Starting offset of the current struct/table. */
  1029. this.object_start = 0;
  1030. /** List of offsets of all vtables. */
  1031. this.vtables = [];
  1032. /** For the current vector being built. */
  1033. this.vector_num_elems = 0;
  1034. /** False omits default values from the serialized data */
  1035. this.force_defaults = false;
  1036. this.string_maps = null;
  1037. var initial_size;
  1038. if (!opt_initial_size) {
  1039. initial_size = 1024;
  1040. }
  1041. else {
  1042. initial_size = opt_initial_size;
  1043. }
  1044. /**
  1045. * @type {ByteBuffer}
  1046. * @private
  1047. */
  1048. this.bb = byte_buffer_js_1.ByteBuffer.allocate(initial_size);
  1049. this.space = initial_size;
  1050. }
  1051. Builder.prototype.clear = function () {
  1052. this.bb.clear();
  1053. this.space = this.bb.capacity();
  1054. this.minalign = 1;
  1055. this.vtable = null;
  1056. this.vtable_in_use = 0;
  1057. this.isNested = false;
  1058. this.object_start = 0;
  1059. this.vtables = [];
  1060. this.vector_num_elems = 0;
  1061. this.force_defaults = false;
  1062. this.string_maps = null;
  1063. };
  1064. /**
  1065. * In order to save space, fields that are set to their default value
  1066. * don't get serialized into the buffer. Forcing defaults provides a
  1067. * way to manually disable this optimization.
  1068. *
  1069. * @param forceDefaults true always serializes default values
  1070. */
  1071. Builder.prototype.forceDefaults = function (forceDefaults) {
  1072. this.force_defaults = forceDefaults;
  1073. };
  1074. /**
  1075. * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
  1076. * called finish(). The actual data starts at the ByteBuffer's current position,
  1077. * not necessarily at 0.
  1078. */
  1079. Builder.prototype.dataBuffer = function () {
  1080. return this.bb;
  1081. };
  1082. /**
  1083. * Get the bytes representing the FlatBuffer. Only call this after you've
  1084. * called finish().
  1085. */
  1086. Builder.prototype.asUint8Array = function () {
  1087. return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
  1088. };
  1089. /**
  1090. * Prepare to write an element of `size` after `additional_bytes` have been
  1091. * written, e.g. if you write a string, you need to align such the int length
  1092. * field is aligned to 4 bytes, and the string data follows it directly. If all
  1093. * you need to do is alignment, `additional_bytes` will be 0.
  1094. *
  1095. * @param size This is the of the new element to write
  1096. * @param additional_bytes The padding size
  1097. */
  1098. Builder.prototype.prep = function (size, additional_bytes) {
  1099. // Track the biggest thing we've ever aligned to.
  1100. if (size > this.minalign) {
  1101. this.minalign = size;
  1102. }
  1103. // Find the amount of alignment needed such that `size` is properly
  1104. // aligned after `additional_bytes`
  1105. var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);
  1106. // Reallocate the buffer if needed.
  1107. while (this.space < align_size + size + additional_bytes) {
  1108. var old_buf_size = this.bb.capacity();
  1109. this.bb = Builder.growByteBuffer(this.bb);
  1110. this.space += this.bb.capacity() - old_buf_size;
  1111. }
  1112. this.pad(align_size);
  1113. };
  1114. Builder.prototype.pad = function (byte_size) {
  1115. for (var i = 0; i < byte_size; i++) {
  1116. this.bb.writeInt8(--this.space, 0);
  1117. }
  1118. };
  1119. Builder.prototype.writeInt8 = function (value) {
  1120. this.bb.writeInt8(this.space -= 1, value);
  1121. };
  1122. Builder.prototype.writeInt16 = function (value) {
  1123. this.bb.writeInt16(this.space -= 2, value);
  1124. };
  1125. Builder.prototype.writeInt32 = function (value) {
  1126. this.bb.writeInt32(this.space -= 4, value);
  1127. };
  1128. Builder.prototype.writeInt64 = function (value) {
  1129. this.bb.writeInt64(this.space -= 8, value);
  1130. };
  1131. Builder.prototype.writeFloat32 = function (value) {
  1132. this.bb.writeFloat32(this.space -= 4, value);
  1133. };
  1134. Builder.prototype.writeFloat64 = function (value) {
  1135. this.bb.writeFloat64(this.space -= 8, value);
  1136. };
  1137. /**
  1138. * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
  1139. * @param value The `int8` to add the the buffer.
  1140. */
  1141. Builder.prototype.addInt8 = function (value) {
  1142. this.prep(1, 0);
  1143. this.writeInt8(value);
  1144. };
  1145. /**
  1146. * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
  1147. * @param value The `int16` to add the the buffer.
  1148. */
  1149. Builder.prototype.addInt16 = function (value) {
  1150. this.prep(2, 0);
  1151. this.writeInt16(value);
  1152. };
  1153. /**
  1154. * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
  1155. * @param value The `int32` to add the the buffer.
  1156. */
  1157. Builder.prototype.addInt32 = function (value) {
  1158. this.prep(4, 0);
  1159. this.writeInt32(value);
  1160. };
  1161. /**
  1162. * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
  1163. * @param value The `int64` to add the the buffer.
  1164. */
  1165. Builder.prototype.addInt64 = function (value) {
  1166. this.prep(8, 0);
  1167. this.writeInt64(value);
  1168. };
  1169. /**
  1170. * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
  1171. * @param value The `float32` to add the the buffer.
  1172. */
  1173. Builder.prototype.addFloat32 = function (value) {
  1174. this.prep(4, 0);
  1175. this.writeFloat32(value);
  1176. };
  1177. /**
  1178. * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
  1179. * @param value The `float64` to add the the buffer.
  1180. */
  1181. Builder.prototype.addFloat64 = function (value) {
  1182. this.prep(8, 0);
  1183. this.writeFloat64(value);
  1184. };
  1185. Builder.prototype.addFieldInt8 = function (voffset, value, defaultValue) {
  1186. if (this.force_defaults || value != defaultValue) {
  1187. this.addInt8(value);
  1188. this.slot(voffset);
  1189. }
  1190. };
  1191. Builder.prototype.addFieldInt16 = function (voffset, value, defaultValue) {
  1192. if (this.force_defaults || value != defaultValue) {
  1193. this.addInt16(value);
  1194. this.slot(voffset);
  1195. }
  1196. };
  1197. Builder.prototype.addFieldInt32 = function (voffset, value, defaultValue) {
  1198. if (this.force_defaults || value != defaultValue) {
  1199. this.addInt32(value);
  1200. this.slot(voffset);
  1201. }
  1202. };
  1203. Builder.prototype.addFieldInt64 = function (voffset, value, defaultValue) {
  1204. if (this.force_defaults || value !== defaultValue) {
  1205. this.addInt64(value);
  1206. this.slot(voffset);
  1207. }
  1208. };
  1209. Builder.prototype.addFieldFloat32 = function (voffset, value, defaultValue) {
  1210. if (this.force_defaults || value != defaultValue) {
  1211. this.addFloat32(value);
  1212. this.slot(voffset);
  1213. }
  1214. };
  1215. Builder.prototype.addFieldFloat64 = function (voffset, value, defaultValue) {
  1216. if (this.force_defaults || value != defaultValue) {
  1217. this.addFloat64(value);
  1218. this.slot(voffset);
  1219. }
  1220. };
  1221. Builder.prototype.addFieldOffset = function (voffset, value, defaultValue) {
  1222. if (this.force_defaults || value != defaultValue) {
  1223. this.addOffset(value);
  1224. this.slot(voffset);
  1225. }
  1226. };
  1227. /**
  1228. * Structs are stored inline, so nothing additional is being added. `d` is always 0.
  1229. */
  1230. Builder.prototype.addFieldStruct = function (voffset, value, defaultValue) {
  1231. if (value != defaultValue) {
  1232. this.nested(value);
  1233. this.slot(voffset);
  1234. }
  1235. };
  1236. /**
  1237. * Structures are always stored inline, they need to be created right
  1238. * where they're used. You'll get this assertion failure if you
  1239. * created it elsewhere.
  1240. */
  1241. Builder.prototype.nested = function (obj) {
  1242. if (obj != this.offset()) {
  1243. throw new Error('FlatBuffers: struct must be serialized inline.');
  1244. }
  1245. };
  1246. /**
  1247. * Should not be creating any other object, string or vector
  1248. * while an object is being constructed
  1249. */
  1250. Builder.prototype.notNested = function () {
  1251. if (this.isNested) {
  1252. throw new Error('FlatBuffers: object serialization must not be nested.');
  1253. }
  1254. };
  1255. /**
  1256. * Set the current vtable at `voffset` to the current location in the buffer.
  1257. */
  1258. Builder.prototype.slot = function (voffset) {
  1259. if (this.vtable !== null)
  1260. this.vtable[voffset] = this.offset();
  1261. };
  1262. /**
  1263. * @returns Offset relative to the end of the buffer.
  1264. */
  1265. Builder.prototype.offset = function () {
  1266. return this.bb.capacity() - this.space;
  1267. };
  1268. /**
  1269. * Doubles the size of the backing ByteBuffer and copies the old data towards
  1270. * the end of the new buffer (since we build the buffer backwards).
  1271. *
  1272. * @param bb The current buffer with the existing data
  1273. * @returns A new byte buffer with the old data copied
  1274. * to it. The data is located at the end of the buffer.
  1275. *
  1276. * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
  1277. * it a uint8Array we need to suppress the type check:
  1278. * @suppress {checkTypes}
  1279. */
  1280. Builder.growByteBuffer = function (bb) {
  1281. var old_buf_size = bb.capacity();
  1282. // Ensure we don't grow beyond what fits in an int.
  1283. if (old_buf_size & 0xC0000000) {
  1284. throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
  1285. }
  1286. var new_buf_size = old_buf_size << 1;
  1287. var nbb = byte_buffer_js_1.ByteBuffer.allocate(new_buf_size);
  1288. nbb.setPosition(new_buf_size - old_buf_size);
  1289. nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
  1290. return nbb;
  1291. };
  1292. /**
  1293. * Adds on offset, relative to where it will be written.
  1294. *
  1295. * @param offset The offset to add.
  1296. */
  1297. Builder.prototype.addOffset = function (offset) {
  1298. this.prep(constants_js_1.SIZEOF_INT, 0); // Ensure alignment is already done.
  1299. this.writeInt32(this.offset() - offset + constants_js_1.SIZEOF_INT);
  1300. };
  1301. /**
  1302. * Start encoding a new object in the buffer. Users will not usually need to
  1303. * call this directly. The FlatBuffers compiler will generate helper methods
  1304. * that call this method internally.
  1305. */
  1306. Builder.prototype.startObject = function (numfields) {
  1307. this.notNested();
  1308. if (this.vtable == null) {
  1309. this.vtable = [];
  1310. }
  1311. this.vtable_in_use = numfields;
  1312. for (var i = 0; i < numfields; i++) {
  1313. this.vtable[i] = 0; // This will push additional elements as needed
  1314. }
  1315. this.isNested = true;
  1316. this.object_start = this.offset();
  1317. };
  1318. /**
  1319. * Finish off writing the object that is under construction.
  1320. *
  1321. * @returns The offset to the object inside `dataBuffer`
  1322. */
  1323. Builder.prototype.endObject = function () {
  1324. if (this.vtable == null || !this.isNested) {
  1325. throw new Error('FlatBuffers: endObject called without startObject');
  1326. }
  1327. this.addInt32(0);
  1328. var vtableloc = this.offset();
  1329. // Trim trailing zeroes.
  1330. var i = this.vtable_in_use - 1;
  1331. // eslint-disable-next-line no-empty
  1332. for (; i >= 0 && this.vtable[i] == 0; i--) { }
  1333. var trimmed_size = i + 1;
  1334. // Write out the current vtable.
  1335. for (; i >= 0; i--) {
  1336. // Offset relative to the start of the table.
  1337. this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
  1338. }
  1339. var standard_fields = 2; // The fields below:
  1340. this.addInt16(vtableloc - this.object_start);
  1341. var len = (trimmed_size + standard_fields) * constants_js_1.SIZEOF_SHORT;
  1342. this.addInt16(len);
  1343. // Search for an existing vtable that matches the current one.
  1344. var existing_vtable = 0;
  1345. var vt1 = this.space;
  1346. outer_loop: for (i = 0; i < this.vtables.length; i++) {
  1347. var vt2 = this.bb.capacity() - this.vtables[i];
  1348. if (len == this.bb.readInt16(vt2)) {
  1349. for (var j = constants_js_1.SIZEOF_SHORT; j < len; j += constants_js_1.SIZEOF_SHORT) {
  1350. if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
  1351. continue outer_loop;
  1352. }
  1353. }
  1354. existing_vtable = this.vtables[i];
  1355. break;
  1356. }
  1357. }
  1358. if (existing_vtable) {
  1359. // Found a match:
  1360. // Remove the current vtable.
  1361. this.space = this.bb.capacity() - vtableloc;
  1362. // Point table to existing vtable.
  1363. this.bb.writeInt32(this.space, existing_vtable - vtableloc);
  1364. }
  1365. else {
  1366. // No match:
  1367. // Add the location of the current vtable to the list of vtables.
  1368. this.vtables.push(this.offset());
  1369. // Point table to current vtable.
  1370. this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
  1371. }
  1372. this.isNested = false;
  1373. return vtableloc;
  1374. };
  1375. /**
  1376. * Finalize a buffer, poiting to the given `root_table`.
  1377. */
  1378. Builder.prototype.finish = function (root_table, opt_file_identifier, opt_size_prefix) {
  1379. var size_prefix = opt_size_prefix ? constants_js_1.SIZE_PREFIX_LENGTH : 0;
  1380. if (opt_file_identifier) {
  1381. var file_identifier = opt_file_identifier;
  1382. this.prep(this.minalign, constants_js_1.SIZEOF_INT +
  1383. constants_js_1.FILE_IDENTIFIER_LENGTH + size_prefix);
  1384. if (file_identifier.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1385. throw new Error('FlatBuffers: file identifier must be length ' +
  1386. constants_js_1.FILE_IDENTIFIER_LENGTH);
  1387. }
  1388. for (var i = constants_js_1.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
  1389. this.writeInt8(file_identifier.charCodeAt(i));
  1390. }
  1391. }
  1392. this.prep(this.minalign, constants_js_1.SIZEOF_INT + size_prefix);
  1393. this.addOffset(root_table);
  1394. if (size_prefix) {
  1395. this.addInt32(this.bb.capacity() - this.space);
  1396. }
  1397. this.bb.setPosition(this.space);
  1398. };
  1399. /**
  1400. * Finalize a size prefixed buffer, pointing to the given `root_table`.
  1401. */
  1402. Builder.prototype.finishSizePrefixed = function (root_table, opt_file_identifier) {
  1403. this.finish(root_table, opt_file_identifier, true);
  1404. };
  1405. /**
  1406. * This checks a required field has been set in a given table that has
  1407. * just been constructed.
  1408. */
  1409. Builder.prototype.requiredField = function (table, field) {
  1410. var table_start = this.bb.capacity() - table;
  1411. var vtable_start = table_start - this.bb.readInt32(table_start);
  1412. var ok = this.bb.readInt16(vtable_start + field) != 0;
  1413. // If this fails, the caller will show what field needs to be set.
  1414. if (!ok) {
  1415. throw new Error('FlatBuffers: field ' + field + ' must be set');
  1416. }
  1417. };
  1418. /**
  1419. * Start a new array/vector of objects. Users usually will not call
  1420. * this directly. The FlatBuffers compiler will create a start/end
  1421. * method for vector types in generated code.
  1422. *
  1423. * @param elem_size The size of each element in the array
  1424. * @param num_elems The number of elements in the array
  1425. * @param alignment The alignment of the array
  1426. */
  1427. Builder.prototype.startVector = function (elem_size, num_elems, alignment) {
  1428. this.notNested();
  1429. this.vector_num_elems = num_elems;
  1430. this.prep(constants_js_1.SIZEOF_INT, elem_size * num_elems);
  1431. this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
  1432. };
  1433. /**
  1434. * Finish off the creation of an array and all its elements. The array must be
  1435. * created with `startVector`.
  1436. *
  1437. * @returns The offset at which the newly created array
  1438. * starts.
  1439. */
  1440. Builder.prototype.endVector = function () {
  1441. this.writeInt32(this.vector_num_elems);
  1442. return this.offset();
  1443. };
  1444. /**
  1445. * Encode the string `s` in the buffer using UTF-8. If the string passed has
  1446. * already been seen, we return the offset of the already written string
  1447. *
  1448. * @param s The string to encode
  1449. * @return The offset in the buffer where the encoded string starts
  1450. */
  1451. Builder.prototype.createSharedString = function (s) {
  1452. if (!s) {
  1453. return 0;
  1454. }
  1455. if (!this.string_maps) {
  1456. this.string_maps = new Map();
  1457. }
  1458. if (this.string_maps.has(s)) {
  1459. return this.string_maps.get(s);
  1460. }
  1461. var offset = this.createString(s);
  1462. this.string_maps.set(s, offset);
  1463. return offset;
  1464. };
  1465. /**
  1466. * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
  1467. * instead of a string, it is assumed to contain valid UTF-8 encoded data.
  1468. *
  1469. * @param s The string to encode
  1470. * @return The offset in the buffer where the encoded string starts
  1471. */
  1472. Builder.prototype.createString = function (s) {
  1473. if (s === null || s === undefined) {
  1474. return 0;
  1475. }
  1476. var utf8;
  1477. if (s instanceof Uint8Array) {
  1478. utf8 = s;
  1479. }
  1480. else {
  1481. utf8 = [];
  1482. var i = 0;
  1483. while (i < s.length) {
  1484. var codePoint = void 0;
  1485. // Decode UTF-16
  1486. var a = s.charCodeAt(i++);
  1487. if (a < 0xD800 || a >= 0xDC00) {
  1488. codePoint = a;
  1489. }
  1490. else {
  1491. var b = s.charCodeAt(i++);
  1492. codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);
  1493. }
  1494. // Encode UTF-8
  1495. if (codePoint < 0x80) {
  1496. utf8.push(codePoint);
  1497. }
  1498. else {
  1499. if (codePoint < 0x800) {
  1500. utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);
  1501. }
  1502. else {
  1503. if (codePoint < 0x10000) {
  1504. utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);
  1505. }
  1506. else {
  1507. utf8.push(((codePoint >> 18) & 0x07) | 0xF0, ((codePoint >> 12) & 0x3F) | 0x80);
  1508. }
  1509. utf8.push(((codePoint >> 6) & 0x3F) | 0x80);
  1510. }
  1511. utf8.push((codePoint & 0x3F) | 0x80);
  1512. }
  1513. }
  1514. }
  1515. this.addInt8(0);
  1516. this.startVector(1, utf8.length, 1);
  1517. this.bb.setPosition(this.space -= utf8.length);
  1518. for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {
  1519. bytes[offset++] = utf8[i];
  1520. }
  1521. return this.endVector();
  1522. };
  1523. /**
  1524. * A helper function to pack an object
  1525. *
  1526. * @returns offset of obj
  1527. */
  1528. Builder.prototype.createObjectOffset = function (obj) {
  1529. if (obj === null) {
  1530. return 0;
  1531. }
  1532. if (typeof obj === 'string') {
  1533. return this.createString(obj);
  1534. }
  1535. else {
  1536. return obj.pack(this);
  1537. }
  1538. };
  1539. /**
  1540. * A helper function to pack a list of object
  1541. *
  1542. * @returns list of offsets of each non null object
  1543. */
  1544. Builder.prototype.createObjectOffsetList = function (list) {
  1545. var ret = [];
  1546. for (var i = 0; i < list.length; ++i) {
  1547. var val = list[i];
  1548. if (val !== null) {
  1549. ret.push(this.createObjectOffset(val));
  1550. }
  1551. else {
  1552. throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
  1553. }
  1554. }
  1555. return ret;
  1556. };
  1557. Builder.prototype.createStructOffsetList = function (list, startFunc) {
  1558. startFunc(this, list.length);
  1559. this.createObjectOffsetList(list);
  1560. return this.endVector();
  1561. };
  1562. return Builder;
  1563. }());
  1564. exports.Builder = Builder;
  1565. /***/ }),
  1566. /***/ 505:
  1567. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1568. "use strict";
  1569. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1570. exports.ByteBuffer = void 0;
  1571. var constants_js_1 = __webpack_require__(147);
  1572. var utils_js_1 = __webpack_require__(766);
  1573. var encoding_js_1 = __webpack_require__(650);
  1574. var ByteBuffer = /** @class */ (function () {
  1575. /**
  1576. * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
  1577. */
  1578. function ByteBuffer(bytes_) {
  1579. this.bytes_ = bytes_;
  1580. this.position_ = 0;
  1581. }
  1582. /**
  1583. * Create and allocate a new ByteBuffer with a given size.
  1584. */
  1585. ByteBuffer.allocate = function (byte_size) {
  1586. return new ByteBuffer(new Uint8Array(byte_size));
  1587. };
  1588. ByteBuffer.prototype.clear = function () {
  1589. this.position_ = 0;
  1590. };
  1591. /**
  1592. * Get the underlying `Uint8Array`.
  1593. */
  1594. ByteBuffer.prototype.bytes = function () {
  1595. return this.bytes_;
  1596. };
  1597. /**
  1598. * Get the buffer's position.
  1599. */
  1600. ByteBuffer.prototype.position = function () {
  1601. return this.position_;
  1602. };
  1603. /**
  1604. * Set the buffer's position.
  1605. */
  1606. ByteBuffer.prototype.setPosition = function (position) {
  1607. this.position_ = position;
  1608. };
  1609. /**
  1610. * Get the buffer's capacity.
  1611. */
  1612. ByteBuffer.prototype.capacity = function () {
  1613. return this.bytes_.length;
  1614. };
  1615. ByteBuffer.prototype.readInt8 = function (offset) {
  1616. return this.readUint8(offset) << 24 >> 24;
  1617. };
  1618. ByteBuffer.prototype.readUint8 = function (offset) {
  1619. return this.bytes_[offset];
  1620. };
  1621. ByteBuffer.prototype.readInt16 = function (offset) {
  1622. return this.readUint16(offset) << 16 >> 16;
  1623. };
  1624. ByteBuffer.prototype.readUint16 = function (offset) {
  1625. return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
  1626. };
  1627. ByteBuffer.prototype.readInt32 = function (offset) {
  1628. return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
  1629. };
  1630. ByteBuffer.prototype.readUint32 = function (offset) {
  1631. return this.readInt32(offset) >>> 0;
  1632. };
  1633. ByteBuffer.prototype.readInt64 = function (offset) {
  1634. return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1635. };
  1636. ByteBuffer.prototype.readUint64 = function (offset) {
  1637. return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1638. };
  1639. ByteBuffer.prototype.readFloat32 = function (offset) {
  1640. utils_js_1.int32[0] = this.readInt32(offset);
  1641. return utils_js_1.float32[0];
  1642. };
  1643. ByteBuffer.prototype.readFloat64 = function (offset) {
  1644. utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1] = this.readInt32(offset);
  1645. utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
  1646. return utils_js_1.float64[0];
  1647. };
  1648. ByteBuffer.prototype.writeInt8 = function (offset, value) {
  1649. this.bytes_[offset] = value;
  1650. };
  1651. ByteBuffer.prototype.writeUint8 = function (offset, value) {
  1652. this.bytes_[offset] = value;
  1653. };
  1654. ByteBuffer.prototype.writeInt16 = function (offset, value) {
  1655. this.bytes_[offset] = value;
  1656. this.bytes_[offset + 1] = value >> 8;
  1657. };
  1658. ByteBuffer.prototype.writeUint16 = function (offset, value) {
  1659. this.bytes_[offset] = value;
  1660. this.bytes_[offset + 1] = value >> 8;
  1661. };
  1662. ByteBuffer.prototype.writeInt32 = function (offset, value) {
  1663. this.bytes_[offset] = value;
  1664. this.bytes_[offset + 1] = value >> 8;
  1665. this.bytes_[offset + 2] = value >> 16;
  1666. this.bytes_[offset + 3] = value >> 24;
  1667. };
  1668. ByteBuffer.prototype.writeUint32 = function (offset, value) {
  1669. this.bytes_[offset] = value;
  1670. this.bytes_[offset + 1] = value >> 8;
  1671. this.bytes_[offset + 2] = value >> 16;
  1672. this.bytes_[offset + 3] = value >> 24;
  1673. };
  1674. ByteBuffer.prototype.writeInt64 = function (offset, value) {
  1675. this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
  1676. this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
  1677. };
  1678. ByteBuffer.prototype.writeUint64 = function (offset, value) {
  1679. this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
  1680. this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
  1681. };
  1682. ByteBuffer.prototype.writeFloat32 = function (offset, value) {
  1683. utils_js_1.float32[0] = value;
  1684. this.writeInt32(offset, utils_js_1.int32[0]);
  1685. };
  1686. ByteBuffer.prototype.writeFloat64 = function (offset, value) {
  1687. utils_js_1.float64[0] = value;
  1688. this.writeInt32(offset, utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1]);
  1689. this.writeInt32(offset + 4, utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0]);
  1690. };
  1691. /**
  1692. * Return the file identifier. Behavior is undefined for FlatBuffers whose
  1693. * schema does not include a file_identifier (likely points at padding or the
  1694. * start of a the root vtable).
  1695. */
  1696. ByteBuffer.prototype.getBufferIdentifier = function () {
  1697. if (this.bytes_.length < this.position_ + constants_js_1.SIZEOF_INT +
  1698. constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1699. throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
  1700. }
  1701. var result = "";
  1702. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1703. result += String.fromCharCode(this.readInt8(this.position_ + constants_js_1.SIZEOF_INT + i));
  1704. }
  1705. return result;
  1706. };
  1707. /**
  1708. * Look up a field in the vtable, return an offset into the object, or 0 if the
  1709. * field is not present.
  1710. */
  1711. ByteBuffer.prototype.__offset = function (bb_pos, vtable_offset) {
  1712. var vtable = bb_pos - this.readInt32(bb_pos);
  1713. return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
  1714. };
  1715. /**
  1716. * Initialize any Table-derived type to point to the union at the given offset.
  1717. */
  1718. ByteBuffer.prototype.__union = function (t, offset) {
  1719. t.bb_pos = offset + this.readInt32(offset);
  1720. t.bb = this;
  1721. return t;
  1722. };
  1723. /**
  1724. * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
  1725. * This allocates a new string and converts to wide chars upon each access.
  1726. *
  1727. * To avoid the conversion to UTF-16, pass Encoding.UTF8_BYTES as
  1728. * the "optionalEncoding" argument. This is useful for avoiding conversion to
  1729. * and from UTF-16 when the data will just be packaged back up in another
  1730. * FlatBuffer later on.
  1731. *
  1732. * @param offset
  1733. * @param opt_encoding Defaults to UTF16_STRING
  1734. */
  1735. ByteBuffer.prototype.__string = function (offset, opt_encoding) {
  1736. offset += this.readInt32(offset);
  1737. var length = this.readInt32(offset);
  1738. var result = '';
  1739. var i = 0;
  1740. offset += constants_js_1.SIZEOF_INT;
  1741. if (opt_encoding === encoding_js_1.Encoding.UTF8_BYTES) {
  1742. return this.bytes_.subarray(offset, offset + length);
  1743. }
  1744. while (i < length) {
  1745. var codePoint = void 0;
  1746. // Decode UTF-8
  1747. var a = this.readUint8(offset + i++);
  1748. if (a < 0xC0) {
  1749. codePoint = a;
  1750. }
  1751. else {
  1752. var b = this.readUint8(offset + i++);
  1753. if (a < 0xE0) {
  1754. codePoint =
  1755. ((a & 0x1F) << 6) |
  1756. (b & 0x3F);
  1757. }
  1758. else {
  1759. var c = this.readUint8(offset + i++);
  1760. if (a < 0xF0) {
  1761. codePoint =
  1762. ((a & 0x0F) << 12) |
  1763. ((b & 0x3F) << 6) |
  1764. (c & 0x3F);
  1765. }
  1766. else {
  1767. var d = this.readUint8(offset + i++);
  1768. codePoint =
  1769. ((a & 0x07) << 18) |
  1770. ((b & 0x3F) << 12) |
  1771. ((c & 0x3F) << 6) |
  1772. (d & 0x3F);
  1773. }
  1774. }
  1775. }
  1776. // Encode UTF-16
  1777. if (codePoint < 0x10000) {
  1778. result += String.fromCharCode(codePoint);
  1779. }
  1780. else {
  1781. codePoint -= 0x10000;
  1782. result += String.fromCharCode((codePoint >> 10) + 0xD800, (codePoint & ((1 << 10) - 1)) + 0xDC00);
  1783. }
  1784. }
  1785. return result;
  1786. };
  1787. /**
  1788. * Handle unions that can contain string as its member, if a Table-derived type then initialize it,
  1789. * if a string then return a new one
  1790. *
  1791. * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
  1792. * makes the behaviour of __union_with_string different compared to __union
  1793. */
  1794. ByteBuffer.prototype.__union_with_string = function (o, offset) {
  1795. if (typeof o === 'string') {
  1796. return this.__string(offset);
  1797. }
  1798. return this.__union(o, offset);
  1799. };
  1800. /**
  1801. * Retrieve the relative offset stored at "offset"
  1802. */
  1803. ByteBuffer.prototype.__indirect = function (offset) {
  1804. return offset + this.readInt32(offset);
  1805. };
  1806. /**
  1807. * Get the start of data of a vector whose offset is stored at "offset" in this object.
  1808. */
  1809. ByteBuffer.prototype.__vector = function (offset) {
  1810. return offset + this.readInt32(offset) + constants_js_1.SIZEOF_INT; // data starts after the length
  1811. };
  1812. /**
  1813. * Get the length of a vector whose offset is stored at "offset" in this object.
  1814. */
  1815. ByteBuffer.prototype.__vector_len = function (offset) {
  1816. return this.readInt32(offset + this.readInt32(offset));
  1817. };
  1818. ByteBuffer.prototype.__has_identifier = function (ident) {
  1819. if (ident.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1820. throw new Error('FlatBuffers: file identifier must be length ' +
  1821. constants_js_1.FILE_IDENTIFIER_LENGTH);
  1822. }
  1823. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1824. if (ident.charCodeAt(i) != this.readInt8(this.position() + constants_js_1.SIZEOF_INT + i)) {
  1825. return false;
  1826. }
  1827. }
  1828. return true;
  1829. };
  1830. /**
  1831. * A helper function for generating list for obj api
  1832. */
  1833. ByteBuffer.prototype.createScalarList = function (listAccessor, listLength) {
  1834. var ret = [];
  1835. for (var i = 0; i < listLength; ++i) {
  1836. if (listAccessor(i) !== null) {
  1837. ret.push(listAccessor(i));
  1838. }
  1839. }
  1840. return ret;
  1841. };
  1842. /**
  1843. * A helper function for generating list for obj api
  1844. * @param listAccessor function that accepts an index and return data at that index
  1845. * @param listLength listLength
  1846. * @param res result list
  1847. */
  1848. ByteBuffer.prototype.createObjList = function (listAccessor, listLength) {
  1849. var ret = [];
  1850. for (var i = 0; i < listLength; ++i) {
  1851. var val = listAccessor(i);
  1852. if (val !== null) {
  1853. ret.push(val.unpack());
  1854. }
  1855. }
  1856. return ret;
  1857. };
  1858. return ByteBuffer;
  1859. }());
  1860. exports.ByteBuffer = ByteBuffer;
  1861. /***/ }),
  1862. /***/ 147:
  1863. /***/ ((__unused_webpack_module, exports) => {
  1864. "use strict";
  1865. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1866. exports.SIZE_PREFIX_LENGTH = exports.FILE_IDENTIFIER_LENGTH = exports.SIZEOF_INT = exports.SIZEOF_SHORT = void 0;
  1867. exports.SIZEOF_SHORT = 2;
  1868. exports.SIZEOF_INT = 4;
  1869. exports.FILE_IDENTIFIER_LENGTH = 4;
  1870. exports.SIZE_PREFIX_LENGTH = 4;
  1871. /***/ }),
  1872. /***/ 650:
  1873. /***/ ((__unused_webpack_module, exports) => {
  1874. "use strict";
  1875. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1876. exports.Encoding = void 0;
  1877. var Encoding;
  1878. (function (Encoding) {
  1879. Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
  1880. Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
  1881. })(Encoding = exports.Encoding || (exports.Encoding = {}));
  1882. /***/ }),
  1883. /***/ 903:
  1884. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1885. "use strict";
  1886. var __webpack_unused_export__;
  1887. __webpack_unused_export__ = ({ value: true });
  1888. exports.cZ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.XU = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
  1889. var constants_js_1 = __webpack_require__(147);
  1890. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_1.SIZEOF_SHORT; } });
  1891. var constants_js_2 = __webpack_require__(147);
  1892. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_2.SIZEOF_INT; } });
  1893. var constants_js_3 = __webpack_require__(147);
  1894. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_3.FILE_IDENTIFIER_LENGTH; } });
  1895. var constants_js_4 = __webpack_require__(147);
  1896. Object.defineProperty(exports, "XU", ({ enumerable: true, get: function () { return constants_js_4.SIZE_PREFIX_LENGTH; } }));
  1897. var utils_js_1 = __webpack_require__(766);
  1898. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.int32; } });
  1899. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float32; } });
  1900. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float64; } });
  1901. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.isLittleEndian; } });
  1902. var encoding_js_1 = __webpack_require__(650);
  1903. __webpack_unused_export__ = ({ enumerable: true, get: function () { return encoding_js_1.Encoding; } });
  1904. var builder_js_1 = __webpack_require__(962);
  1905. __webpack_unused_export__ = ({ enumerable: true, get: function () { return builder_js_1.Builder; } });
  1906. var byte_buffer_js_1 = __webpack_require__(505);
  1907. Object.defineProperty(exports, "cZ", ({ enumerable: true, get: function () { return byte_buffer_js_1.ByteBuffer; } }));
  1908. /***/ }),
  1909. /***/ 766:
  1910. /***/ ((__unused_webpack_module, exports) => {
  1911. "use strict";
  1912. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1913. exports.isLittleEndian = exports.float64 = exports.float32 = exports.int32 = void 0;
  1914. exports.int32 = new Int32Array(2);
  1915. exports.float32 = new Float32Array(exports.int32.buffer);
  1916. exports.float64 = new Float64Array(exports.int32.buffer);
  1917. exports.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
  1918. /***/ }),
  1919. /***/ 645:
  1920. /***/ ((__unused_webpack_module, exports) => {
  1921. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  1922. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  1923. var e, m
  1924. var eLen = (nBytes * 8) - mLen - 1
  1925. var eMax = (1 << eLen) - 1
  1926. var eBias = eMax >> 1
  1927. var nBits = -7
  1928. var i = isLE ? (nBytes - 1) : 0
  1929. var d = isLE ? -1 : 1
  1930. var s = buffer[offset + i]
  1931. i += d
  1932. e = s & ((1 << (-nBits)) - 1)
  1933. s >>= (-nBits)
  1934. nBits += eLen
  1935. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1936. m = e & ((1 << (-nBits)) - 1)
  1937. e >>= (-nBits)
  1938. nBits += mLen
  1939. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1940. if (e === 0) {
  1941. e = 1 - eBias
  1942. } else if (e === eMax) {
  1943. return m ? NaN : ((s ? -1 : 1) * Infinity)
  1944. } else {
  1945. m = m + Math.pow(2, mLen)
  1946. e = e - eBias
  1947. }
  1948. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  1949. }
  1950. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  1951. var e, m, c
  1952. var eLen = (nBytes * 8) - mLen - 1
  1953. var eMax = (1 << eLen) - 1
  1954. var eBias = eMax >> 1
  1955. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  1956. var i = isLE ? 0 : (nBytes - 1)
  1957. var d = isLE ? 1 : -1
  1958. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  1959. value = Math.abs(value)
  1960. if (isNaN(value) || value === Infinity) {
  1961. m = isNaN(value) ? 1 : 0
  1962. e = eMax
  1963. } else {
  1964. e = Math.floor(Math.log(value) / Math.LN2)
  1965. if (value * (c = Math.pow(2, -e)) < 1) {
  1966. e--
  1967. c *= 2
  1968. }
  1969. if (e + eBias >= 1) {
  1970. value += rt / c
  1971. } else {
  1972. value += rt * Math.pow(2, 1 - eBias)
  1973. }
  1974. if (value * c >= 2) {
  1975. e++
  1976. c /= 2
  1977. }
  1978. if (e + eBias >= eMax) {
  1979. m = 0
  1980. e = eMax
  1981. } else if (e + eBias >= 1) {
  1982. m = ((value * c) - 1) * Math.pow(2, mLen)
  1983. e = e + eBias
  1984. } else {
  1985. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  1986. e = 0
  1987. }
  1988. }
  1989. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  1990. e = (e << mLen) | m
  1991. eLen += mLen
  1992. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  1993. buffer[offset + i - d] |= s * 128
  1994. }
  1995. /***/ }),
  1996. /***/ 186:
  1997. /***/ ((module) => {
  1998. var containers = []; // will store container HTMLElement references
  1999. var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
  2000. var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
  2001. function insertCss(css, options) {
  2002. options = options || {};
  2003. if (css === undefined) {
  2004. throw new Error(usage);
  2005. }
  2006. var position = options.prepend === true ? 'prepend' : 'append';
  2007. var container = options.container !== undefined ? options.container : document.querySelector('head');
  2008. var containerId = containers.indexOf(container);
  2009. // first time we see this container, create the necessary entries
  2010. if (containerId === -1) {
  2011. containerId = containers.push(container) - 1;
  2012. styleElements[containerId] = {};
  2013. }
  2014. // try to get the correponding container + position styleElement, create it otherwise
  2015. var styleElement;
  2016. if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
  2017. styleElement = styleElements[containerId][position];
  2018. } else {
  2019. styleElement = styleElements[containerId][position] = createStyleElement();
  2020. if (position === 'prepend') {
  2021. container.insertBefore(styleElement, container.childNodes[0]);
  2022. } else {
  2023. container.appendChild(styleElement);
  2024. }
  2025. }
  2026. // strip potential UTF-8 BOM if css was read from a file
  2027. if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
  2028. // actually add the stylesheet
  2029. if (styleElement.styleSheet) {
  2030. styleElement.styleSheet.cssText += css
  2031. } else {
  2032. styleElement.textContent += css;
  2033. }
  2034. return styleElement;
  2035. };
  2036. function createStyleElement() {
  2037. var styleElement = document.createElement('style');
  2038. styleElement.setAttribute('type', 'text/css');
  2039. return styleElement;
  2040. }
  2041. module.exports = insertCss;
  2042. module.exports.insertCss = insertCss;
  2043. /***/ }),
  2044. /***/ 545:
  2045. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2046. var utils = __webpack_require__(820)
  2047. var AND = '&&'
  2048. , OR = '||'
  2049. , AND_STR = 'and'
  2050. , OR_STR = 'or'
  2051. , NOT = '!'
  2052. , EQUAL = '='
  2053. , LIKE = '~'
  2054. , NOTEQUAL = NOT + EQUAL
  2055. , NOTLIKE = NOT + LIKE
  2056. , GT = '>'
  2057. , GE = '>='
  2058. , LT = '<'
  2059. , LE = '<='
  2060. , WILDCARD = '*'
  2061. , COMMA = ','
  2062. , DELIMITER = '.'
  2063. , LEFT = '('
  2064. , RIGHT = ')'
  2065. , WHERE = 'where'
  2066. , synopsis = {
  2067. pathway: [],
  2068. groups: {}
  2069. }
  2070. , AST = {}
  2071. , options = {};
  2072. var print = console.log;
  2073. // ------------------ splitter -------------------- //
  2074. function Tokenize(query) {
  2075. var parts = __splitTrim(query, WHERE);
  2076. var pathway = parts[0];
  2077. var where = parts[1];
  2078. synopsis.pathway = __splitTrim(pathway, COMMA);
  2079. for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
  2080. synopsis.pathway[i] = __splitTrim(synopsis.pathway[i], DELIMITER);
  2081. if (synopsis.pathway[i][0] == WILDCARD)
  2082. synopsis.pathway[i].shift();
  2083. if (synopsis.pathway[i].length === 0)
  2084. synopsis.pathway.splice(i, 1);
  2085. }
  2086. var lastLeft = -1,
  2087. lastRight = -1,
  2088. current = 0;
  2089. while (current < where.length) {
  2090. if (where[current] === LEFT) {
  2091. lastLeft = current;
  2092. } else if (where[current] === RIGHT) {
  2093. lastRight = current;
  2094. if (lastRight > lastLeft && lastLeft !== -1) {
  2095. var k = 'gr' + '_' + new Date().getTime();
  2096. synopsis.groups[k] = where.substring(lastLeft + 1, lastRight);
  2097. where = where.replace(LEFT + synopsis.groups[k] + RIGHT, k);
  2098. current = -1;
  2099. }
  2100. }
  2101. current += 1;
  2102. }
  2103. LogicalGrouping(AST, where);
  2104. }
  2105. function LogicalGrouping(current, where) {
  2106. var lastAnd = __findIndex(where, AND),
  2107. lastOr = __findIndex(where, OR);
  2108. if (lastAnd !== Number.MAX_VALUE || lastOr !== Number.MAX_VALUE) {
  2109. if (lastAnd < lastOr) {
  2110. current.and = current.and || [];
  2111. var parts = __splitTrim(where, AND);
  2112. current.and.push(parts[0]);
  2113. LogicalGrouping(current.and, parts[1]);
  2114. } else {
  2115. current.or = current.or || [];
  2116. var parts = __splitTrim(where, OR);
  2117. current.or.push(parts[0]);
  2118. LogicalGrouping(current.or, parts[1]);
  2119. }
  2120. } else {
  2121. if (synopsis.groups[where]) {
  2122. where = synopsis.groups[where];
  2123. LogicalGrouping(current, where);
  2124. } else {
  2125. if (Array.isArray(current))
  2126. current.push(where);
  2127. else
  2128. current.or = [where];
  2129. ExtractExpression(AST.or ? AST.or : AST.and)
  2130. }
  2131. }
  2132. }
  2133. function ExtractExpression(logicalGroup) {
  2134. for (var k in logicalGroup) {
  2135. if (logicalGroup.hasOwnProperty(k)) {
  2136. if (Array.isArray(logicalGroup[k])) {
  2137. ExtractExpression(logicalGroup[k]);
  2138. }
  2139. else if (typeof logicalGroup[k] === 'string') {
  2140. if (__contains(logicalGroup[k], NOTEQUAL)) {
  2141. var parts = __splitTrim(logicalGroup[k], NOTEQUAL);
  2142. logicalGroup[k] = {
  2143. ne: [
  2144. parts[0],
  2145. parts[1]
  2146. ]
  2147. };
  2148. } else if (__contains(logicalGroup[k], NOTLIKE)) {
  2149. var parts = __splitTrim(logicalGroup[k], NOTLIKE);
  2150. logicalGroup[k] = {
  2151. nreq: [
  2152. parts[0],
  2153. parts[1]
  2154. ]
  2155. };
  2156. } else if (__contains(logicalGroup[k], LIKE)) {
  2157. var parts = __splitTrim(logicalGroup[k], LIKE);
  2158. logicalGroup[k] = { // rough eq
  2159. req: [
  2160. parts[0],
  2161. parts[1]
  2162. ]
  2163. };
  2164. } else if (__contains(logicalGroup[k], GE)) {
  2165. var parts = __splitTrim(logicalGroup[k], GE);
  2166. logicalGroup[k] = { // greater than or equal
  2167. ge: [
  2168. parts[0],
  2169. parts[1]
  2170. ]
  2171. };
  2172. } else if (__contains(logicalGroup[k], GT)) {
  2173. var parts = __splitTrim(logicalGroup[k], GT);
  2174. logicalGroup[k] = { // greater than
  2175. gt: [
  2176. parts[0],
  2177. parts[1]
  2178. ]
  2179. };
  2180. } else if (__contains(logicalGroup[k], LE)) {
  2181. var parts = __splitTrim(logicalGroup[k], LE);
  2182. logicalGroup[k] = { // less than or equal
  2183. le: [
  2184. parts[0],
  2185. parts[1]
  2186. ]
  2187. };
  2188. } else if (__contains(logicalGroup[k], LT)) {
  2189. var parts = __splitTrim(logicalGroup[k], LT);
  2190. logicalGroup[k] = { // less than
  2191. lt: [
  2192. parts[0],
  2193. parts[1]
  2194. ]
  2195. };
  2196. } else if (__contains(logicalGroup[k], EQUAL)) {
  2197. var parts = __splitTrim(logicalGroup[k], EQUAL);
  2198. logicalGroup[k] = {
  2199. eq: [
  2200. parts[0],
  2201. parts[1]
  2202. ]
  2203. };
  2204. }
  2205. }
  2206. }
  2207. }
  2208. }
  2209. function __findIndex(str, token) {
  2210. var index = str.indexOf(token);
  2211. return index === -1 ? Number.MAX_VALUE : index;
  2212. }
  2213. function __splitTrim(str, token) {
  2214. return str.split(token).map(function (p) {
  2215. return p.trim();
  2216. });
  2217. }
  2218. function __contains(a, b) {
  2219. return a.indexOf(b) > -1;
  2220. }
  2221. function __hierarchize(obj, dottedPath) {
  2222. var parts = __splitTrim(dottedPath, DELIMITER);
  2223. var res = obj;
  2224. for (var p in parts) {
  2225. if (res.hasOwnProperty(parts[p]))
  2226. res = res[parts[p]];
  2227. else
  2228. return '';
  2229. }
  2230. // support comparison for Date/DateString
  2231. if(utils.isDate(res)) res = res.valueOf()
  2232. else if(utils.isDateString(res)) res = utils.parseDateFromString(res)
  2233. else res = res.toString()
  2234. return res
  2235. }
  2236. function FilterOR(ASTNode, row) {
  2237. var res = false;
  2238. for (var k in ASTNode) {
  2239. var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
  2240. res = res || filterFunc(ASTNode[k], row);
  2241. if (options.trace)
  2242. print(synopsis.step, '======((( or', ASTNode[k], res);
  2243. if (res) return res;
  2244. }
  2245. return res;
  2246. }
  2247. function FilterAND(ASTNode, row) {
  2248. var res = true;
  2249. for (var k in ASTNode) {
  2250. var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
  2251. res = res && filterFunc(ASTNode[k], row);
  2252. if (options.trace)
  2253. print(synopsis.step, '======((( and', ASTNode[k], res);
  2254. if (!res) return res;
  2255. }
  2256. return res;
  2257. }
  2258. function Filter(ASTNode, row) {
  2259. synopsis.step += 1;
  2260. if (ASTNode.or) {
  2261. var res = FilterOR(ASTNode.or, row);
  2262. if (options.trace)
  2263. print(synopsis.step, 'OR', ASTNode, res);
  2264. return res;
  2265. } else if (ASTNode.and) {
  2266. var res = FilterAND(ASTNode.and, row);
  2267. if (options.trace)
  2268. print(synopsis.step, 'AND', ASTNode, res);
  2269. return res;
  2270. } else if (typeof ASTNode === 'object') {
  2271. if (ASTNode.eq) { // =
  2272. return __hierarchize(row, ASTNode.eq[0]) === ASTNode.eq[1];
  2273. } else if (ASTNode.ne) { // !=
  2274. return __hierarchize(row, ASTNode.ne[0]) !== ASTNode.ne[1];
  2275. } else if (ASTNode.req) { // ~
  2276. return __contains(__hierarchize(row, ASTNode.req[0]), ASTNode.req[1]);
  2277. } else if (ASTNode.nreq) { // ~
  2278. return !__contains(__hierarchize(row, ASTNode.nreq[0]), ASTNode.nreq[1]);
  2279. } else if (ASTNode.gt) { // >
  2280. return __hierarchize(row, ASTNode.gt[0]) > ASTNode.gt[1];
  2281. } else if (ASTNode.ge) { // >=
  2282. return __hierarchize(row, ASTNode.ge[0]) >= ASTNode.ge[1];
  2283. } else if (ASTNode.lt) { // <
  2284. return __hierarchize(row, ASTNode.lt[0]) < ASTNode.lt[1];
  2285. } else if (ASTNode.le) { // <=
  2286. return __hierarchize(row, ASTNode.le[0]) <= ASTNode.le[1];
  2287. } else {
  2288. return Filter(ASTNode, row);
  2289. }
  2290. }
  2291. }
  2292. function Parse(dataSource) {
  2293. var result = [];
  2294. for (var k in dataSource)
  2295. if (Filter(AST, dataSource[k]))
  2296. result.push(dataSource[k]);
  2297. return result;
  2298. }
  2299. function Fields(result) {
  2300. if (result && synopsis.pathway.length > 0) {
  2301. //print(synopsis.pathway);
  2302. return result.map(function (ele) {
  2303. var res = {};
  2304. for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
  2305. var key = synopsis.pathway[i].join(DELIMITER);
  2306. res[key] = __hierarchize(ele, key);
  2307. }
  2308. return res;
  2309. });
  2310. }
  2311. return result;
  2312. }
  2313. function Query(dataSource, query, opts) {
  2314. synopsis = {
  2315. pathway: [],
  2316. groups: {},
  2317. step: 0
  2318. };
  2319. AST = {};
  2320. opts = opts || {
  2321. trace: false
  2322. };
  2323. options = opts;
  2324. Tokenize(query);
  2325. return Fields(Parse(dataSource));
  2326. }
  2327. if ( true && typeof(module.exports) != 'undefined') module.exports = Query;
  2328. if (typeof(window) != 'undefined') window.Query = Query;
  2329. /***/ }),
  2330. /***/ 820:
  2331. /***/ ((module) => {
  2332. function getObjectType(obj) {
  2333. return Object.prototype.toString.call(obj);
  2334. }
  2335. function isDate(obj) {
  2336. return getObjectType(obj) === '[object Date]';
  2337. }
  2338. function isString(obj) {
  2339. return getObjectType(obj) === '[object String]';
  2340. }
  2341. function isDateString(obj) {
  2342. return isString(obj) && !isNaN(Date.parse(obj))
  2343. }
  2344. function isNumber(obj) {
  2345. return typeof obj === 'number'
  2346. }
  2347. function parseDateFromString(str) {
  2348. return Date.parse(str)
  2349. }
  2350. module.exports = {
  2351. getObjectType: getObjectType,
  2352. isDate: isDate,
  2353. isString: isString,
  2354. isDateString: isDateString,
  2355. parseDateFromString: parseDateFromString,
  2356. isNumber: isNumber
  2357. }
  2358. /***/ }),
  2359. /***/ 465:
  2360. /***/ ((module, exports, __webpack_require__) => {
  2361. /* module decorator */ module = __webpack_require__.nmd(module);
  2362. /**
  2363. * lodash (Custom Build) <https://lodash.com/>
  2364. * Build: `lodash modularize exports="npm" -o ./`
  2365. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  2366. * Released under MIT license <https://lodash.com/license>
  2367. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  2368. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  2369. */
  2370. /** Used as the size to enable large array optimizations. */
  2371. var LARGE_ARRAY_SIZE = 200;
  2372. /** Used to stand-in for `undefined` hash values. */
  2373. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  2374. /** Used as references for various `Number` constants. */
  2375. var MAX_SAFE_INTEGER = 9007199254740991;
  2376. /** `Object#toString` result references. */
  2377. var argsTag = '[object Arguments]',
  2378. arrayTag = '[object Array]',
  2379. boolTag = '[object Boolean]',
  2380. dateTag = '[object Date]',
  2381. errorTag = '[object Error]',
  2382. funcTag = '[object Function]',
  2383. genTag = '[object GeneratorFunction]',
  2384. mapTag = '[object Map]',
  2385. numberTag = '[object Number]',
  2386. objectTag = '[object Object]',
  2387. promiseTag = '[object Promise]',
  2388. regexpTag = '[object RegExp]',
  2389. setTag = '[object Set]',
  2390. stringTag = '[object String]',
  2391. symbolTag = '[object Symbol]',
  2392. weakMapTag = '[object WeakMap]';
  2393. var arrayBufferTag = '[object ArrayBuffer]',
  2394. dataViewTag = '[object DataView]',
  2395. float32Tag = '[object Float32Array]',
  2396. float64Tag = '[object Float64Array]',
  2397. int8Tag = '[object Int8Array]',
  2398. int16Tag = '[object Int16Array]',
  2399. int32Tag = '[object Int32Array]',
  2400. uint8Tag = '[object Uint8Array]',
  2401. uint8ClampedTag = '[object Uint8ClampedArray]',
  2402. uint16Tag = '[object Uint16Array]',
  2403. uint32Tag = '[object Uint32Array]';
  2404. /**
  2405. * Used to match `RegExp`
  2406. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  2407. */
  2408. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  2409. /** Used to match `RegExp` flags from their coerced string values. */
  2410. var reFlags = /\w*$/;
  2411. /** Used to detect host constructors (Safari). */
  2412. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  2413. /** Used to detect unsigned integer values. */
  2414. var reIsUint = /^(?:0|[1-9]\d*)$/;
  2415. /** Used to identify `toStringTag` values supported by `_.clone`. */
  2416. var cloneableTags = {};
  2417. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  2418. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  2419. cloneableTags[boolTag] = cloneableTags[dateTag] =
  2420. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  2421. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  2422. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  2423. cloneableTags[numberTag] = cloneableTags[objectTag] =
  2424. cloneableTags[regexpTag] = cloneableTags[setTag] =
  2425. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  2426. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  2427. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  2428. cloneableTags[errorTag] = cloneableTags[funcTag] =
  2429. cloneableTags[weakMapTag] = false;
  2430. /** Detect free variable `global` from Node.js. */
  2431. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  2432. /** Detect free variable `self`. */
  2433. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2434. /** Used as a reference to the global object. */
  2435. var root = freeGlobal || freeSelf || Function('return this')();
  2436. /** Detect free variable `exports`. */
  2437. var freeExports = true && exports && !exports.nodeType && exports;
  2438. /** Detect free variable `module`. */
  2439. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  2440. /** Detect the popular CommonJS extension `module.exports`. */
  2441. var moduleExports = freeModule && freeModule.exports === freeExports;
  2442. /**
  2443. * Adds the key-value `pair` to `map`.
  2444. *
  2445. * @private
  2446. * @param {Object} map The map to modify.
  2447. * @param {Array} pair The key-value pair to add.
  2448. * @returns {Object} Returns `map`.
  2449. */
  2450. function addMapEntry(map, pair) {
  2451. // Don't return `map.set` because it's not chainable in IE 11.
  2452. map.set(pair[0], pair[1]);
  2453. return map;
  2454. }
  2455. /**
  2456. * Adds `value` to `set`.
  2457. *
  2458. * @private
  2459. * @param {Object} set The set to modify.
  2460. * @param {*} value The value to add.
  2461. * @returns {Object} Returns `set`.
  2462. */
  2463. function addSetEntry(set, value) {
  2464. // Don't return `set.add` because it's not chainable in IE 11.
  2465. set.add(value);
  2466. return set;
  2467. }
  2468. /**
  2469. * A specialized version of `_.forEach` for arrays without support for
  2470. * iteratee shorthands.
  2471. *
  2472. * @private
  2473. * @param {Array} [array] The array to iterate over.
  2474. * @param {Function} iteratee The function invoked per iteration.
  2475. * @returns {Array} Returns `array`.
  2476. */
  2477. function arrayEach(array, iteratee) {
  2478. var index = -1,
  2479. length = array ? array.length : 0;
  2480. while (++index < length) {
  2481. if (iteratee(array[index], index, array) === false) {
  2482. break;
  2483. }
  2484. }
  2485. return array;
  2486. }
  2487. /**
  2488. * Appends the elements of `values` to `array`.
  2489. *
  2490. * @private
  2491. * @param {Array} array The array to modify.
  2492. * @param {Array} values The values to append.
  2493. * @returns {Array} Returns `array`.
  2494. */
  2495. function arrayPush(array, values) {
  2496. var index = -1,
  2497. length = values.length,
  2498. offset = array.length;
  2499. while (++index < length) {
  2500. array[offset + index] = values[index];
  2501. }
  2502. return array;
  2503. }
  2504. /**
  2505. * A specialized version of `_.reduce` for arrays without support for
  2506. * iteratee shorthands.
  2507. *
  2508. * @private
  2509. * @param {Array} [array] The array to iterate over.
  2510. * @param {Function} iteratee The function invoked per iteration.
  2511. * @param {*} [accumulator] The initial value.
  2512. * @param {boolean} [initAccum] Specify using the first element of `array` as
  2513. * the initial value.
  2514. * @returns {*} Returns the accumulated value.
  2515. */
  2516. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2517. var index = -1,
  2518. length = array ? array.length : 0;
  2519. if (initAccum && length) {
  2520. accumulator = array[++index];
  2521. }
  2522. while (++index < length) {
  2523. accumulator = iteratee(accumulator, array[index], index, array);
  2524. }
  2525. return accumulator;
  2526. }
  2527. /**
  2528. * The base implementation of `_.times` without support for iteratee shorthands
  2529. * or max array length checks.
  2530. *
  2531. * @private
  2532. * @param {number} n The number of times to invoke `iteratee`.
  2533. * @param {Function} iteratee The function invoked per iteration.
  2534. * @returns {Array} Returns the array of results.
  2535. */
  2536. function baseTimes(n, iteratee) {
  2537. var index = -1,
  2538. result = Array(n);
  2539. while (++index < n) {
  2540. result[index] = iteratee(index);
  2541. }
  2542. return result;
  2543. }
  2544. /**
  2545. * Gets the value at `key` of `object`.
  2546. *
  2547. * @private
  2548. * @param {Object} [object] The object to query.
  2549. * @param {string} key The key of the property to get.
  2550. * @returns {*} Returns the property value.
  2551. */
  2552. function getValue(object, key) {
  2553. return object == null ? undefined : object[key];
  2554. }
  2555. /**
  2556. * Checks if `value` is a host object in IE < 9.
  2557. *
  2558. * @private
  2559. * @param {*} value The value to check.
  2560. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  2561. */
  2562. function isHostObject(value) {
  2563. // Many host objects are `Object` objects that can coerce to strings
  2564. // despite having improperly defined `toString` methods.
  2565. var result = false;
  2566. if (value != null && typeof value.toString != 'function') {
  2567. try {
  2568. result = !!(value + '');
  2569. } catch (e) {}
  2570. }
  2571. return result;
  2572. }
  2573. /**
  2574. * Converts `map` to its key-value pairs.
  2575. *
  2576. * @private
  2577. * @param {Object} map The map to convert.
  2578. * @returns {Array} Returns the key-value pairs.
  2579. */
  2580. function mapToArray(map) {
  2581. var index = -1,
  2582. result = Array(map.size);
  2583. map.forEach(function(value, key) {
  2584. result[++index] = [key, value];
  2585. });
  2586. return result;
  2587. }
  2588. /**
  2589. * Creates a unary function that invokes `func` with its argument transformed.
  2590. *
  2591. * @private
  2592. * @param {Function} func The function to wrap.
  2593. * @param {Function} transform The argument transform.
  2594. * @returns {Function} Returns the new function.
  2595. */
  2596. function overArg(func, transform) {
  2597. return function(arg) {
  2598. return func(transform(arg));
  2599. };
  2600. }
  2601. /**
  2602. * Converts `set` to an array of its values.
  2603. *
  2604. * @private
  2605. * @param {Object} set The set to convert.
  2606. * @returns {Array} Returns the values.
  2607. */
  2608. function setToArray(set) {
  2609. var index = -1,
  2610. result = Array(set.size);
  2611. set.forEach(function(value) {
  2612. result[++index] = value;
  2613. });
  2614. return result;
  2615. }
  2616. /** Used for built-in method references. */
  2617. var arrayProto = Array.prototype,
  2618. funcProto = Function.prototype,
  2619. objectProto = Object.prototype;
  2620. /** Used to detect overreaching core-js shims. */
  2621. var coreJsData = root['__core-js_shared__'];
  2622. /** Used to detect methods masquerading as native. */
  2623. var maskSrcKey = (function() {
  2624. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2625. return uid ? ('Symbol(src)_1.' + uid) : '';
  2626. }());
  2627. /** Used to resolve the decompiled source of functions. */
  2628. var funcToString = funcProto.toString;
  2629. /** Used to check objects for own properties. */
  2630. var hasOwnProperty = objectProto.hasOwnProperty;
  2631. /**
  2632. * Used to resolve the
  2633. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2634. * of values.
  2635. */
  2636. var objectToString = objectProto.toString;
  2637. /** Used to detect if a method is native. */
  2638. var reIsNative = RegExp('^' +
  2639. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2640. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2641. );
  2642. /** Built-in value references. */
  2643. var Buffer = moduleExports ? root.Buffer : undefined,
  2644. Symbol = root.Symbol,
  2645. Uint8Array = root.Uint8Array,
  2646. getPrototype = overArg(Object.getPrototypeOf, Object),
  2647. objectCreate = Object.create,
  2648. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2649. splice = arrayProto.splice;
  2650. /* Built-in method references for those with the same name as other `lodash` methods. */
  2651. var nativeGetSymbols = Object.getOwnPropertySymbols,
  2652. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2653. nativeKeys = overArg(Object.keys, Object);
  2654. /* Built-in method references that are verified to be native. */
  2655. var DataView = getNative(root, 'DataView'),
  2656. Map = getNative(root, 'Map'),
  2657. Promise = getNative(root, 'Promise'),
  2658. Set = getNative(root, 'Set'),
  2659. WeakMap = getNative(root, 'WeakMap'),
  2660. nativeCreate = getNative(Object, 'create');
  2661. /** Used to detect maps, sets, and weakmaps. */
  2662. var dataViewCtorString = toSource(DataView),
  2663. mapCtorString = toSource(Map),
  2664. promiseCtorString = toSource(Promise),
  2665. setCtorString = toSource(Set),
  2666. weakMapCtorString = toSource(WeakMap);
  2667. /** Used to convert symbols to primitives and strings. */
  2668. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2669. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  2670. /**
  2671. * Creates a hash object.
  2672. *
  2673. * @private
  2674. * @constructor
  2675. * @param {Array} [entries] The key-value pairs to cache.
  2676. */
  2677. function Hash(entries) {
  2678. var index = -1,
  2679. length = entries ? entries.length : 0;
  2680. this.clear();
  2681. while (++index < length) {
  2682. var entry = entries[index];
  2683. this.set(entry[0], entry[1]);
  2684. }
  2685. }
  2686. /**
  2687. * Removes all key-value entries from the hash.
  2688. *
  2689. * @private
  2690. * @name clear
  2691. * @memberOf Hash
  2692. */
  2693. function hashClear() {
  2694. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2695. }
  2696. /**
  2697. * Removes `key` and its value from the hash.
  2698. *
  2699. * @private
  2700. * @name delete
  2701. * @memberOf Hash
  2702. * @param {Object} hash The hash to modify.
  2703. * @param {string} key The key of the value to remove.
  2704. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2705. */
  2706. function hashDelete(key) {
  2707. return this.has(key) && delete this.__data__[key];
  2708. }
  2709. /**
  2710. * Gets the hash value for `key`.
  2711. *
  2712. * @private
  2713. * @name get
  2714. * @memberOf Hash
  2715. * @param {string} key The key of the value to get.
  2716. * @returns {*} Returns the entry value.
  2717. */
  2718. function hashGet(key) {
  2719. var data = this.__data__;
  2720. if (nativeCreate) {
  2721. var result = data[key];
  2722. return result === HASH_UNDEFINED ? undefined : result;
  2723. }
  2724. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2725. }
  2726. /**
  2727. * Checks if a hash value for `key` exists.
  2728. *
  2729. * @private
  2730. * @name has
  2731. * @memberOf Hash
  2732. * @param {string} key The key of the entry to check.
  2733. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2734. */
  2735. function hashHas(key) {
  2736. var data = this.__data__;
  2737. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  2738. }
  2739. /**
  2740. * Sets the hash `key` to `value`.
  2741. *
  2742. * @private
  2743. * @name set
  2744. * @memberOf Hash
  2745. * @param {string} key The key of the value to set.
  2746. * @param {*} value The value to set.
  2747. * @returns {Object} Returns the hash instance.
  2748. */
  2749. function hashSet(key, value) {
  2750. var data = this.__data__;
  2751. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2752. return this;
  2753. }
  2754. // Add methods to `Hash`.
  2755. Hash.prototype.clear = hashClear;
  2756. Hash.prototype['delete'] = hashDelete;
  2757. Hash.prototype.get = hashGet;
  2758. Hash.prototype.has = hashHas;
  2759. Hash.prototype.set = hashSet;
  2760. /**
  2761. * Creates an list cache object.
  2762. *
  2763. * @private
  2764. * @constructor
  2765. * @param {Array} [entries] The key-value pairs to cache.
  2766. */
  2767. function ListCache(entries) {
  2768. var index = -1,
  2769. length = entries ? entries.length : 0;
  2770. this.clear();
  2771. while (++index < length) {
  2772. var entry = entries[index];
  2773. this.set(entry[0], entry[1]);
  2774. }
  2775. }
  2776. /**
  2777. * Removes all key-value entries from the list cache.
  2778. *
  2779. * @private
  2780. * @name clear
  2781. * @memberOf ListCache
  2782. */
  2783. function listCacheClear() {
  2784. this.__data__ = [];
  2785. }
  2786. /**
  2787. * Removes `key` and its value from the list cache.
  2788. *
  2789. * @private
  2790. * @name delete
  2791. * @memberOf ListCache
  2792. * @param {string} key The key of the value to remove.
  2793. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2794. */
  2795. function listCacheDelete(key) {
  2796. var data = this.__data__,
  2797. index = assocIndexOf(data, key);
  2798. if (index < 0) {
  2799. return false;
  2800. }
  2801. var lastIndex = data.length - 1;
  2802. if (index == lastIndex) {
  2803. data.pop();
  2804. } else {
  2805. splice.call(data, index, 1);
  2806. }
  2807. return true;
  2808. }
  2809. /**
  2810. * Gets the list cache value for `key`.
  2811. *
  2812. * @private
  2813. * @name get
  2814. * @memberOf ListCache
  2815. * @param {string} key The key of the value to get.
  2816. * @returns {*} Returns the entry value.
  2817. */
  2818. function listCacheGet(key) {
  2819. var data = this.__data__,
  2820. index = assocIndexOf(data, key);
  2821. return index < 0 ? undefined : data[index][1];
  2822. }
  2823. /**
  2824. * Checks if a list cache value for `key` exists.
  2825. *
  2826. * @private
  2827. * @name has
  2828. * @memberOf ListCache
  2829. * @param {string} key The key of the entry to check.
  2830. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2831. */
  2832. function listCacheHas(key) {
  2833. return assocIndexOf(this.__data__, key) > -1;
  2834. }
  2835. /**
  2836. * Sets the list cache `key` to `value`.
  2837. *
  2838. * @private
  2839. * @name set
  2840. * @memberOf ListCache
  2841. * @param {string} key The key of the value to set.
  2842. * @param {*} value The value to set.
  2843. * @returns {Object} Returns the list cache instance.
  2844. */
  2845. function listCacheSet(key, value) {
  2846. var data = this.__data__,
  2847. index = assocIndexOf(data, key);
  2848. if (index < 0) {
  2849. data.push([key, value]);
  2850. } else {
  2851. data[index][1] = value;
  2852. }
  2853. return this;
  2854. }
  2855. // Add methods to `ListCache`.
  2856. ListCache.prototype.clear = listCacheClear;
  2857. ListCache.prototype['delete'] = listCacheDelete;
  2858. ListCache.prototype.get = listCacheGet;
  2859. ListCache.prototype.has = listCacheHas;
  2860. ListCache.prototype.set = listCacheSet;
  2861. /**
  2862. * Creates a map cache object to store key-value pairs.
  2863. *
  2864. * @private
  2865. * @constructor
  2866. * @param {Array} [entries] The key-value pairs to cache.
  2867. */
  2868. function MapCache(entries) {
  2869. var index = -1,
  2870. length = entries ? entries.length : 0;
  2871. this.clear();
  2872. while (++index < length) {
  2873. var entry = entries[index];
  2874. this.set(entry[0], entry[1]);
  2875. }
  2876. }
  2877. /**
  2878. * Removes all key-value entries from the map.
  2879. *
  2880. * @private
  2881. * @name clear
  2882. * @memberOf MapCache
  2883. */
  2884. function mapCacheClear() {
  2885. this.__data__ = {
  2886. 'hash': new Hash,
  2887. 'map': new (Map || ListCache),
  2888. 'string': new Hash
  2889. };
  2890. }
  2891. /**
  2892. * Removes `key` and its value from the map.
  2893. *
  2894. * @private
  2895. * @name delete
  2896. * @memberOf MapCache
  2897. * @param {string} key The key of the value to remove.
  2898. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2899. */
  2900. function mapCacheDelete(key) {
  2901. return getMapData(this, key)['delete'](key);
  2902. }
  2903. /**
  2904. * Gets the map value for `key`.
  2905. *
  2906. * @private
  2907. * @name get
  2908. * @memberOf MapCache
  2909. * @param {string} key The key of the value to get.
  2910. * @returns {*} Returns the entry value.
  2911. */
  2912. function mapCacheGet(key) {
  2913. return getMapData(this, key).get(key);
  2914. }
  2915. /**
  2916. * Checks if a map value for `key` exists.
  2917. *
  2918. * @private
  2919. * @name has
  2920. * @memberOf MapCache
  2921. * @param {string} key The key of the entry to check.
  2922. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2923. */
  2924. function mapCacheHas(key) {
  2925. return getMapData(this, key).has(key);
  2926. }
  2927. /**
  2928. * Sets the map `key` to `value`.
  2929. *
  2930. * @private
  2931. * @name set
  2932. * @memberOf MapCache
  2933. * @param {string} key The key of the value to set.
  2934. * @param {*} value The value to set.
  2935. * @returns {Object} Returns the map cache instance.
  2936. */
  2937. function mapCacheSet(key, value) {
  2938. getMapData(this, key).set(key, value);
  2939. return this;
  2940. }
  2941. // Add methods to `MapCache`.
  2942. MapCache.prototype.clear = mapCacheClear;
  2943. MapCache.prototype['delete'] = mapCacheDelete;
  2944. MapCache.prototype.get = mapCacheGet;
  2945. MapCache.prototype.has = mapCacheHas;
  2946. MapCache.prototype.set = mapCacheSet;
  2947. /**
  2948. * Creates a stack cache object to store key-value pairs.
  2949. *
  2950. * @private
  2951. * @constructor
  2952. * @param {Array} [entries] The key-value pairs to cache.
  2953. */
  2954. function Stack(entries) {
  2955. this.__data__ = new ListCache(entries);
  2956. }
  2957. /**
  2958. * Removes all key-value entries from the stack.
  2959. *
  2960. * @private
  2961. * @name clear
  2962. * @memberOf Stack
  2963. */
  2964. function stackClear() {
  2965. this.__data__ = new ListCache;
  2966. }
  2967. /**
  2968. * Removes `key` and its value from the stack.
  2969. *
  2970. * @private
  2971. * @name delete
  2972. * @memberOf Stack
  2973. * @param {string} key The key of the value to remove.
  2974. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2975. */
  2976. function stackDelete(key) {
  2977. return this.__data__['delete'](key);
  2978. }
  2979. /**
  2980. * Gets the stack value for `key`.
  2981. *
  2982. * @private
  2983. * @name get
  2984. * @memberOf Stack
  2985. * @param {string} key The key of the value to get.
  2986. * @returns {*} Returns the entry value.
  2987. */
  2988. function stackGet(key) {
  2989. return this.__data__.get(key);
  2990. }
  2991. /**
  2992. * Checks if a stack value for `key` exists.
  2993. *
  2994. * @private
  2995. * @name has
  2996. * @memberOf Stack
  2997. * @param {string} key The key of the entry to check.
  2998. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2999. */
  3000. function stackHas(key) {
  3001. return this.__data__.has(key);
  3002. }
  3003. /**
  3004. * Sets the stack `key` to `value`.
  3005. *
  3006. * @private
  3007. * @name set
  3008. * @memberOf Stack
  3009. * @param {string} key The key of the value to set.
  3010. * @param {*} value The value to set.
  3011. * @returns {Object} Returns the stack cache instance.
  3012. */
  3013. function stackSet(key, value) {
  3014. var cache = this.__data__;
  3015. if (cache instanceof ListCache) {
  3016. var pairs = cache.__data__;
  3017. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3018. pairs.push([key, value]);
  3019. return this;
  3020. }
  3021. cache = this.__data__ = new MapCache(pairs);
  3022. }
  3023. cache.set(key, value);
  3024. return this;
  3025. }
  3026. // Add methods to `Stack`.
  3027. Stack.prototype.clear = stackClear;
  3028. Stack.prototype['delete'] = stackDelete;
  3029. Stack.prototype.get = stackGet;
  3030. Stack.prototype.has = stackHas;
  3031. Stack.prototype.set = stackSet;
  3032. /**
  3033. * Creates an array of the enumerable property names of the array-like `value`.
  3034. *
  3035. * @private
  3036. * @param {*} value The value to query.
  3037. * @param {boolean} inherited Specify returning inherited property names.
  3038. * @returns {Array} Returns the array of property names.
  3039. */
  3040. function arrayLikeKeys(value, inherited) {
  3041. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3042. // Safari 9 makes `arguments.length` enumerable in strict mode.
  3043. var result = (isArray(value) || isArguments(value))
  3044. ? baseTimes(value.length, String)
  3045. : [];
  3046. var length = result.length,
  3047. skipIndexes = !!length;
  3048. for (var key in value) {
  3049. if ((inherited || hasOwnProperty.call(value, key)) &&
  3050. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  3051. result.push(key);
  3052. }
  3053. }
  3054. return result;
  3055. }
  3056. /**
  3057. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3058. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3059. * for equality comparisons.
  3060. *
  3061. * @private
  3062. * @param {Object} object The object to modify.
  3063. * @param {string} key The key of the property to assign.
  3064. * @param {*} value The value to assign.
  3065. */
  3066. function assignValue(object, key, value) {
  3067. var objValue = object[key];
  3068. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3069. (value === undefined && !(key in object))) {
  3070. object[key] = value;
  3071. }
  3072. }
  3073. /**
  3074. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3075. *
  3076. * @private
  3077. * @param {Array} array The array to inspect.
  3078. * @param {*} key The key to search for.
  3079. * @returns {number} Returns the index of the matched value, else `-1`.
  3080. */
  3081. function assocIndexOf(array, key) {
  3082. var length = array.length;
  3083. while (length--) {
  3084. if (eq(array[length][0], key)) {
  3085. return length;
  3086. }
  3087. }
  3088. return -1;
  3089. }
  3090. /**
  3091. * The base implementation of `_.assign` without support for multiple sources
  3092. * or `customizer` functions.
  3093. *
  3094. * @private
  3095. * @param {Object} object The destination object.
  3096. * @param {Object} source The source object.
  3097. * @returns {Object} Returns `object`.
  3098. */
  3099. function baseAssign(object, source) {
  3100. return object && copyObject(source, keys(source), object);
  3101. }
  3102. /**
  3103. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3104. * traversed objects.
  3105. *
  3106. * @private
  3107. * @param {*} value The value to clone.
  3108. * @param {boolean} [isDeep] Specify a deep clone.
  3109. * @param {boolean} [isFull] Specify a clone including symbols.
  3110. * @param {Function} [customizer] The function to customize cloning.
  3111. * @param {string} [key] The key of `value`.
  3112. * @param {Object} [object] The parent object of `value`.
  3113. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3114. * @returns {*} Returns the cloned value.
  3115. */
  3116. function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
  3117. var result;
  3118. if (customizer) {
  3119. result = object ? customizer(value, key, object, stack) : customizer(value);
  3120. }
  3121. if (result !== undefined) {
  3122. return result;
  3123. }
  3124. if (!isObject(value)) {
  3125. return value;
  3126. }
  3127. var isArr = isArray(value);
  3128. if (isArr) {
  3129. result = initCloneArray(value);
  3130. if (!isDeep) {
  3131. return copyArray(value, result);
  3132. }
  3133. } else {
  3134. var tag = getTag(value),
  3135. isFunc = tag == funcTag || tag == genTag;
  3136. if (isBuffer(value)) {
  3137. return cloneBuffer(value, isDeep);
  3138. }
  3139. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3140. if (isHostObject(value)) {
  3141. return object ? value : {};
  3142. }
  3143. result = initCloneObject(isFunc ? {} : value);
  3144. if (!isDeep) {
  3145. return copySymbols(value, baseAssign(result, value));
  3146. }
  3147. } else {
  3148. if (!cloneableTags[tag]) {
  3149. return object ? value : {};
  3150. }
  3151. result = initCloneByTag(value, tag, baseClone, isDeep);
  3152. }
  3153. }
  3154. // Check for circular references and return its corresponding clone.
  3155. stack || (stack = new Stack);
  3156. var stacked = stack.get(value);
  3157. if (stacked) {
  3158. return stacked;
  3159. }
  3160. stack.set(value, result);
  3161. if (!isArr) {
  3162. var props = isFull ? getAllKeys(value) : keys(value);
  3163. }
  3164. arrayEach(props || value, function(subValue, key) {
  3165. if (props) {
  3166. key = subValue;
  3167. subValue = value[key];
  3168. }
  3169. // Recursively populate clone (susceptible to call stack limits).
  3170. assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
  3171. });
  3172. return result;
  3173. }
  3174. /**
  3175. * The base implementation of `_.create` without support for assigning
  3176. * properties to the created object.
  3177. *
  3178. * @private
  3179. * @param {Object} prototype The object to inherit from.
  3180. * @returns {Object} Returns the new object.
  3181. */
  3182. function baseCreate(proto) {
  3183. return isObject(proto) ? objectCreate(proto) : {};
  3184. }
  3185. /**
  3186. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3187. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3188. * symbols of `object`.
  3189. *
  3190. * @private
  3191. * @param {Object} object The object to query.
  3192. * @param {Function} keysFunc The function to get the keys of `object`.
  3193. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3194. * @returns {Array} Returns the array of property names and symbols.
  3195. */
  3196. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3197. var result = keysFunc(object);
  3198. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3199. }
  3200. /**
  3201. * The base implementation of `getTag`.
  3202. *
  3203. * @private
  3204. * @param {*} value The value to query.
  3205. * @returns {string} Returns the `toStringTag`.
  3206. */
  3207. function baseGetTag(value) {
  3208. return objectToString.call(value);
  3209. }
  3210. /**
  3211. * The base implementation of `_.isNative` without bad shim checks.
  3212. *
  3213. * @private
  3214. * @param {*} value The value to check.
  3215. * @returns {boolean} Returns `true` if `value` is a native function,
  3216. * else `false`.
  3217. */
  3218. function baseIsNative(value) {
  3219. if (!isObject(value) || isMasked(value)) {
  3220. return false;
  3221. }
  3222. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  3223. return pattern.test(toSource(value));
  3224. }
  3225. /**
  3226. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  3227. *
  3228. * @private
  3229. * @param {Object} object The object to query.
  3230. * @returns {Array} Returns the array of property names.
  3231. */
  3232. function baseKeys(object) {
  3233. if (!isPrototype(object)) {
  3234. return nativeKeys(object);
  3235. }
  3236. var result = [];
  3237. for (var key in Object(object)) {
  3238. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  3239. result.push(key);
  3240. }
  3241. }
  3242. return result;
  3243. }
  3244. /**
  3245. * Creates a clone of `buffer`.
  3246. *
  3247. * @private
  3248. * @param {Buffer} buffer The buffer to clone.
  3249. * @param {boolean} [isDeep] Specify a deep clone.
  3250. * @returns {Buffer} Returns the cloned buffer.
  3251. */
  3252. function cloneBuffer(buffer, isDeep) {
  3253. if (isDeep) {
  3254. return buffer.slice();
  3255. }
  3256. var result = new buffer.constructor(buffer.length);
  3257. buffer.copy(result);
  3258. return result;
  3259. }
  3260. /**
  3261. * Creates a clone of `arrayBuffer`.
  3262. *
  3263. * @private
  3264. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  3265. * @returns {ArrayBuffer} Returns the cloned array buffer.
  3266. */
  3267. function cloneArrayBuffer(arrayBuffer) {
  3268. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  3269. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  3270. return result;
  3271. }
  3272. /**
  3273. * Creates a clone of `dataView`.
  3274. *
  3275. * @private
  3276. * @param {Object} dataView The data view to clone.
  3277. * @param {boolean} [isDeep] Specify a deep clone.
  3278. * @returns {Object} Returns the cloned data view.
  3279. */
  3280. function cloneDataView(dataView, isDeep) {
  3281. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  3282. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  3283. }
  3284. /**
  3285. * Creates a clone of `map`.
  3286. *
  3287. * @private
  3288. * @param {Object} map The map to clone.
  3289. * @param {Function} cloneFunc The function to clone values.
  3290. * @param {boolean} [isDeep] Specify a deep clone.
  3291. * @returns {Object} Returns the cloned map.
  3292. */
  3293. function cloneMap(map, isDeep, cloneFunc) {
  3294. var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
  3295. return arrayReduce(array, addMapEntry, new map.constructor);
  3296. }
  3297. /**
  3298. * Creates a clone of `regexp`.
  3299. *
  3300. * @private
  3301. * @param {Object} regexp The regexp to clone.
  3302. * @returns {Object} Returns the cloned regexp.
  3303. */
  3304. function cloneRegExp(regexp) {
  3305. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  3306. result.lastIndex = regexp.lastIndex;
  3307. return result;
  3308. }
  3309. /**
  3310. * Creates a clone of `set`.
  3311. *
  3312. * @private
  3313. * @param {Object} set The set to clone.
  3314. * @param {Function} cloneFunc The function to clone values.
  3315. * @param {boolean} [isDeep] Specify a deep clone.
  3316. * @returns {Object} Returns the cloned set.
  3317. */
  3318. function cloneSet(set, isDeep, cloneFunc) {
  3319. var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
  3320. return arrayReduce(array, addSetEntry, new set.constructor);
  3321. }
  3322. /**
  3323. * Creates a clone of the `symbol` object.
  3324. *
  3325. * @private
  3326. * @param {Object} symbol The symbol object to clone.
  3327. * @returns {Object} Returns the cloned symbol object.
  3328. */
  3329. function cloneSymbol(symbol) {
  3330. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  3331. }
  3332. /**
  3333. * Creates a clone of `typedArray`.
  3334. *
  3335. * @private
  3336. * @param {Object} typedArray The typed array to clone.
  3337. * @param {boolean} [isDeep] Specify a deep clone.
  3338. * @returns {Object} Returns the cloned typed array.
  3339. */
  3340. function cloneTypedArray(typedArray, isDeep) {
  3341. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  3342. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  3343. }
  3344. /**
  3345. * Copies the values of `source` to `array`.
  3346. *
  3347. * @private
  3348. * @param {Array} source The array to copy values from.
  3349. * @param {Array} [array=[]] The array to copy values to.
  3350. * @returns {Array} Returns `array`.
  3351. */
  3352. function copyArray(source, array) {
  3353. var index = -1,
  3354. length = source.length;
  3355. array || (array = Array(length));
  3356. while (++index < length) {
  3357. array[index] = source[index];
  3358. }
  3359. return array;
  3360. }
  3361. /**
  3362. * Copies properties of `source` to `object`.
  3363. *
  3364. * @private
  3365. * @param {Object} source The object to copy properties from.
  3366. * @param {Array} props The property identifiers to copy.
  3367. * @param {Object} [object={}] The object to copy properties to.
  3368. * @param {Function} [customizer] The function to customize copied values.
  3369. * @returns {Object} Returns `object`.
  3370. */
  3371. function copyObject(source, props, object, customizer) {
  3372. object || (object = {});
  3373. var index = -1,
  3374. length = props.length;
  3375. while (++index < length) {
  3376. var key = props[index];
  3377. var newValue = customizer
  3378. ? customizer(object[key], source[key], key, object, source)
  3379. : undefined;
  3380. assignValue(object, key, newValue === undefined ? source[key] : newValue);
  3381. }
  3382. return object;
  3383. }
  3384. /**
  3385. * Copies own symbol properties of `source` to `object`.
  3386. *
  3387. * @private
  3388. * @param {Object} source The object to copy symbols from.
  3389. * @param {Object} [object={}] The object to copy symbols to.
  3390. * @returns {Object} Returns `object`.
  3391. */
  3392. function copySymbols(source, object) {
  3393. return copyObject(source, getSymbols(source), object);
  3394. }
  3395. /**
  3396. * Creates an array of own enumerable property names and symbols of `object`.
  3397. *
  3398. * @private
  3399. * @param {Object} object The object to query.
  3400. * @returns {Array} Returns the array of property names and symbols.
  3401. */
  3402. function getAllKeys(object) {
  3403. return baseGetAllKeys(object, keys, getSymbols);
  3404. }
  3405. /**
  3406. * Gets the data for `map`.
  3407. *
  3408. * @private
  3409. * @param {Object} map The map to query.
  3410. * @param {string} key The reference key.
  3411. * @returns {*} Returns the map data.
  3412. */
  3413. function getMapData(map, key) {
  3414. var data = map.__data__;
  3415. return isKeyable(key)
  3416. ? data[typeof key == 'string' ? 'string' : 'hash']
  3417. : data.map;
  3418. }
  3419. /**
  3420. * Gets the native function at `key` of `object`.
  3421. *
  3422. * @private
  3423. * @param {Object} object The object to query.
  3424. * @param {string} key The key of the method to get.
  3425. * @returns {*} Returns the function if it's native, else `undefined`.
  3426. */
  3427. function getNative(object, key) {
  3428. var value = getValue(object, key);
  3429. return baseIsNative(value) ? value : undefined;
  3430. }
  3431. /**
  3432. * Creates an array of the own enumerable symbol properties of `object`.
  3433. *
  3434. * @private
  3435. * @param {Object} object The object to query.
  3436. * @returns {Array} Returns the array of symbols.
  3437. */
  3438. var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
  3439. /**
  3440. * Gets the `toStringTag` of `value`.
  3441. *
  3442. * @private
  3443. * @param {*} value The value to query.
  3444. * @returns {string} Returns the `toStringTag`.
  3445. */
  3446. var getTag = baseGetTag;
  3447. // Fallback for data views, maps, sets, and weak maps in IE 11,
  3448. // for data views in Edge < 14, and promises in Node.js.
  3449. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  3450. (Map && getTag(new Map) != mapTag) ||
  3451. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  3452. (Set && getTag(new Set) != setTag) ||
  3453. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  3454. getTag = function(value) {
  3455. var result = objectToString.call(value),
  3456. Ctor = result == objectTag ? value.constructor : undefined,
  3457. ctorString = Ctor ? toSource(Ctor) : undefined;
  3458. if (ctorString) {
  3459. switch (ctorString) {
  3460. case dataViewCtorString: return dataViewTag;
  3461. case mapCtorString: return mapTag;
  3462. case promiseCtorString: return promiseTag;
  3463. case setCtorString: return setTag;
  3464. case weakMapCtorString: return weakMapTag;
  3465. }
  3466. }
  3467. return result;
  3468. };
  3469. }
  3470. /**
  3471. * Initializes an array clone.
  3472. *
  3473. * @private
  3474. * @param {Array} array The array to clone.
  3475. * @returns {Array} Returns the initialized clone.
  3476. */
  3477. function initCloneArray(array) {
  3478. var length = array.length,
  3479. result = array.constructor(length);
  3480. // Add properties assigned by `RegExp#exec`.
  3481. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  3482. result.index = array.index;
  3483. result.input = array.input;
  3484. }
  3485. return result;
  3486. }
  3487. /**
  3488. * Initializes an object clone.
  3489. *
  3490. * @private
  3491. * @param {Object} object The object to clone.
  3492. * @returns {Object} Returns the initialized clone.
  3493. */
  3494. function initCloneObject(object) {
  3495. return (typeof object.constructor == 'function' && !isPrototype(object))
  3496. ? baseCreate(getPrototype(object))
  3497. : {};
  3498. }
  3499. /**
  3500. * Initializes an object clone based on its `toStringTag`.
  3501. *
  3502. * **Note:** This function only supports cloning values with tags of
  3503. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  3504. *
  3505. * @private
  3506. * @param {Object} object The object to clone.
  3507. * @param {string} tag The `toStringTag` of the object to clone.
  3508. * @param {Function} cloneFunc The function to clone values.
  3509. * @param {boolean} [isDeep] Specify a deep clone.
  3510. * @returns {Object} Returns the initialized clone.
  3511. */
  3512. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  3513. var Ctor = object.constructor;
  3514. switch (tag) {
  3515. case arrayBufferTag:
  3516. return cloneArrayBuffer(object);
  3517. case boolTag:
  3518. case dateTag:
  3519. return new Ctor(+object);
  3520. case dataViewTag:
  3521. return cloneDataView(object, isDeep);
  3522. case float32Tag: case float64Tag:
  3523. case int8Tag: case int16Tag: case int32Tag:
  3524. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  3525. return cloneTypedArray(object, isDeep);
  3526. case mapTag:
  3527. return cloneMap(object, isDeep, cloneFunc);
  3528. case numberTag:
  3529. case stringTag:
  3530. return new Ctor(object);
  3531. case regexpTag:
  3532. return cloneRegExp(object);
  3533. case setTag:
  3534. return cloneSet(object, isDeep, cloneFunc);
  3535. case symbolTag:
  3536. return cloneSymbol(object);
  3537. }
  3538. }
  3539. /**
  3540. * Checks if `value` is a valid array-like index.
  3541. *
  3542. * @private
  3543. * @param {*} value The value to check.
  3544. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3545. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3546. */
  3547. function isIndex(value, length) {
  3548. length = length == null ? MAX_SAFE_INTEGER : length;
  3549. return !!length &&
  3550. (typeof value == 'number' || reIsUint.test(value)) &&
  3551. (value > -1 && value % 1 == 0 && value < length);
  3552. }
  3553. /**
  3554. * Checks if `value` is suitable for use as unique object key.
  3555. *
  3556. * @private
  3557. * @param {*} value The value to check.
  3558. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  3559. */
  3560. function isKeyable(value) {
  3561. var type = typeof value;
  3562. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  3563. ? (value !== '__proto__')
  3564. : (value === null);
  3565. }
  3566. /**
  3567. * Checks if `func` has its source masked.
  3568. *
  3569. * @private
  3570. * @param {Function} func The function to check.
  3571. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3572. */
  3573. function isMasked(func) {
  3574. return !!maskSrcKey && (maskSrcKey in func);
  3575. }
  3576. /**
  3577. * Checks if `value` is likely a prototype object.
  3578. *
  3579. * @private
  3580. * @param {*} value The value to check.
  3581. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  3582. */
  3583. function isPrototype(value) {
  3584. var Ctor = value && value.constructor,
  3585. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  3586. return value === proto;
  3587. }
  3588. /**
  3589. * Converts `func` to its source code.
  3590. *
  3591. * @private
  3592. * @param {Function} func The function to process.
  3593. * @returns {string} Returns the source code.
  3594. */
  3595. function toSource(func) {
  3596. if (func != null) {
  3597. try {
  3598. return funcToString.call(func);
  3599. } catch (e) {}
  3600. try {
  3601. return (func + '');
  3602. } catch (e) {}
  3603. }
  3604. return '';
  3605. }
  3606. /**
  3607. * This method is like `_.clone` except that it recursively clones `value`.
  3608. *
  3609. * @static
  3610. * @memberOf _
  3611. * @since 1.0.0
  3612. * @category Lang
  3613. * @param {*} value The value to recursively clone.
  3614. * @returns {*} Returns the deep cloned value.
  3615. * @see _.clone
  3616. * @example
  3617. *
  3618. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  3619. *
  3620. * var deep = _.cloneDeep(objects);
  3621. * console.log(deep[0] === objects[0]);
  3622. * // => false
  3623. */
  3624. function cloneDeep(value) {
  3625. return baseClone(value, true, true);
  3626. }
  3627. /**
  3628. * Performs a
  3629. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3630. * comparison between two values to determine if they are equivalent.
  3631. *
  3632. * @static
  3633. * @memberOf _
  3634. * @since 4.0.0
  3635. * @category Lang
  3636. * @param {*} value The value to compare.
  3637. * @param {*} other The other value to compare.
  3638. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3639. * @example
  3640. *
  3641. * var object = { 'a': 1 };
  3642. * var other = { 'a': 1 };
  3643. *
  3644. * _.eq(object, object);
  3645. * // => true
  3646. *
  3647. * _.eq(object, other);
  3648. * // => false
  3649. *
  3650. * _.eq('a', 'a');
  3651. * // => true
  3652. *
  3653. * _.eq('a', Object('a'));
  3654. * // => false
  3655. *
  3656. * _.eq(NaN, NaN);
  3657. * // => true
  3658. */
  3659. function eq(value, other) {
  3660. return value === other || (value !== value && other !== other);
  3661. }
  3662. /**
  3663. * Checks if `value` is likely an `arguments` object.
  3664. *
  3665. * @static
  3666. * @memberOf _
  3667. * @since 0.1.0
  3668. * @category Lang
  3669. * @param {*} value The value to check.
  3670. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3671. * else `false`.
  3672. * @example
  3673. *
  3674. * _.isArguments(function() { return arguments; }());
  3675. * // => true
  3676. *
  3677. * _.isArguments([1, 2, 3]);
  3678. * // => false
  3679. */
  3680. function isArguments(value) {
  3681. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3682. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3683. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3684. }
  3685. /**
  3686. * Checks if `value` is classified as an `Array` object.
  3687. *
  3688. * @static
  3689. * @memberOf _
  3690. * @since 0.1.0
  3691. * @category Lang
  3692. * @param {*} value The value to check.
  3693. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3694. * @example
  3695. *
  3696. * _.isArray([1, 2, 3]);
  3697. * // => true
  3698. *
  3699. * _.isArray(document.body.children);
  3700. * // => false
  3701. *
  3702. * _.isArray('abc');
  3703. * // => false
  3704. *
  3705. * _.isArray(_.noop);
  3706. * // => false
  3707. */
  3708. var isArray = Array.isArray;
  3709. /**
  3710. * Checks if `value` is array-like. A value is considered array-like if it's
  3711. * not a function and has a `value.length` that's an integer greater than or
  3712. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3713. *
  3714. * @static
  3715. * @memberOf _
  3716. * @since 4.0.0
  3717. * @category Lang
  3718. * @param {*} value The value to check.
  3719. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3720. * @example
  3721. *
  3722. * _.isArrayLike([1, 2, 3]);
  3723. * // => true
  3724. *
  3725. * _.isArrayLike(document.body.children);
  3726. * // => true
  3727. *
  3728. * _.isArrayLike('abc');
  3729. * // => true
  3730. *
  3731. * _.isArrayLike(_.noop);
  3732. * // => false
  3733. */
  3734. function isArrayLike(value) {
  3735. return value != null && isLength(value.length) && !isFunction(value);
  3736. }
  3737. /**
  3738. * This method is like `_.isArrayLike` except that it also checks if `value`
  3739. * is an object.
  3740. *
  3741. * @static
  3742. * @memberOf _
  3743. * @since 4.0.0
  3744. * @category Lang
  3745. * @param {*} value The value to check.
  3746. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3747. * else `false`.
  3748. * @example
  3749. *
  3750. * _.isArrayLikeObject([1, 2, 3]);
  3751. * // => true
  3752. *
  3753. * _.isArrayLikeObject(document.body.children);
  3754. * // => true
  3755. *
  3756. * _.isArrayLikeObject('abc');
  3757. * // => false
  3758. *
  3759. * _.isArrayLikeObject(_.noop);
  3760. * // => false
  3761. */
  3762. function isArrayLikeObject(value) {
  3763. return isObjectLike(value) && isArrayLike(value);
  3764. }
  3765. /**
  3766. * Checks if `value` is a buffer.
  3767. *
  3768. * @static
  3769. * @memberOf _
  3770. * @since 4.3.0
  3771. * @category Lang
  3772. * @param {*} value The value to check.
  3773. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  3774. * @example
  3775. *
  3776. * _.isBuffer(new Buffer(2));
  3777. * // => true
  3778. *
  3779. * _.isBuffer(new Uint8Array(2));
  3780. * // => false
  3781. */
  3782. var isBuffer = nativeIsBuffer || stubFalse;
  3783. /**
  3784. * Checks if `value` is classified as a `Function` object.
  3785. *
  3786. * @static
  3787. * @memberOf _
  3788. * @since 0.1.0
  3789. * @category Lang
  3790. * @param {*} value The value to check.
  3791. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3792. * @example
  3793. *
  3794. * _.isFunction(_);
  3795. * // => true
  3796. *
  3797. * _.isFunction(/abc/);
  3798. * // => false
  3799. */
  3800. function isFunction(value) {
  3801. // The use of `Object#toString` avoids issues with the `typeof` operator
  3802. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3803. var tag = isObject(value) ? objectToString.call(value) : '';
  3804. return tag == funcTag || tag == genTag;
  3805. }
  3806. /**
  3807. * Checks if `value` is a valid array-like length.
  3808. *
  3809. * **Note:** This method is loosely based on
  3810. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  3811. *
  3812. * @static
  3813. * @memberOf _
  3814. * @since 4.0.0
  3815. * @category Lang
  3816. * @param {*} value The value to check.
  3817. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  3818. * @example
  3819. *
  3820. * _.isLength(3);
  3821. * // => true
  3822. *
  3823. * _.isLength(Number.MIN_VALUE);
  3824. * // => false
  3825. *
  3826. * _.isLength(Infinity);
  3827. * // => false
  3828. *
  3829. * _.isLength('3');
  3830. * // => false
  3831. */
  3832. function isLength(value) {
  3833. return typeof value == 'number' &&
  3834. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  3835. }
  3836. /**
  3837. * Checks if `value` is the
  3838. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3839. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3840. *
  3841. * @static
  3842. * @memberOf _
  3843. * @since 0.1.0
  3844. * @category Lang
  3845. * @param {*} value The value to check.
  3846. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3847. * @example
  3848. *
  3849. * _.isObject({});
  3850. * // => true
  3851. *
  3852. * _.isObject([1, 2, 3]);
  3853. * // => true
  3854. *
  3855. * _.isObject(_.noop);
  3856. * // => true
  3857. *
  3858. * _.isObject(null);
  3859. * // => false
  3860. */
  3861. function isObject(value) {
  3862. var type = typeof value;
  3863. return !!value && (type == 'object' || type == 'function');
  3864. }
  3865. /**
  3866. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3867. * and has a `typeof` result of "object".
  3868. *
  3869. * @static
  3870. * @memberOf _
  3871. * @since 4.0.0
  3872. * @category Lang
  3873. * @param {*} value The value to check.
  3874. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3875. * @example
  3876. *
  3877. * _.isObjectLike({});
  3878. * // => true
  3879. *
  3880. * _.isObjectLike([1, 2, 3]);
  3881. * // => true
  3882. *
  3883. * _.isObjectLike(_.noop);
  3884. * // => false
  3885. *
  3886. * _.isObjectLike(null);
  3887. * // => false
  3888. */
  3889. function isObjectLike(value) {
  3890. return !!value && typeof value == 'object';
  3891. }
  3892. /**
  3893. * Creates an array of the own enumerable property names of `object`.
  3894. *
  3895. * **Note:** Non-object values are coerced to objects. See the
  3896. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3897. * for more details.
  3898. *
  3899. * @static
  3900. * @since 0.1.0
  3901. * @memberOf _
  3902. * @category Object
  3903. * @param {Object} object The object to query.
  3904. * @returns {Array} Returns the array of property names.
  3905. * @example
  3906. *
  3907. * function Foo() {
  3908. * this.a = 1;
  3909. * this.b = 2;
  3910. * }
  3911. *
  3912. * Foo.prototype.c = 3;
  3913. *
  3914. * _.keys(new Foo);
  3915. * // => ['a', 'b'] (iteration order is not guaranteed)
  3916. *
  3917. * _.keys('hi');
  3918. * // => ['0', '1']
  3919. */
  3920. function keys(object) {
  3921. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  3922. }
  3923. /**
  3924. * This method returns a new empty array.
  3925. *
  3926. * @static
  3927. * @memberOf _
  3928. * @since 4.13.0
  3929. * @category Util
  3930. * @returns {Array} Returns the new empty array.
  3931. * @example
  3932. *
  3933. * var arrays = _.times(2, _.stubArray);
  3934. *
  3935. * console.log(arrays);
  3936. * // => [[], []]
  3937. *
  3938. * console.log(arrays[0] === arrays[1]);
  3939. * // => false
  3940. */
  3941. function stubArray() {
  3942. return [];
  3943. }
  3944. /**
  3945. * This method returns `false`.
  3946. *
  3947. * @static
  3948. * @memberOf _
  3949. * @since 4.13.0
  3950. * @category Util
  3951. * @returns {boolean} Returns `false`.
  3952. * @example
  3953. *
  3954. * _.times(2, _.stubFalse);
  3955. * // => [false, false]
  3956. */
  3957. function stubFalse() {
  3958. return false;
  3959. }
  3960. module.exports = cloneDeep;
  3961. /***/ }),
  3962. /***/ 52:
  3963. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3964. /**
  3965. * lodash (Custom Build) <https://lodash.com/>
  3966. * Build: `lodash modularize exports="npm" -o ./`
  3967. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3968. * Released under MIT license <https://lodash.com/license>
  3969. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3970. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3971. */
  3972. /** Used as references for various `Number` constants. */
  3973. var MAX_SAFE_INTEGER = 9007199254740991;
  3974. /** `Object#toString` result references. */
  3975. var argsTag = '[object Arguments]',
  3976. funcTag = '[object Function]',
  3977. genTag = '[object GeneratorFunction]',
  3978. mapTag = '[object Map]',
  3979. objectTag = '[object Object]',
  3980. promiseTag = '[object Promise]',
  3981. setTag = '[object Set]',
  3982. weakMapTag = '[object WeakMap]';
  3983. var dataViewTag = '[object DataView]';
  3984. /**
  3985. * Used to match `RegExp`
  3986. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3987. */
  3988. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3989. /** Used to detect host constructors (Safari). */
  3990. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3991. /** Used to detect unsigned integer values. */
  3992. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3993. /** Detect free variable `global` from Node.js. */
  3994. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3995. /** Detect free variable `self`. */
  3996. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3997. /** Used as a reference to the global object. */
  3998. var root = freeGlobal || freeSelf || Function('return this')();
  3999. /**
  4000. * A specialized version of `_.map` for arrays without support for iteratee
  4001. * shorthands.
  4002. *
  4003. * @private
  4004. * @param {Array} [array] The array to iterate over.
  4005. * @param {Function} iteratee The function invoked per iteration.
  4006. * @returns {Array} Returns the new mapped array.
  4007. */
  4008. function arrayMap(array, iteratee) {
  4009. var index = -1,
  4010. length = array ? array.length : 0,
  4011. result = Array(length);
  4012. while (++index < length) {
  4013. result[index] = iteratee(array[index], index, array);
  4014. }
  4015. return result;
  4016. }
  4017. /**
  4018. * The base implementation of `_.times` without support for iteratee shorthands
  4019. * or max array length checks.
  4020. *
  4021. * @private
  4022. * @param {number} n The number of times to invoke `iteratee`.
  4023. * @param {Function} iteratee The function invoked per iteration.
  4024. * @returns {Array} Returns the array of results.
  4025. */
  4026. function baseTimes(n, iteratee) {
  4027. var index = -1,
  4028. result = Array(n);
  4029. while (++index < n) {
  4030. result[index] = iteratee(index);
  4031. }
  4032. return result;
  4033. }
  4034. /**
  4035. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  4036. * of key-value pairs for `object` corresponding to the property names of `props`.
  4037. *
  4038. * @private
  4039. * @param {Object} object The object to query.
  4040. * @param {Array} props The property names to get values for.
  4041. * @returns {Object} Returns the key-value pairs.
  4042. */
  4043. function baseToPairs(object, props) {
  4044. return arrayMap(props, function(key) {
  4045. return [key, object[key]];
  4046. });
  4047. }
  4048. /**
  4049. * Gets the value at `key` of `object`.
  4050. *
  4051. * @private
  4052. * @param {Object} [object] The object to query.
  4053. * @param {string} key The key of the property to get.
  4054. * @returns {*} Returns the property value.
  4055. */
  4056. function getValue(object, key) {
  4057. return object == null ? undefined : object[key];
  4058. }
  4059. /**
  4060. * Checks if `value` is a host object in IE < 9.
  4061. *
  4062. * @private
  4063. * @param {*} value The value to check.
  4064. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  4065. */
  4066. function isHostObject(value) {
  4067. // Many host objects are `Object` objects that can coerce to strings
  4068. // despite having improperly defined `toString` methods.
  4069. var result = false;
  4070. if (value != null && typeof value.toString != 'function') {
  4071. try {
  4072. result = !!(value + '');
  4073. } catch (e) {}
  4074. }
  4075. return result;
  4076. }
  4077. /**
  4078. * Converts `map` to its key-value pairs.
  4079. *
  4080. * @private
  4081. * @param {Object} map The map to convert.
  4082. * @returns {Array} Returns the key-value pairs.
  4083. */
  4084. function mapToArray(map) {
  4085. var index = -1,
  4086. result = Array(map.size);
  4087. map.forEach(function(value, key) {
  4088. result[++index] = [key, value];
  4089. });
  4090. return result;
  4091. }
  4092. /**
  4093. * Creates a unary function that invokes `func` with its argument transformed.
  4094. *
  4095. * @private
  4096. * @param {Function} func The function to wrap.
  4097. * @param {Function} transform The argument transform.
  4098. * @returns {Function} Returns the new function.
  4099. */
  4100. function overArg(func, transform) {
  4101. return function(arg) {
  4102. return func(transform(arg));
  4103. };
  4104. }
  4105. /**
  4106. * Converts `set` to its value-value pairs.
  4107. *
  4108. * @private
  4109. * @param {Object} set The set to convert.
  4110. * @returns {Array} Returns the value-value pairs.
  4111. */
  4112. function setToPairs(set) {
  4113. var index = -1,
  4114. result = Array(set.size);
  4115. set.forEach(function(value) {
  4116. result[++index] = [value, value];
  4117. });
  4118. return result;
  4119. }
  4120. /** Used for built-in method references. */
  4121. var funcProto = Function.prototype,
  4122. objectProto = Object.prototype;
  4123. /** Used to detect overreaching core-js shims. */
  4124. var coreJsData = root['__core-js_shared__'];
  4125. /** Used to detect methods masquerading as native. */
  4126. var maskSrcKey = (function() {
  4127. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  4128. return uid ? ('Symbol(src)_1.' + uid) : '';
  4129. }());
  4130. /** Used to resolve the decompiled source of functions. */
  4131. var funcToString = funcProto.toString;
  4132. /** Used to check objects for own properties. */
  4133. var hasOwnProperty = objectProto.hasOwnProperty;
  4134. /**
  4135. * Used to resolve the
  4136. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4137. * of values.
  4138. */
  4139. var objectToString = objectProto.toString;
  4140. /** Used to detect if a method is native. */
  4141. var reIsNative = RegExp('^' +
  4142. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  4143. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4144. );
  4145. /** Built-in value references. */
  4146. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  4147. /* Built-in method references for those with the same name as other `lodash` methods. */
  4148. var nativeKeys = overArg(Object.keys, Object);
  4149. /* Built-in method references that are verified to be native. */
  4150. var DataView = getNative(root, 'DataView'),
  4151. Map = getNative(root, 'Map'),
  4152. Promise = getNative(root, 'Promise'),
  4153. Set = getNative(root, 'Set'),
  4154. WeakMap = getNative(root, 'WeakMap');
  4155. /** Used to detect maps, sets, and weakmaps. */
  4156. var dataViewCtorString = toSource(DataView),
  4157. mapCtorString = toSource(Map),
  4158. promiseCtorString = toSource(Promise),
  4159. setCtorString = toSource(Set),
  4160. weakMapCtorString = toSource(WeakMap);
  4161. /**
  4162. * Creates an array of the enumerable property names of the array-like `value`.
  4163. *
  4164. * @private
  4165. * @param {*} value The value to query.
  4166. * @param {boolean} inherited Specify returning inherited property names.
  4167. * @returns {Array} Returns the array of property names.
  4168. */
  4169. function arrayLikeKeys(value, inherited) {
  4170. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4171. // Safari 9 makes `arguments.length` enumerable in strict mode.
  4172. var result = (isArray(value) || isArguments(value))
  4173. ? baseTimes(value.length, String)
  4174. : [];
  4175. var length = result.length,
  4176. skipIndexes = !!length;
  4177. for (var key in value) {
  4178. if ((inherited || hasOwnProperty.call(value, key)) &&
  4179. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  4180. result.push(key);
  4181. }
  4182. }
  4183. return result;
  4184. }
  4185. /**
  4186. * The base implementation of `getTag`.
  4187. *
  4188. * @private
  4189. * @param {*} value The value to query.
  4190. * @returns {string} Returns the `toStringTag`.
  4191. */
  4192. function baseGetTag(value) {
  4193. return objectToString.call(value);
  4194. }
  4195. /**
  4196. * The base implementation of `_.isNative` without bad shim checks.
  4197. *
  4198. * @private
  4199. * @param {*} value The value to check.
  4200. * @returns {boolean} Returns `true` if `value` is a native function,
  4201. * else `false`.
  4202. */
  4203. function baseIsNative(value) {
  4204. if (!isObject(value) || isMasked(value)) {
  4205. return false;
  4206. }
  4207. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  4208. return pattern.test(toSource(value));
  4209. }
  4210. /**
  4211. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4212. *
  4213. * @private
  4214. * @param {Object} object The object to query.
  4215. * @returns {Array} Returns the array of property names.
  4216. */
  4217. function baseKeys(object) {
  4218. if (!isPrototype(object)) {
  4219. return nativeKeys(object);
  4220. }
  4221. var result = [];
  4222. for (var key in Object(object)) {
  4223. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4224. result.push(key);
  4225. }
  4226. }
  4227. return result;
  4228. }
  4229. /**
  4230. * Creates a `_.toPairs` or `_.toPairsIn` function.
  4231. *
  4232. * @private
  4233. * @param {Function} keysFunc The function to get the keys of a given object.
  4234. * @returns {Function} Returns the new pairs function.
  4235. */
  4236. function createToPairs(keysFunc) {
  4237. return function(object) {
  4238. var tag = getTag(object);
  4239. if (tag == mapTag) {
  4240. return mapToArray(object);
  4241. }
  4242. if (tag == setTag) {
  4243. return setToPairs(object);
  4244. }
  4245. return baseToPairs(object, keysFunc(object));
  4246. };
  4247. }
  4248. /**
  4249. * Gets the native function at `key` of `object`.
  4250. *
  4251. * @private
  4252. * @param {Object} object The object to query.
  4253. * @param {string} key The key of the method to get.
  4254. * @returns {*} Returns the function if it's native, else `undefined`.
  4255. */
  4256. function getNative(object, key) {
  4257. var value = getValue(object, key);
  4258. return baseIsNative(value) ? value : undefined;
  4259. }
  4260. /**
  4261. * Gets the `toStringTag` of `value`.
  4262. *
  4263. * @private
  4264. * @param {*} value The value to query.
  4265. * @returns {string} Returns the `toStringTag`.
  4266. */
  4267. var getTag = baseGetTag;
  4268. // Fallback for data views, maps, sets, and weak maps in IE 11,
  4269. // for data views in Edge < 14, and promises in Node.js.
  4270. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  4271. (Map && getTag(new Map) != mapTag) ||
  4272. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  4273. (Set && getTag(new Set) != setTag) ||
  4274. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  4275. getTag = function(value) {
  4276. var result = objectToString.call(value),
  4277. Ctor = result == objectTag ? value.constructor : undefined,
  4278. ctorString = Ctor ? toSource(Ctor) : undefined;
  4279. if (ctorString) {
  4280. switch (ctorString) {
  4281. case dataViewCtorString: return dataViewTag;
  4282. case mapCtorString: return mapTag;
  4283. case promiseCtorString: return promiseTag;
  4284. case setCtorString: return setTag;
  4285. case weakMapCtorString: return weakMapTag;
  4286. }
  4287. }
  4288. return result;
  4289. };
  4290. }
  4291. /**
  4292. * Checks if `value` is a valid array-like index.
  4293. *
  4294. * @private
  4295. * @param {*} value The value to check.
  4296. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  4297. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  4298. */
  4299. function isIndex(value, length) {
  4300. length = length == null ? MAX_SAFE_INTEGER : length;
  4301. return !!length &&
  4302. (typeof value == 'number' || reIsUint.test(value)) &&
  4303. (value > -1 && value % 1 == 0 && value < length);
  4304. }
  4305. /**
  4306. * Checks if `func` has its source masked.
  4307. *
  4308. * @private
  4309. * @param {Function} func The function to check.
  4310. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  4311. */
  4312. function isMasked(func) {
  4313. return !!maskSrcKey && (maskSrcKey in func);
  4314. }
  4315. /**
  4316. * Checks if `value` is likely a prototype object.
  4317. *
  4318. * @private
  4319. * @param {*} value The value to check.
  4320. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  4321. */
  4322. function isPrototype(value) {
  4323. var Ctor = value && value.constructor,
  4324. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  4325. return value === proto;
  4326. }
  4327. /**
  4328. * Converts `func` to its source code.
  4329. *
  4330. * @private
  4331. * @param {Function} func The function to process.
  4332. * @returns {string} Returns the source code.
  4333. */
  4334. function toSource(func) {
  4335. if (func != null) {
  4336. try {
  4337. return funcToString.call(func);
  4338. } catch (e) {}
  4339. try {
  4340. return (func + '');
  4341. } catch (e) {}
  4342. }
  4343. return '';
  4344. }
  4345. /**
  4346. * Checks if `value` is likely an `arguments` object.
  4347. *
  4348. * @static
  4349. * @memberOf _
  4350. * @since 0.1.0
  4351. * @category Lang
  4352. * @param {*} value The value to check.
  4353. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4354. * else `false`.
  4355. * @example
  4356. *
  4357. * _.isArguments(function() { return arguments; }());
  4358. * // => true
  4359. *
  4360. * _.isArguments([1, 2, 3]);
  4361. * // => false
  4362. */
  4363. function isArguments(value) {
  4364. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4365. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  4366. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  4367. }
  4368. /**
  4369. * Checks if `value` is classified as an `Array` object.
  4370. *
  4371. * @static
  4372. * @memberOf _
  4373. * @since 0.1.0
  4374. * @category Lang
  4375. * @param {*} value The value to check.
  4376. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  4377. * @example
  4378. *
  4379. * _.isArray([1, 2, 3]);
  4380. * // => true
  4381. *
  4382. * _.isArray(document.body.children);
  4383. * // => false
  4384. *
  4385. * _.isArray('abc');
  4386. * // => false
  4387. *
  4388. * _.isArray(_.noop);
  4389. * // => false
  4390. */
  4391. var isArray = Array.isArray;
  4392. /**
  4393. * Checks if `value` is array-like. A value is considered array-like if it's
  4394. * not a function and has a `value.length` that's an integer greater than or
  4395. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  4396. *
  4397. * @static
  4398. * @memberOf _
  4399. * @since 4.0.0
  4400. * @category Lang
  4401. * @param {*} value The value to check.
  4402. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  4403. * @example
  4404. *
  4405. * _.isArrayLike([1, 2, 3]);
  4406. * // => true
  4407. *
  4408. * _.isArrayLike(document.body.children);
  4409. * // => true
  4410. *
  4411. * _.isArrayLike('abc');
  4412. * // => true
  4413. *
  4414. * _.isArrayLike(_.noop);
  4415. * // => false
  4416. */
  4417. function isArrayLike(value) {
  4418. return value != null && isLength(value.length) && !isFunction(value);
  4419. }
  4420. /**
  4421. * This method is like `_.isArrayLike` except that it also checks if `value`
  4422. * is an object.
  4423. *
  4424. * @static
  4425. * @memberOf _
  4426. * @since 4.0.0
  4427. * @category Lang
  4428. * @param {*} value The value to check.
  4429. * @returns {boolean} Returns `true` if `value` is an array-like object,
  4430. * else `false`.
  4431. * @example
  4432. *
  4433. * _.isArrayLikeObject([1, 2, 3]);
  4434. * // => true
  4435. *
  4436. * _.isArrayLikeObject(document.body.children);
  4437. * // => true
  4438. *
  4439. * _.isArrayLikeObject('abc');
  4440. * // => false
  4441. *
  4442. * _.isArrayLikeObject(_.noop);
  4443. * // => false
  4444. */
  4445. function isArrayLikeObject(value) {
  4446. return isObjectLike(value) && isArrayLike(value);
  4447. }
  4448. /**
  4449. * Checks if `value` is classified as a `Function` object.
  4450. *
  4451. * @static
  4452. * @memberOf _
  4453. * @since 0.1.0
  4454. * @category Lang
  4455. * @param {*} value The value to check.
  4456. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4457. * @example
  4458. *
  4459. * _.isFunction(_);
  4460. * // => true
  4461. *
  4462. * _.isFunction(/abc/);
  4463. * // => false
  4464. */
  4465. function isFunction(value) {
  4466. // The use of `Object#toString` avoids issues with the `typeof` operator
  4467. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  4468. var tag = isObject(value) ? objectToString.call(value) : '';
  4469. return tag == funcTag || tag == genTag;
  4470. }
  4471. /**
  4472. * Checks if `value` is a valid array-like length.
  4473. *
  4474. * **Note:** This method is loosely based on
  4475. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4476. *
  4477. * @static
  4478. * @memberOf _
  4479. * @since 4.0.0
  4480. * @category Lang
  4481. * @param {*} value The value to check.
  4482. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4483. * @example
  4484. *
  4485. * _.isLength(3);
  4486. * // => true
  4487. *
  4488. * _.isLength(Number.MIN_VALUE);
  4489. * // => false
  4490. *
  4491. * _.isLength(Infinity);
  4492. * // => false
  4493. *
  4494. * _.isLength('3');
  4495. * // => false
  4496. */
  4497. function isLength(value) {
  4498. return typeof value == 'number' &&
  4499. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  4500. }
  4501. /**
  4502. * Checks if `value` is the
  4503. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4504. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4505. *
  4506. * @static
  4507. * @memberOf _
  4508. * @since 0.1.0
  4509. * @category Lang
  4510. * @param {*} value The value to check.
  4511. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4512. * @example
  4513. *
  4514. * _.isObject({});
  4515. * // => true
  4516. *
  4517. * _.isObject([1, 2, 3]);
  4518. * // => true
  4519. *
  4520. * _.isObject(_.noop);
  4521. * // => true
  4522. *
  4523. * _.isObject(null);
  4524. * // => false
  4525. */
  4526. function isObject(value) {
  4527. var type = typeof value;
  4528. return !!value && (type == 'object' || type == 'function');
  4529. }
  4530. /**
  4531. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4532. * and has a `typeof` result of "object".
  4533. *
  4534. * @static
  4535. * @memberOf _
  4536. * @since 4.0.0
  4537. * @category Lang
  4538. * @param {*} value The value to check.
  4539. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4540. * @example
  4541. *
  4542. * _.isObjectLike({});
  4543. * // => true
  4544. *
  4545. * _.isObjectLike([1, 2, 3]);
  4546. * // => true
  4547. *
  4548. * _.isObjectLike(_.noop);
  4549. * // => false
  4550. *
  4551. * _.isObjectLike(null);
  4552. * // => false
  4553. */
  4554. function isObjectLike(value) {
  4555. return !!value && typeof value == 'object';
  4556. }
  4557. /**
  4558. * Creates an array of the own enumerable property names of `object`.
  4559. *
  4560. * **Note:** Non-object values are coerced to objects. See the
  4561. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  4562. * for more details.
  4563. *
  4564. * @static
  4565. * @since 0.1.0
  4566. * @memberOf _
  4567. * @category Object
  4568. * @param {Object} object The object to query.
  4569. * @returns {Array} Returns the array of property names.
  4570. * @example
  4571. *
  4572. * function Foo() {
  4573. * this.a = 1;
  4574. * this.b = 2;
  4575. * }
  4576. *
  4577. * Foo.prototype.c = 3;
  4578. *
  4579. * _.keys(new Foo);
  4580. * // => ['a', 'b'] (iteration order is not guaranteed)
  4581. *
  4582. * _.keys('hi');
  4583. * // => ['0', '1']
  4584. */
  4585. function keys(object) {
  4586. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  4587. }
  4588. /**
  4589. * Creates an array of own enumerable string keyed-value pairs for `object`
  4590. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  4591. * entries are returned.
  4592. *
  4593. * @static
  4594. * @memberOf _
  4595. * @since 4.0.0
  4596. * @alias entries
  4597. * @category Object
  4598. * @param {Object} object The object to query.
  4599. * @returns {Array} Returns the key-value pairs.
  4600. * @example
  4601. *
  4602. * function Foo() {
  4603. * this.a = 1;
  4604. * this.b = 2;
  4605. * }
  4606. *
  4607. * Foo.prototype.c = 3;
  4608. *
  4609. * _.toPairs(new Foo);
  4610. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  4611. */
  4612. var toPairs = createToPairs(keys);
  4613. module.exports = toPairs;
  4614. /***/ }),
  4615. /***/ 618:
  4616. /***/ ((module, exports, __webpack_require__) => {
  4617. /* module decorator */ module = __webpack_require__.nmd(module);
  4618. /**
  4619. * lodash (Custom Build) <https://lodash.com/>
  4620. * Build: `lodash modularize exports="npm" -o ./`
  4621. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  4622. * Released under MIT license <https://lodash.com/license>
  4623. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  4624. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  4625. */
  4626. /** Used as the size to enable large array optimizations. */
  4627. var LARGE_ARRAY_SIZE = 200;
  4628. /** Used as the `TypeError` message for "Functions" methods. */
  4629. var FUNC_ERROR_TEXT = 'Expected a function';
  4630. /** Used to stand-in for `undefined` hash values. */
  4631. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4632. /** Used to compose bitmasks for comparison styles. */
  4633. var UNORDERED_COMPARE_FLAG = 1,
  4634. PARTIAL_COMPARE_FLAG = 2;
  4635. /** Used as references for various `Number` constants. */
  4636. var INFINITY = 1 / 0,
  4637. MAX_SAFE_INTEGER = 9007199254740991;
  4638. /** `Object#toString` result references. */
  4639. var argsTag = '[object Arguments]',
  4640. arrayTag = '[object Array]',
  4641. boolTag = '[object Boolean]',
  4642. dateTag = '[object Date]',
  4643. errorTag = '[object Error]',
  4644. funcTag = '[object Function]',
  4645. genTag = '[object GeneratorFunction]',
  4646. mapTag = '[object Map]',
  4647. numberTag = '[object Number]',
  4648. objectTag = '[object Object]',
  4649. promiseTag = '[object Promise]',
  4650. regexpTag = '[object RegExp]',
  4651. setTag = '[object Set]',
  4652. stringTag = '[object String]',
  4653. symbolTag = '[object Symbol]',
  4654. weakMapTag = '[object WeakMap]';
  4655. var arrayBufferTag = '[object ArrayBuffer]',
  4656. dataViewTag = '[object DataView]',
  4657. float32Tag = '[object Float32Array]',
  4658. float64Tag = '[object Float64Array]',
  4659. int8Tag = '[object Int8Array]',
  4660. int16Tag = '[object Int16Array]',
  4661. int32Tag = '[object Int32Array]',
  4662. uint8Tag = '[object Uint8Array]',
  4663. uint8ClampedTag = '[object Uint8ClampedArray]',
  4664. uint16Tag = '[object Uint16Array]',
  4665. uint32Tag = '[object Uint32Array]';
  4666. /** Used to match property names within property paths. */
  4667. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  4668. reIsPlainProp = /^\w*$/,
  4669. reLeadingDot = /^\./,
  4670. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  4671. /**
  4672. * Used to match `RegExp`
  4673. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  4674. */
  4675. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4676. /** Used to match backslashes in property paths. */
  4677. var reEscapeChar = /\\(\\)?/g;
  4678. /** Used to detect host constructors (Safari). */
  4679. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  4680. /** Used to detect unsigned integer values. */
  4681. var reIsUint = /^(?:0|[1-9]\d*)$/;
  4682. /** Used to identify `toStringTag` values of typed arrays. */
  4683. var typedArrayTags = {};
  4684. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  4685. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  4686. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  4687. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  4688. typedArrayTags[uint32Tag] = true;
  4689. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  4690. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  4691. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  4692. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  4693. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  4694. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  4695. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  4696. typedArrayTags[weakMapTag] = false;
  4697. /** Detect free variable `global` from Node.js. */
  4698. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  4699. /** Detect free variable `self`. */
  4700. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  4701. /** Used as a reference to the global object. */
  4702. var root = freeGlobal || freeSelf || Function('return this')();
  4703. /** Detect free variable `exports`. */
  4704. var freeExports = true && exports && !exports.nodeType && exports;
  4705. /** Detect free variable `module`. */
  4706. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  4707. /** Detect the popular CommonJS extension `module.exports`. */
  4708. var moduleExports = freeModule && freeModule.exports === freeExports;
  4709. /** Detect free variable `process` from Node.js. */
  4710. var freeProcess = moduleExports && freeGlobal.process;
  4711. /** Used to access faster Node.js helpers. */
  4712. var nodeUtil = (function() {
  4713. try {
  4714. return freeProcess && freeProcess.binding('util');
  4715. } catch (e) {}
  4716. }());
  4717. /* Node.js helper references. */
  4718. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  4719. /**
  4720. * A specialized version of `_.includes` for arrays without support for
  4721. * specifying an index to search from.
  4722. *
  4723. * @private
  4724. * @param {Array} [array] The array to inspect.
  4725. * @param {*} target The value to search for.
  4726. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  4727. */
  4728. function arrayIncludes(array, value) {
  4729. var length = array ? array.length : 0;
  4730. return !!length && baseIndexOf(array, value, 0) > -1;
  4731. }
  4732. /**
  4733. * This function is like `arrayIncludes` except that it accepts a comparator.
  4734. *
  4735. * @private
  4736. * @param {Array} [array] The array to inspect.
  4737. * @param {*} target The value to search for.
  4738. * @param {Function} comparator The comparator invoked per element.
  4739. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  4740. */
  4741. function arrayIncludesWith(array, value, comparator) {
  4742. var index = -1,
  4743. length = array ? array.length : 0;
  4744. while (++index < length) {
  4745. if (comparator(value, array[index])) {
  4746. return true;
  4747. }
  4748. }
  4749. return false;
  4750. }
  4751. /**
  4752. * A specialized version of `_.some` for arrays without support for iteratee
  4753. * shorthands.
  4754. *
  4755. * @private
  4756. * @param {Array} [array] The array to iterate over.
  4757. * @param {Function} predicate The function invoked per iteration.
  4758. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4759. * else `false`.
  4760. */
  4761. function arraySome(array, predicate) {
  4762. var index = -1,
  4763. length = array ? array.length : 0;
  4764. while (++index < length) {
  4765. if (predicate(array[index], index, array)) {
  4766. return true;
  4767. }
  4768. }
  4769. return false;
  4770. }
  4771. /**
  4772. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  4773. * support for iteratee shorthands.
  4774. *
  4775. * @private
  4776. * @param {Array} array The array to inspect.
  4777. * @param {Function} predicate The function invoked per iteration.
  4778. * @param {number} fromIndex The index to search from.
  4779. * @param {boolean} [fromRight] Specify iterating from right to left.
  4780. * @returns {number} Returns the index of the matched value, else `-1`.
  4781. */
  4782. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  4783. var length = array.length,
  4784. index = fromIndex + (fromRight ? 1 : -1);
  4785. while ((fromRight ? index-- : ++index < length)) {
  4786. if (predicate(array[index], index, array)) {
  4787. return index;
  4788. }
  4789. }
  4790. return -1;
  4791. }
  4792. /**
  4793. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  4794. *
  4795. * @private
  4796. * @param {Array} array The array to inspect.
  4797. * @param {*} value The value to search for.
  4798. * @param {number} fromIndex The index to search from.
  4799. * @returns {number} Returns the index of the matched value, else `-1`.
  4800. */
  4801. function baseIndexOf(array, value, fromIndex) {
  4802. if (value !== value) {
  4803. return baseFindIndex(array, baseIsNaN, fromIndex);
  4804. }
  4805. var index = fromIndex - 1,
  4806. length = array.length;
  4807. while (++index < length) {
  4808. if (array[index] === value) {
  4809. return index;
  4810. }
  4811. }
  4812. return -1;
  4813. }
  4814. /**
  4815. * The base implementation of `_.isNaN` without support for number objects.
  4816. *
  4817. * @private
  4818. * @param {*} value The value to check.
  4819. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  4820. */
  4821. function baseIsNaN(value) {
  4822. return value !== value;
  4823. }
  4824. /**
  4825. * The base implementation of `_.property` without support for deep paths.
  4826. *
  4827. * @private
  4828. * @param {string} key The key of the property to get.
  4829. * @returns {Function} Returns the new accessor function.
  4830. */
  4831. function baseProperty(key) {
  4832. return function(object) {
  4833. return object == null ? undefined : object[key];
  4834. };
  4835. }
  4836. /**
  4837. * The base implementation of `_.times` without support for iteratee shorthands
  4838. * or max array length checks.
  4839. *
  4840. * @private
  4841. * @param {number} n The number of times to invoke `iteratee`.
  4842. * @param {Function} iteratee The function invoked per iteration.
  4843. * @returns {Array} Returns the array of results.
  4844. */
  4845. function baseTimes(n, iteratee) {
  4846. var index = -1,
  4847. result = Array(n);
  4848. while (++index < n) {
  4849. result[index] = iteratee(index);
  4850. }
  4851. return result;
  4852. }
  4853. /**
  4854. * The base implementation of `_.unary` without support for storing metadata.
  4855. *
  4856. * @private
  4857. * @param {Function} func The function to cap arguments for.
  4858. * @returns {Function} Returns the new capped function.
  4859. */
  4860. function baseUnary(func) {
  4861. return function(value) {
  4862. return func(value);
  4863. };
  4864. }
  4865. /**
  4866. * Checks if a cache value for `key` exists.
  4867. *
  4868. * @private
  4869. * @param {Object} cache The cache to query.
  4870. * @param {string} key The key of the entry to check.
  4871. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4872. */
  4873. function cacheHas(cache, key) {
  4874. return cache.has(key);
  4875. }
  4876. /**
  4877. * Gets the value at `key` of `object`.
  4878. *
  4879. * @private
  4880. * @param {Object} [object] The object to query.
  4881. * @param {string} key The key of the property to get.
  4882. * @returns {*} Returns the property value.
  4883. */
  4884. function getValue(object, key) {
  4885. return object == null ? undefined : object[key];
  4886. }
  4887. /**
  4888. * Checks if `value` is a host object in IE < 9.
  4889. *
  4890. * @private
  4891. * @param {*} value The value to check.
  4892. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  4893. */
  4894. function isHostObject(value) {
  4895. // Many host objects are `Object` objects that can coerce to strings
  4896. // despite having improperly defined `toString` methods.
  4897. var result = false;
  4898. if (value != null && typeof value.toString != 'function') {
  4899. try {
  4900. result = !!(value + '');
  4901. } catch (e) {}
  4902. }
  4903. return result;
  4904. }
  4905. /**
  4906. * Converts `map` to its key-value pairs.
  4907. *
  4908. * @private
  4909. * @param {Object} map The map to convert.
  4910. * @returns {Array} Returns the key-value pairs.
  4911. */
  4912. function mapToArray(map) {
  4913. var index = -1,
  4914. result = Array(map.size);
  4915. map.forEach(function(value, key) {
  4916. result[++index] = [key, value];
  4917. });
  4918. return result;
  4919. }
  4920. /**
  4921. * Creates a unary function that invokes `func` with its argument transformed.
  4922. *
  4923. * @private
  4924. * @param {Function} func The function to wrap.
  4925. * @param {Function} transform The argument transform.
  4926. * @returns {Function} Returns the new function.
  4927. */
  4928. function overArg(func, transform) {
  4929. return function(arg) {
  4930. return func(transform(arg));
  4931. };
  4932. }
  4933. /**
  4934. * Converts `set` to an array of its values.
  4935. *
  4936. * @private
  4937. * @param {Object} set The set to convert.
  4938. * @returns {Array} Returns the values.
  4939. */
  4940. function setToArray(set) {
  4941. var index = -1,
  4942. result = Array(set.size);
  4943. set.forEach(function(value) {
  4944. result[++index] = value;
  4945. });
  4946. return result;
  4947. }
  4948. /** Used for built-in method references. */
  4949. var arrayProto = Array.prototype,
  4950. funcProto = Function.prototype,
  4951. objectProto = Object.prototype;
  4952. /** Used to detect overreaching core-js shims. */
  4953. var coreJsData = root['__core-js_shared__'];
  4954. /** Used to detect methods masquerading as native. */
  4955. var maskSrcKey = (function() {
  4956. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  4957. return uid ? ('Symbol(src)_1.' + uid) : '';
  4958. }());
  4959. /** Used to resolve the decompiled source of functions. */
  4960. var funcToString = funcProto.toString;
  4961. /** Used to check objects for own properties. */
  4962. var hasOwnProperty = objectProto.hasOwnProperty;
  4963. /**
  4964. * Used to resolve the
  4965. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4966. * of values.
  4967. */
  4968. var objectToString = objectProto.toString;
  4969. /** Used to detect if a method is native. */
  4970. var reIsNative = RegExp('^' +
  4971. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  4972. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4973. );
  4974. /** Built-in value references. */
  4975. var Symbol = root.Symbol,
  4976. Uint8Array = root.Uint8Array,
  4977. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  4978. splice = arrayProto.splice;
  4979. /* Built-in method references for those with the same name as other `lodash` methods. */
  4980. var nativeKeys = overArg(Object.keys, Object);
  4981. /* Built-in method references that are verified to be native. */
  4982. var DataView = getNative(root, 'DataView'),
  4983. Map = getNative(root, 'Map'),
  4984. Promise = getNative(root, 'Promise'),
  4985. Set = getNative(root, 'Set'),
  4986. WeakMap = getNative(root, 'WeakMap'),
  4987. nativeCreate = getNative(Object, 'create');
  4988. /** Used to detect maps, sets, and weakmaps. */
  4989. var dataViewCtorString = toSource(DataView),
  4990. mapCtorString = toSource(Map),
  4991. promiseCtorString = toSource(Promise),
  4992. setCtorString = toSource(Set),
  4993. weakMapCtorString = toSource(WeakMap);
  4994. /** Used to convert symbols to primitives and strings. */
  4995. var symbolProto = Symbol ? Symbol.prototype : undefined,
  4996. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  4997. symbolToString = symbolProto ? symbolProto.toString : undefined;
  4998. /**
  4999. * Creates a hash object.
  5000. *
  5001. * @private
  5002. * @constructor
  5003. * @param {Array} [entries] The key-value pairs to cache.
  5004. */
  5005. function Hash(entries) {
  5006. var index = -1,
  5007. length = entries ? entries.length : 0;
  5008. this.clear();
  5009. while (++index < length) {
  5010. var entry = entries[index];
  5011. this.set(entry[0], entry[1]);
  5012. }
  5013. }
  5014. /**
  5015. * Removes all key-value entries from the hash.
  5016. *
  5017. * @private
  5018. * @name clear
  5019. * @memberOf Hash
  5020. */
  5021. function hashClear() {
  5022. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  5023. }
  5024. /**
  5025. * Removes `key` and its value from the hash.
  5026. *
  5027. * @private
  5028. * @name delete
  5029. * @memberOf Hash
  5030. * @param {Object} hash The hash to modify.
  5031. * @param {string} key The key of the value to remove.
  5032. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  5033. */
  5034. function hashDelete(key) {
  5035. return this.has(key) && delete this.__data__[key];
  5036. }
  5037. /**
  5038. * Gets the hash value for `key`.
  5039. *
  5040. * @private
  5041. * @name get
  5042. * @memberOf Hash
  5043. * @param {string} key The key of the value to get.
  5044. * @returns {*} Returns the entry value.
  5045. */
  5046. function hashGet(key) {
  5047. var data = this.__data__;
  5048. if (nativeCreate) {
  5049. var result = data[key];
  5050. return result === HASH_UNDEFINED ? undefined : result;
  5051. }
  5052. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  5053. }
  5054. /**
  5055. * Checks if a hash value for `key` exists.
  5056. *
  5057. * @private
  5058. * @name has
  5059. * @memberOf Hash
  5060. * @param {string} key The key of the entry to check.
  5061. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  5062. */
  5063. function hashHas(key) {
  5064. var data = this.__data__;
  5065. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  5066. }
  5067. /**
  5068. * Sets the hash `key` to `value`.
  5069. *
  5070. * @private
  5071. * @name set
  5072. * @memberOf Hash
  5073. * @param {string} key The key of the value to set.
  5074. * @param {*} value The value to set.
  5075. * @returns {Object} Returns the hash instance.
  5076. */
  5077. function hashSet(key, value) {
  5078. var data = this.__data__;
  5079. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  5080. return this;
  5081. }
  5082. // Add methods to `Hash`.
  5083. Hash.prototype.clear = hashClear;
  5084. Hash.prototype['delete'] = hashDelete;
  5085. Hash.prototype.get = hashGet;
  5086. Hash.prototype.has = hashHas;
  5087. Hash.prototype.set = hashSet;
  5088. /**
  5089. * Creates an list cache object.
  5090. *
  5091. * @private
  5092. * @constructor
  5093. * @param {Array} [entries] The key-value pairs to cache.
  5094. */
  5095. function ListCache(entries) {
  5096. var index = -1,
  5097. length = entries ? entries.length : 0;
  5098. this.clear();
  5099. while (++index < length) {
  5100. var entry = entries[index];
  5101. this.set(entry[0], entry[1]);
  5102. }
  5103. }
  5104. /**
  5105. * Removes all key-value entries from the list cache.
  5106. *
  5107. * @private
  5108. * @name clear
  5109. * @memberOf ListCache
  5110. */
  5111. function listCacheClear() {
  5112. this.__data__ = [];
  5113. }
  5114. /**
  5115. * Removes `key` and its value from the list cache.
  5116. *
  5117. * @private
  5118. * @name delete
  5119. * @memberOf ListCache
  5120. * @param {string} key The key of the value to remove.
  5121. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  5122. */
  5123. function listCacheDelete(key) {
  5124. var data = this.__data__,
  5125. index = assocIndexOf(data, key);
  5126. if (index < 0) {
  5127. return false;
  5128. }
  5129. var lastIndex = data.length - 1;
  5130. if (index == lastIndex) {
  5131. data.pop();
  5132. } else {
  5133. splice.call(data, index, 1);
  5134. }
  5135. return true;
  5136. }
  5137. /**
  5138. * Gets the list cache value for `key`.
  5139. *
  5140. * @private
  5141. * @name get
  5142. * @memberOf ListCache
  5143. * @param {string} key The key of the value to get.
  5144. * @returns {*} Returns the entry value.
  5145. */
  5146. function listCacheGet(key) {
  5147. var data = this.__data__,
  5148. index = assocIndexOf(data, key);
  5149. return index < 0 ? undefined : data[index][1];
  5150. }
  5151. /**
  5152. * Checks if a list cache value for `key` exists.
  5153. *
  5154. * @private
  5155. * @name has
  5156. * @memberOf ListCache
  5157. * @param {string} key The key of the entry to check.
  5158. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  5159. */
  5160. function listCacheHas(key) {
  5161. return assocIndexOf(this.__data__, key) > -1;
  5162. }
  5163. /**
  5164. * Sets the list cache `key` to `value`.
  5165. *
  5166. * @private
  5167. * @name set
  5168. * @memberOf ListCache
  5169. * @param {string} key The key of the value to set.
  5170. * @param {*} value The value to set.
  5171. * @returns {Object} Returns the list cache instance.
  5172. */
  5173. function listCacheSet(key, value) {
  5174. var data = this.__data__,
  5175. index = assocIndexOf(data, key);
  5176. if (index < 0) {
  5177. data.push([key, value]);
  5178. } else {
  5179. data[index][1] = value;
  5180. }
  5181. return this;
  5182. }
  5183. // Add methods to `ListCache`.
  5184. ListCache.prototype.clear = listCacheClear;
  5185. ListCache.prototype['delete'] = listCacheDelete;
  5186. ListCache.prototype.get = listCacheGet;
  5187. ListCache.prototype.has = listCacheHas;
  5188. ListCache.prototype.set = listCacheSet;
  5189. /**
  5190. * Creates a map cache object to store key-value pairs.
  5191. *
  5192. * @private
  5193. * @constructor
  5194. * @param {Array} [entries] The key-value pairs to cache.
  5195. */
  5196. function MapCache(entries) {
  5197. var index = -1,
  5198. length = entries ? entries.length : 0;
  5199. this.clear();
  5200. while (++index < length) {
  5201. var entry = entries[index];
  5202. this.set(entry[0], entry[1]);
  5203. }
  5204. }
  5205. /**
  5206. * Removes all key-value entries from the map.
  5207. *
  5208. * @private
  5209. * @name clear
  5210. * @memberOf MapCache
  5211. */
  5212. function mapCacheClear() {
  5213. this.__data__ = {
  5214. 'hash': new Hash,
  5215. 'map': new (Map || ListCache),
  5216. 'string': new Hash
  5217. };
  5218. }
  5219. /**
  5220. * Removes `key` and its value from the map.
  5221. *
  5222. * @private
  5223. * @name delete
  5224. * @memberOf MapCache
  5225. * @param {string} key The key of the value to remove.
  5226. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  5227. */
  5228. function mapCacheDelete(key) {
  5229. return getMapData(this, key)['delete'](key);
  5230. }
  5231. /**
  5232. * Gets the map value for `key`.
  5233. *
  5234. * @private
  5235. * @name get
  5236. * @memberOf MapCache
  5237. * @param {string} key The key of the value to get.
  5238. * @returns {*} Returns the entry value.
  5239. */
  5240. function mapCacheGet(key) {
  5241. return getMapData(this, key).get(key);
  5242. }
  5243. /**
  5244. * Checks if a map value for `key` exists.
  5245. *
  5246. * @private
  5247. * @name has
  5248. * @memberOf MapCache
  5249. * @param {string} key The key of the entry to check.
  5250. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  5251. */
  5252. function mapCacheHas(key) {
  5253. return getMapData(this, key).has(key);
  5254. }
  5255. /**
  5256. * Sets the map `key` to `value`.
  5257. *
  5258. * @private
  5259. * @name set
  5260. * @memberOf MapCache
  5261. * @param {string} key The key of the value to set.
  5262. * @param {*} value The value to set.
  5263. * @returns {Object} Returns the map cache instance.
  5264. */
  5265. function mapCacheSet(key, value) {
  5266. getMapData(this, key).set(key, value);
  5267. return this;
  5268. }
  5269. // Add methods to `MapCache`.
  5270. MapCache.prototype.clear = mapCacheClear;
  5271. MapCache.prototype['delete'] = mapCacheDelete;
  5272. MapCache.prototype.get = mapCacheGet;
  5273. MapCache.prototype.has = mapCacheHas;
  5274. MapCache.prototype.set = mapCacheSet;
  5275. /**
  5276. *
  5277. * Creates an array cache object to store unique values.
  5278. *
  5279. * @private
  5280. * @constructor
  5281. * @param {Array} [values] The values to cache.
  5282. */
  5283. function SetCache(values) {
  5284. var index = -1,
  5285. length = values ? values.length : 0;
  5286. this.__data__ = new MapCache;
  5287. while (++index < length) {
  5288. this.add(values[index]);
  5289. }
  5290. }
  5291. /**
  5292. * Adds `value` to the array cache.
  5293. *
  5294. * @private
  5295. * @name add
  5296. * @memberOf SetCache
  5297. * @alias push
  5298. * @param {*} value The value to cache.
  5299. * @returns {Object} Returns the cache instance.
  5300. */
  5301. function setCacheAdd(value) {
  5302. this.__data__.set(value, HASH_UNDEFINED);
  5303. return this;
  5304. }
  5305. /**
  5306. * Checks if `value` is in the array cache.
  5307. *
  5308. * @private
  5309. * @name has
  5310. * @memberOf SetCache
  5311. * @param {*} value The value to search for.
  5312. * @returns {number} Returns `true` if `value` is found, else `false`.
  5313. */
  5314. function setCacheHas(value) {
  5315. return this.__data__.has(value);
  5316. }
  5317. // Add methods to `SetCache`.
  5318. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  5319. SetCache.prototype.has = setCacheHas;
  5320. /**
  5321. * Creates a stack cache object to store key-value pairs.
  5322. *
  5323. * @private
  5324. * @constructor
  5325. * @param {Array} [entries] The key-value pairs to cache.
  5326. */
  5327. function Stack(entries) {
  5328. this.__data__ = new ListCache(entries);
  5329. }
  5330. /**
  5331. * Removes all key-value entries from the stack.
  5332. *
  5333. * @private
  5334. * @name clear
  5335. * @memberOf Stack
  5336. */
  5337. function stackClear() {
  5338. this.__data__ = new ListCache;
  5339. }
  5340. /**
  5341. * Removes `key` and its value from the stack.
  5342. *
  5343. * @private
  5344. * @name delete
  5345. * @memberOf Stack
  5346. * @param {string} key The key of the value to remove.
  5347. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  5348. */
  5349. function stackDelete(key) {
  5350. return this.__data__['delete'](key);
  5351. }
  5352. /**
  5353. * Gets the stack value for `key`.
  5354. *
  5355. * @private
  5356. * @name get
  5357. * @memberOf Stack
  5358. * @param {string} key The key of the value to get.
  5359. * @returns {*} Returns the entry value.
  5360. */
  5361. function stackGet(key) {
  5362. return this.__data__.get(key);
  5363. }
  5364. /**
  5365. * Checks if a stack value for `key` exists.
  5366. *
  5367. * @private
  5368. * @name has
  5369. * @memberOf Stack
  5370. * @param {string} key The key of the entry to check.
  5371. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  5372. */
  5373. function stackHas(key) {
  5374. return this.__data__.has(key);
  5375. }
  5376. /**
  5377. * Sets the stack `key` to `value`.
  5378. *
  5379. * @private
  5380. * @name set
  5381. * @memberOf Stack
  5382. * @param {string} key The key of the value to set.
  5383. * @param {*} value The value to set.
  5384. * @returns {Object} Returns the stack cache instance.
  5385. */
  5386. function stackSet(key, value) {
  5387. var cache = this.__data__;
  5388. if (cache instanceof ListCache) {
  5389. var pairs = cache.__data__;
  5390. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  5391. pairs.push([key, value]);
  5392. return this;
  5393. }
  5394. cache = this.__data__ = new MapCache(pairs);
  5395. }
  5396. cache.set(key, value);
  5397. return this;
  5398. }
  5399. // Add methods to `Stack`.
  5400. Stack.prototype.clear = stackClear;
  5401. Stack.prototype['delete'] = stackDelete;
  5402. Stack.prototype.get = stackGet;
  5403. Stack.prototype.has = stackHas;
  5404. Stack.prototype.set = stackSet;
  5405. /**
  5406. * Creates an array of the enumerable property names of the array-like `value`.
  5407. *
  5408. * @private
  5409. * @param {*} value The value to query.
  5410. * @param {boolean} inherited Specify returning inherited property names.
  5411. * @returns {Array} Returns the array of property names.
  5412. */
  5413. function arrayLikeKeys(value, inherited) {
  5414. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  5415. // Safari 9 makes `arguments.length` enumerable in strict mode.
  5416. var result = (isArray(value) || isArguments(value))
  5417. ? baseTimes(value.length, String)
  5418. : [];
  5419. var length = result.length,
  5420. skipIndexes = !!length;
  5421. for (var key in value) {
  5422. if ((inherited || hasOwnProperty.call(value, key)) &&
  5423. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  5424. result.push(key);
  5425. }
  5426. }
  5427. return result;
  5428. }
  5429. /**
  5430. * Gets the index at which the `key` is found in `array` of key-value pairs.
  5431. *
  5432. * @private
  5433. * @param {Array} array The array to inspect.
  5434. * @param {*} key The key to search for.
  5435. * @returns {number} Returns the index of the matched value, else `-1`.
  5436. */
  5437. function assocIndexOf(array, key) {
  5438. var length = array.length;
  5439. while (length--) {
  5440. if (eq(array[length][0], key)) {
  5441. return length;
  5442. }
  5443. }
  5444. return -1;
  5445. }
  5446. /**
  5447. * The base implementation of `_.get` without support for default values.
  5448. *
  5449. * @private
  5450. * @param {Object} object The object to query.
  5451. * @param {Array|string} path The path of the property to get.
  5452. * @returns {*} Returns the resolved value.
  5453. */
  5454. function baseGet(object, path) {
  5455. path = isKey(path, object) ? [path] : castPath(path);
  5456. var index = 0,
  5457. length = path.length;
  5458. while (object != null && index < length) {
  5459. object = object[toKey(path[index++])];
  5460. }
  5461. return (index && index == length) ? object : undefined;
  5462. }
  5463. /**
  5464. * The base implementation of `getTag`.
  5465. *
  5466. * @private
  5467. * @param {*} value The value to query.
  5468. * @returns {string} Returns the `toStringTag`.
  5469. */
  5470. function baseGetTag(value) {
  5471. return objectToString.call(value);
  5472. }
  5473. /**
  5474. * The base implementation of `_.hasIn` without support for deep paths.
  5475. *
  5476. * @private
  5477. * @param {Object} [object] The object to query.
  5478. * @param {Array|string} key The key to check.
  5479. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  5480. */
  5481. function baseHasIn(object, key) {
  5482. return object != null && key in Object(object);
  5483. }
  5484. /**
  5485. * The base implementation of `_.isEqual` which supports partial comparisons
  5486. * and tracks traversed objects.
  5487. *
  5488. * @private
  5489. * @param {*} value The value to compare.
  5490. * @param {*} other The other value to compare.
  5491. * @param {Function} [customizer] The function to customize comparisons.
  5492. * @param {boolean} [bitmask] The bitmask of comparison flags.
  5493. * The bitmask may be composed of the following flags:
  5494. * 1 - Unordered comparison
  5495. * 2 - Partial comparison
  5496. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  5497. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5498. */
  5499. function baseIsEqual(value, other, customizer, bitmask, stack) {
  5500. if (value === other) {
  5501. return true;
  5502. }
  5503. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  5504. return value !== value && other !== other;
  5505. }
  5506. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  5507. }
  5508. /**
  5509. * A specialized version of `baseIsEqual` for arrays and objects which performs
  5510. * deep comparisons and tracks traversed objects enabling objects with circular
  5511. * references to be compared.
  5512. *
  5513. * @private
  5514. * @param {Object} object The object to compare.
  5515. * @param {Object} other The other object to compare.
  5516. * @param {Function} equalFunc The function to determine equivalents of values.
  5517. * @param {Function} [customizer] The function to customize comparisons.
  5518. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  5519. * for more details.
  5520. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  5521. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5522. */
  5523. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  5524. var objIsArr = isArray(object),
  5525. othIsArr = isArray(other),
  5526. objTag = arrayTag,
  5527. othTag = arrayTag;
  5528. if (!objIsArr) {
  5529. objTag = getTag(object);
  5530. objTag = objTag == argsTag ? objectTag : objTag;
  5531. }
  5532. if (!othIsArr) {
  5533. othTag = getTag(other);
  5534. othTag = othTag == argsTag ? objectTag : othTag;
  5535. }
  5536. var objIsObj = objTag == objectTag && !isHostObject(object),
  5537. othIsObj = othTag == objectTag && !isHostObject(other),
  5538. isSameTag = objTag == othTag;
  5539. if (isSameTag && !objIsObj) {
  5540. stack || (stack = new Stack);
  5541. return (objIsArr || isTypedArray(object))
  5542. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  5543. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  5544. }
  5545. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  5546. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  5547. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  5548. if (objIsWrapped || othIsWrapped) {
  5549. var objUnwrapped = objIsWrapped ? object.value() : object,
  5550. othUnwrapped = othIsWrapped ? other.value() : other;
  5551. stack || (stack = new Stack);
  5552. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  5553. }
  5554. }
  5555. if (!isSameTag) {
  5556. return false;
  5557. }
  5558. stack || (stack = new Stack);
  5559. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  5560. }
  5561. /**
  5562. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  5563. *
  5564. * @private
  5565. * @param {Object} object The object to inspect.
  5566. * @param {Object} source The object of property values to match.
  5567. * @param {Array} matchData The property names, values, and compare flags to match.
  5568. * @param {Function} [customizer] The function to customize comparisons.
  5569. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  5570. */
  5571. function baseIsMatch(object, source, matchData, customizer) {
  5572. var index = matchData.length,
  5573. length = index,
  5574. noCustomizer = !customizer;
  5575. if (object == null) {
  5576. return !length;
  5577. }
  5578. object = Object(object);
  5579. while (index--) {
  5580. var data = matchData[index];
  5581. if ((noCustomizer && data[2])
  5582. ? data[1] !== object[data[0]]
  5583. : !(data[0] in object)
  5584. ) {
  5585. return false;
  5586. }
  5587. }
  5588. while (++index < length) {
  5589. data = matchData[index];
  5590. var key = data[0],
  5591. objValue = object[key],
  5592. srcValue = data[1];
  5593. if (noCustomizer && data[2]) {
  5594. if (objValue === undefined && !(key in object)) {
  5595. return false;
  5596. }
  5597. } else {
  5598. var stack = new Stack;
  5599. if (customizer) {
  5600. var result = customizer(objValue, srcValue, key, object, source, stack);
  5601. }
  5602. if (!(result === undefined
  5603. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  5604. : result
  5605. )) {
  5606. return false;
  5607. }
  5608. }
  5609. }
  5610. return true;
  5611. }
  5612. /**
  5613. * The base implementation of `_.isNative` without bad shim checks.
  5614. *
  5615. * @private
  5616. * @param {*} value The value to check.
  5617. * @returns {boolean} Returns `true` if `value` is a native function,
  5618. * else `false`.
  5619. */
  5620. function baseIsNative(value) {
  5621. if (!isObject(value) || isMasked(value)) {
  5622. return false;
  5623. }
  5624. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  5625. return pattern.test(toSource(value));
  5626. }
  5627. /**
  5628. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  5629. *
  5630. * @private
  5631. * @param {*} value The value to check.
  5632. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5633. */
  5634. function baseIsTypedArray(value) {
  5635. return isObjectLike(value) &&
  5636. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  5637. }
  5638. /**
  5639. * The base implementation of `_.iteratee`.
  5640. *
  5641. * @private
  5642. * @param {*} [value=_.identity] The value to convert to an iteratee.
  5643. * @returns {Function} Returns the iteratee.
  5644. */
  5645. function baseIteratee(value) {
  5646. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  5647. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  5648. if (typeof value == 'function') {
  5649. return value;
  5650. }
  5651. if (value == null) {
  5652. return identity;
  5653. }
  5654. if (typeof value == 'object') {
  5655. return isArray(value)
  5656. ? baseMatchesProperty(value[0], value[1])
  5657. : baseMatches(value);
  5658. }
  5659. return property(value);
  5660. }
  5661. /**
  5662. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  5663. *
  5664. * @private
  5665. * @param {Object} object The object to query.
  5666. * @returns {Array} Returns the array of property names.
  5667. */
  5668. function baseKeys(object) {
  5669. if (!isPrototype(object)) {
  5670. return nativeKeys(object);
  5671. }
  5672. var result = [];
  5673. for (var key in Object(object)) {
  5674. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  5675. result.push(key);
  5676. }
  5677. }
  5678. return result;
  5679. }
  5680. /**
  5681. * The base implementation of `_.matches` which doesn't clone `source`.
  5682. *
  5683. * @private
  5684. * @param {Object} source The object of property values to match.
  5685. * @returns {Function} Returns the new spec function.
  5686. */
  5687. function baseMatches(source) {
  5688. var matchData = getMatchData(source);
  5689. if (matchData.length == 1 && matchData[0][2]) {
  5690. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  5691. }
  5692. return function(object) {
  5693. return object === source || baseIsMatch(object, source, matchData);
  5694. };
  5695. }
  5696. /**
  5697. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  5698. *
  5699. * @private
  5700. * @param {string} path The path of the property to get.
  5701. * @param {*} srcValue The value to match.
  5702. * @returns {Function} Returns the new spec function.
  5703. */
  5704. function baseMatchesProperty(path, srcValue) {
  5705. if (isKey(path) && isStrictComparable(srcValue)) {
  5706. return matchesStrictComparable(toKey(path), srcValue);
  5707. }
  5708. return function(object) {
  5709. var objValue = get(object, path);
  5710. return (objValue === undefined && objValue === srcValue)
  5711. ? hasIn(object, path)
  5712. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  5713. };
  5714. }
  5715. /**
  5716. * A specialized version of `baseProperty` which supports deep paths.
  5717. *
  5718. * @private
  5719. * @param {Array|string} path The path of the property to get.
  5720. * @returns {Function} Returns the new accessor function.
  5721. */
  5722. function basePropertyDeep(path) {
  5723. return function(object) {
  5724. return baseGet(object, path);
  5725. };
  5726. }
  5727. /**
  5728. * The base implementation of `_.toString` which doesn't convert nullish
  5729. * values to empty strings.
  5730. *
  5731. * @private
  5732. * @param {*} value The value to process.
  5733. * @returns {string} Returns the string.
  5734. */
  5735. function baseToString(value) {
  5736. // Exit early for strings to avoid a performance hit in some environments.
  5737. if (typeof value == 'string') {
  5738. return value;
  5739. }
  5740. if (isSymbol(value)) {
  5741. return symbolToString ? symbolToString.call(value) : '';
  5742. }
  5743. var result = (value + '');
  5744. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5745. }
  5746. /**
  5747. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5748. *
  5749. * @private
  5750. * @param {Array} array The array to inspect.
  5751. * @param {Function} [iteratee] The iteratee invoked per element.
  5752. * @param {Function} [comparator] The comparator invoked per element.
  5753. * @returns {Array} Returns the new duplicate free array.
  5754. */
  5755. function baseUniq(array, iteratee, comparator) {
  5756. var index = -1,
  5757. includes = arrayIncludes,
  5758. length = array.length,
  5759. isCommon = true,
  5760. result = [],
  5761. seen = result;
  5762. if (comparator) {
  5763. isCommon = false;
  5764. includes = arrayIncludesWith;
  5765. }
  5766. else if (length >= LARGE_ARRAY_SIZE) {
  5767. var set = iteratee ? null : createSet(array);
  5768. if (set) {
  5769. return setToArray(set);
  5770. }
  5771. isCommon = false;
  5772. includes = cacheHas;
  5773. seen = new SetCache;
  5774. }
  5775. else {
  5776. seen = iteratee ? [] : result;
  5777. }
  5778. outer:
  5779. while (++index < length) {
  5780. var value = array[index],
  5781. computed = iteratee ? iteratee(value) : value;
  5782. value = (comparator || value !== 0) ? value : 0;
  5783. if (isCommon && computed === computed) {
  5784. var seenIndex = seen.length;
  5785. while (seenIndex--) {
  5786. if (seen[seenIndex] === computed) {
  5787. continue outer;
  5788. }
  5789. }
  5790. if (iteratee) {
  5791. seen.push(computed);
  5792. }
  5793. result.push(value);
  5794. }
  5795. else if (!includes(seen, computed, comparator)) {
  5796. if (seen !== result) {
  5797. seen.push(computed);
  5798. }
  5799. result.push(value);
  5800. }
  5801. }
  5802. return result;
  5803. }
  5804. /**
  5805. * Casts `value` to a path array if it's not one.
  5806. *
  5807. * @private
  5808. * @param {*} value The value to inspect.
  5809. * @returns {Array} Returns the cast property path array.
  5810. */
  5811. function castPath(value) {
  5812. return isArray(value) ? value : stringToPath(value);
  5813. }
  5814. /**
  5815. * Creates a set object of `values`.
  5816. *
  5817. * @private
  5818. * @param {Array} values The values to add to the set.
  5819. * @returns {Object} Returns the new set.
  5820. */
  5821. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5822. return new Set(values);
  5823. };
  5824. /**
  5825. * A specialized version of `baseIsEqualDeep` for arrays with support for
  5826. * partial deep comparisons.
  5827. *
  5828. * @private
  5829. * @param {Array} array The array to compare.
  5830. * @param {Array} other The other array to compare.
  5831. * @param {Function} equalFunc The function to determine equivalents of values.
  5832. * @param {Function} customizer The function to customize comparisons.
  5833. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5834. * for more details.
  5835. * @param {Object} stack Tracks traversed `array` and `other` objects.
  5836. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  5837. */
  5838. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  5839. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5840. arrLength = array.length,
  5841. othLength = other.length;
  5842. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  5843. return false;
  5844. }
  5845. // Assume cyclic values are equal.
  5846. var stacked = stack.get(array);
  5847. if (stacked && stack.get(other)) {
  5848. return stacked == other;
  5849. }
  5850. var index = -1,
  5851. result = true,
  5852. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  5853. stack.set(array, other);
  5854. stack.set(other, array);
  5855. // Ignore non-index properties.
  5856. while (++index < arrLength) {
  5857. var arrValue = array[index],
  5858. othValue = other[index];
  5859. if (customizer) {
  5860. var compared = isPartial
  5861. ? customizer(othValue, arrValue, index, other, array, stack)
  5862. : customizer(arrValue, othValue, index, array, other, stack);
  5863. }
  5864. if (compared !== undefined) {
  5865. if (compared) {
  5866. continue;
  5867. }
  5868. result = false;
  5869. break;
  5870. }
  5871. // Recursively compare arrays (susceptible to call stack limits).
  5872. if (seen) {
  5873. if (!arraySome(other, function(othValue, othIndex) {
  5874. if (!seen.has(othIndex) &&
  5875. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  5876. return seen.add(othIndex);
  5877. }
  5878. })) {
  5879. result = false;
  5880. break;
  5881. }
  5882. } else if (!(
  5883. arrValue === othValue ||
  5884. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  5885. )) {
  5886. result = false;
  5887. break;
  5888. }
  5889. }
  5890. stack['delete'](array);
  5891. stack['delete'](other);
  5892. return result;
  5893. }
  5894. /**
  5895. * A specialized version of `baseIsEqualDeep` for comparing objects of
  5896. * the same `toStringTag`.
  5897. *
  5898. * **Note:** This function only supports comparing values with tags of
  5899. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5900. *
  5901. * @private
  5902. * @param {Object} object The object to compare.
  5903. * @param {Object} other The other object to compare.
  5904. * @param {string} tag The `toStringTag` of the objects to compare.
  5905. * @param {Function} equalFunc The function to determine equivalents of values.
  5906. * @param {Function} customizer The function to customize comparisons.
  5907. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5908. * for more details.
  5909. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5910. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5911. */
  5912. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  5913. switch (tag) {
  5914. case dataViewTag:
  5915. if ((object.byteLength != other.byteLength) ||
  5916. (object.byteOffset != other.byteOffset)) {
  5917. return false;
  5918. }
  5919. object = object.buffer;
  5920. other = other.buffer;
  5921. case arrayBufferTag:
  5922. if ((object.byteLength != other.byteLength) ||
  5923. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  5924. return false;
  5925. }
  5926. return true;
  5927. case boolTag:
  5928. case dateTag:
  5929. case numberTag:
  5930. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5931. // Invalid dates are coerced to `NaN`.
  5932. return eq(+object, +other);
  5933. case errorTag:
  5934. return object.name == other.name && object.message == other.message;
  5935. case regexpTag:
  5936. case stringTag:
  5937. // Coerce regexes to strings and treat strings, primitives and objects,
  5938. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5939. // for more details.
  5940. return object == (other + '');
  5941. case mapTag:
  5942. var convert = mapToArray;
  5943. case setTag:
  5944. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  5945. convert || (convert = setToArray);
  5946. if (object.size != other.size && !isPartial) {
  5947. return false;
  5948. }
  5949. // Assume cyclic values are equal.
  5950. var stacked = stack.get(object);
  5951. if (stacked) {
  5952. return stacked == other;
  5953. }
  5954. bitmask |= UNORDERED_COMPARE_FLAG;
  5955. // Recursively compare objects (susceptible to call stack limits).
  5956. stack.set(object, other);
  5957. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  5958. stack['delete'](object);
  5959. return result;
  5960. case symbolTag:
  5961. if (symbolValueOf) {
  5962. return symbolValueOf.call(object) == symbolValueOf.call(other);
  5963. }
  5964. }
  5965. return false;
  5966. }
  5967. /**
  5968. * A specialized version of `baseIsEqualDeep` for objects with support for
  5969. * partial deep comparisons.
  5970. *
  5971. * @private
  5972. * @param {Object} object The object to compare.
  5973. * @param {Object} other The other object to compare.
  5974. * @param {Function} equalFunc The function to determine equivalents of values.
  5975. * @param {Function} customizer The function to customize comparisons.
  5976. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5977. * for more details.
  5978. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5979. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5980. */
  5981. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  5982. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5983. objProps = keys(object),
  5984. objLength = objProps.length,
  5985. othProps = keys(other),
  5986. othLength = othProps.length;
  5987. if (objLength != othLength && !isPartial) {
  5988. return false;
  5989. }
  5990. var index = objLength;
  5991. while (index--) {
  5992. var key = objProps[index];
  5993. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  5994. return false;
  5995. }
  5996. }
  5997. // Assume cyclic values are equal.
  5998. var stacked = stack.get(object);
  5999. if (stacked && stack.get(other)) {
  6000. return stacked == other;
  6001. }
  6002. var result = true;
  6003. stack.set(object, other);
  6004. stack.set(other, object);
  6005. var skipCtor = isPartial;
  6006. while (++index < objLength) {
  6007. key = objProps[index];
  6008. var objValue = object[key],
  6009. othValue = other[key];
  6010. if (customizer) {
  6011. var compared = isPartial
  6012. ? customizer(othValue, objValue, key, other, object, stack)
  6013. : customizer(objValue, othValue, key, object, other, stack);
  6014. }
  6015. // Recursively compare objects (susceptible to call stack limits).
  6016. if (!(compared === undefined
  6017. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  6018. : compared
  6019. )) {
  6020. result = false;
  6021. break;
  6022. }
  6023. skipCtor || (skipCtor = key == 'constructor');
  6024. }
  6025. if (result && !skipCtor) {
  6026. var objCtor = object.constructor,
  6027. othCtor = other.constructor;
  6028. // Non `Object` object instances with different constructors are not equal.
  6029. if (objCtor != othCtor &&
  6030. ('constructor' in object && 'constructor' in other) &&
  6031. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6032. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6033. result = false;
  6034. }
  6035. }
  6036. stack['delete'](object);
  6037. stack['delete'](other);
  6038. return result;
  6039. }
  6040. /**
  6041. * Gets the data for `map`.
  6042. *
  6043. * @private
  6044. * @param {Object} map The map to query.
  6045. * @param {string} key The reference key.
  6046. * @returns {*} Returns the map data.
  6047. */
  6048. function getMapData(map, key) {
  6049. var data = map.__data__;
  6050. return isKeyable(key)
  6051. ? data[typeof key == 'string' ? 'string' : 'hash']
  6052. : data.map;
  6053. }
  6054. /**
  6055. * Gets the property names, values, and compare flags of `object`.
  6056. *
  6057. * @private
  6058. * @param {Object} object The object to query.
  6059. * @returns {Array} Returns the match data of `object`.
  6060. */
  6061. function getMatchData(object) {
  6062. var result = keys(object),
  6063. length = result.length;
  6064. while (length--) {
  6065. var key = result[length],
  6066. value = object[key];
  6067. result[length] = [key, value, isStrictComparable(value)];
  6068. }
  6069. return result;
  6070. }
  6071. /**
  6072. * Gets the native function at `key` of `object`.
  6073. *
  6074. * @private
  6075. * @param {Object} object The object to query.
  6076. * @param {string} key The key of the method to get.
  6077. * @returns {*} Returns the function if it's native, else `undefined`.
  6078. */
  6079. function getNative(object, key) {
  6080. var value = getValue(object, key);
  6081. return baseIsNative(value) ? value : undefined;
  6082. }
  6083. /**
  6084. * Gets the `toStringTag` of `value`.
  6085. *
  6086. * @private
  6087. * @param {*} value The value to query.
  6088. * @returns {string} Returns the `toStringTag`.
  6089. */
  6090. var getTag = baseGetTag;
  6091. // Fallback for data views, maps, sets, and weak maps in IE 11,
  6092. // for data views in Edge < 14, and promises in Node.js.
  6093. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6094. (Map && getTag(new Map) != mapTag) ||
  6095. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6096. (Set && getTag(new Set) != setTag) ||
  6097. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6098. getTag = function(value) {
  6099. var result = objectToString.call(value),
  6100. Ctor = result == objectTag ? value.constructor : undefined,
  6101. ctorString = Ctor ? toSource(Ctor) : undefined;
  6102. if (ctorString) {
  6103. switch (ctorString) {
  6104. case dataViewCtorString: return dataViewTag;
  6105. case mapCtorString: return mapTag;
  6106. case promiseCtorString: return promiseTag;
  6107. case setCtorString: return setTag;
  6108. case weakMapCtorString: return weakMapTag;
  6109. }
  6110. }
  6111. return result;
  6112. };
  6113. }
  6114. /**
  6115. * Checks if `path` exists on `object`.
  6116. *
  6117. * @private
  6118. * @param {Object} object The object to query.
  6119. * @param {Array|string} path The path to check.
  6120. * @param {Function} hasFunc The function to check properties.
  6121. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6122. */
  6123. function hasPath(object, path, hasFunc) {
  6124. path = isKey(path, object) ? [path] : castPath(path);
  6125. var result,
  6126. index = -1,
  6127. length = path.length;
  6128. while (++index < length) {
  6129. var key = toKey(path[index]);
  6130. if (!(result = object != null && hasFunc(object, key))) {
  6131. break;
  6132. }
  6133. object = object[key];
  6134. }
  6135. if (result) {
  6136. return result;
  6137. }
  6138. var length = object ? object.length : 0;
  6139. return !!length && isLength(length) && isIndex(key, length) &&
  6140. (isArray(object) || isArguments(object));
  6141. }
  6142. /**
  6143. * Checks if `value` is a valid array-like index.
  6144. *
  6145. * @private
  6146. * @param {*} value The value to check.
  6147. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6148. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6149. */
  6150. function isIndex(value, length) {
  6151. length = length == null ? MAX_SAFE_INTEGER : length;
  6152. return !!length &&
  6153. (typeof value == 'number' || reIsUint.test(value)) &&
  6154. (value > -1 && value % 1 == 0 && value < length);
  6155. }
  6156. /**
  6157. * Checks if `value` is a property name and not a property path.
  6158. *
  6159. * @private
  6160. * @param {*} value The value to check.
  6161. * @param {Object} [object] The object to query keys on.
  6162. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6163. */
  6164. function isKey(value, object) {
  6165. if (isArray(value)) {
  6166. return false;
  6167. }
  6168. var type = typeof value;
  6169. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6170. value == null || isSymbol(value)) {
  6171. return true;
  6172. }
  6173. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6174. (object != null && value in Object(object));
  6175. }
  6176. /**
  6177. * Checks if `value` is suitable for use as unique object key.
  6178. *
  6179. * @private
  6180. * @param {*} value The value to check.
  6181. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6182. */
  6183. function isKeyable(value) {
  6184. var type = typeof value;
  6185. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6186. ? (value !== '__proto__')
  6187. : (value === null);
  6188. }
  6189. /**
  6190. * Checks if `func` has its source masked.
  6191. *
  6192. * @private
  6193. * @param {Function} func The function to check.
  6194. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6195. */
  6196. function isMasked(func) {
  6197. return !!maskSrcKey && (maskSrcKey in func);
  6198. }
  6199. /**
  6200. * Checks if `value` is likely a prototype object.
  6201. *
  6202. * @private
  6203. * @param {*} value The value to check.
  6204. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6205. */
  6206. function isPrototype(value) {
  6207. var Ctor = value && value.constructor,
  6208. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6209. return value === proto;
  6210. }
  6211. /**
  6212. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6213. *
  6214. * @private
  6215. * @param {*} value The value to check.
  6216. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6217. * equality comparisons, else `false`.
  6218. */
  6219. function isStrictComparable(value) {
  6220. return value === value && !isObject(value);
  6221. }
  6222. /**
  6223. * A specialized version of `matchesProperty` for source values suitable
  6224. * for strict equality comparisons, i.e. `===`.
  6225. *
  6226. * @private
  6227. * @param {string} key The key of the property to get.
  6228. * @param {*} srcValue The value to match.
  6229. * @returns {Function} Returns the new spec function.
  6230. */
  6231. function matchesStrictComparable(key, srcValue) {
  6232. return function(object) {
  6233. if (object == null) {
  6234. return false;
  6235. }
  6236. return object[key] === srcValue &&
  6237. (srcValue !== undefined || (key in Object(object)));
  6238. };
  6239. }
  6240. /**
  6241. * Converts `string` to a property path array.
  6242. *
  6243. * @private
  6244. * @param {string} string The string to convert.
  6245. * @returns {Array} Returns the property path array.
  6246. */
  6247. var stringToPath = memoize(function(string) {
  6248. string = toString(string);
  6249. var result = [];
  6250. if (reLeadingDot.test(string)) {
  6251. result.push('');
  6252. }
  6253. string.replace(rePropName, function(match, number, quote, string) {
  6254. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  6255. });
  6256. return result;
  6257. });
  6258. /**
  6259. * Converts `value` to a string key if it's not a string or symbol.
  6260. *
  6261. * @private
  6262. * @param {*} value The value to inspect.
  6263. * @returns {string|symbol} Returns the key.
  6264. */
  6265. function toKey(value) {
  6266. if (typeof value == 'string' || isSymbol(value)) {
  6267. return value;
  6268. }
  6269. var result = (value + '');
  6270. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6271. }
  6272. /**
  6273. * Converts `func` to its source code.
  6274. *
  6275. * @private
  6276. * @param {Function} func The function to process.
  6277. * @returns {string} Returns the source code.
  6278. */
  6279. function toSource(func) {
  6280. if (func != null) {
  6281. try {
  6282. return funcToString.call(func);
  6283. } catch (e) {}
  6284. try {
  6285. return (func + '');
  6286. } catch (e) {}
  6287. }
  6288. return '';
  6289. }
  6290. /**
  6291. * This method is like `_.uniq` except that it accepts `iteratee` which is
  6292. * invoked for each element in `array` to generate the criterion by which
  6293. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  6294. *
  6295. * @static
  6296. * @memberOf _
  6297. * @since 4.0.0
  6298. * @category Array
  6299. * @param {Array} array The array to inspect.
  6300. * @param {Function} [iteratee=_.identity]
  6301. * The iteratee invoked per element.
  6302. * @returns {Array} Returns the new duplicate free array.
  6303. * @example
  6304. *
  6305. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  6306. * // => [2.1, 1.2]
  6307. *
  6308. * // The `_.property` iteratee shorthand.
  6309. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  6310. * // => [{ 'x': 1 }, { 'x': 2 }]
  6311. */
  6312. function uniqBy(array, iteratee) {
  6313. return (array && array.length)
  6314. ? baseUniq(array, baseIteratee(iteratee, 2))
  6315. : [];
  6316. }
  6317. /**
  6318. * Creates a function that memoizes the result of `func`. If `resolver` is
  6319. * provided, it determines the cache key for storing the result based on the
  6320. * arguments provided to the memoized function. By default, the first argument
  6321. * provided to the memoized function is used as the map cache key. The `func`
  6322. * is invoked with the `this` binding of the memoized function.
  6323. *
  6324. * **Note:** The cache is exposed as the `cache` property on the memoized
  6325. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  6326. * constructor with one whose instances implement the
  6327. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  6328. * method interface of `delete`, `get`, `has`, and `set`.
  6329. *
  6330. * @static
  6331. * @memberOf _
  6332. * @since 0.1.0
  6333. * @category Function
  6334. * @param {Function} func The function to have its output memoized.
  6335. * @param {Function} [resolver] The function to resolve the cache key.
  6336. * @returns {Function} Returns the new memoized function.
  6337. * @example
  6338. *
  6339. * var object = { 'a': 1, 'b': 2 };
  6340. * var other = { 'c': 3, 'd': 4 };
  6341. *
  6342. * var values = _.memoize(_.values);
  6343. * values(object);
  6344. * // => [1, 2]
  6345. *
  6346. * values(other);
  6347. * // => [3, 4]
  6348. *
  6349. * object.a = 2;
  6350. * values(object);
  6351. * // => [1, 2]
  6352. *
  6353. * // Modify the result cache.
  6354. * values.cache.set(object, ['a', 'b']);
  6355. * values(object);
  6356. * // => ['a', 'b']
  6357. *
  6358. * // Replace `_.memoize.Cache`.
  6359. * _.memoize.Cache = WeakMap;
  6360. */
  6361. function memoize(func, resolver) {
  6362. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  6363. throw new TypeError(FUNC_ERROR_TEXT);
  6364. }
  6365. var memoized = function() {
  6366. var args = arguments,
  6367. key = resolver ? resolver.apply(this, args) : args[0],
  6368. cache = memoized.cache;
  6369. if (cache.has(key)) {
  6370. return cache.get(key);
  6371. }
  6372. var result = func.apply(this, args);
  6373. memoized.cache = cache.set(key, result);
  6374. return result;
  6375. };
  6376. memoized.cache = new (memoize.Cache || MapCache);
  6377. return memoized;
  6378. }
  6379. // Assign cache to `_.memoize`.
  6380. memoize.Cache = MapCache;
  6381. /**
  6382. * Performs a
  6383. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  6384. * comparison between two values to determine if they are equivalent.
  6385. *
  6386. * @static
  6387. * @memberOf _
  6388. * @since 4.0.0
  6389. * @category Lang
  6390. * @param {*} value The value to compare.
  6391. * @param {*} other The other value to compare.
  6392. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6393. * @example
  6394. *
  6395. * var object = { 'a': 1 };
  6396. * var other = { 'a': 1 };
  6397. *
  6398. * _.eq(object, object);
  6399. * // => true
  6400. *
  6401. * _.eq(object, other);
  6402. * // => false
  6403. *
  6404. * _.eq('a', 'a');
  6405. * // => true
  6406. *
  6407. * _.eq('a', Object('a'));
  6408. * // => false
  6409. *
  6410. * _.eq(NaN, NaN);
  6411. * // => true
  6412. */
  6413. function eq(value, other) {
  6414. return value === other || (value !== value && other !== other);
  6415. }
  6416. /**
  6417. * Checks if `value` is likely an `arguments` object.
  6418. *
  6419. * @static
  6420. * @memberOf _
  6421. * @since 0.1.0
  6422. * @category Lang
  6423. * @param {*} value The value to check.
  6424. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6425. * else `false`.
  6426. * @example
  6427. *
  6428. * _.isArguments(function() { return arguments; }());
  6429. * // => true
  6430. *
  6431. * _.isArguments([1, 2, 3]);
  6432. * // => false
  6433. */
  6434. function isArguments(value) {
  6435. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  6436. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  6437. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  6438. }
  6439. /**
  6440. * Checks if `value` is classified as an `Array` object.
  6441. *
  6442. * @static
  6443. * @memberOf _
  6444. * @since 0.1.0
  6445. * @category Lang
  6446. * @param {*} value The value to check.
  6447. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6448. * @example
  6449. *
  6450. * _.isArray([1, 2, 3]);
  6451. * // => true
  6452. *
  6453. * _.isArray(document.body.children);
  6454. * // => false
  6455. *
  6456. * _.isArray('abc');
  6457. * // => false
  6458. *
  6459. * _.isArray(_.noop);
  6460. * // => false
  6461. */
  6462. var isArray = Array.isArray;
  6463. /**
  6464. * Checks if `value` is array-like. A value is considered array-like if it's
  6465. * not a function and has a `value.length` that's an integer greater than or
  6466. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  6467. *
  6468. * @static
  6469. * @memberOf _
  6470. * @since 4.0.0
  6471. * @category Lang
  6472. * @param {*} value The value to check.
  6473. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  6474. * @example
  6475. *
  6476. * _.isArrayLike([1, 2, 3]);
  6477. * // => true
  6478. *
  6479. * _.isArrayLike(document.body.children);
  6480. * // => true
  6481. *
  6482. * _.isArrayLike('abc');
  6483. * // => true
  6484. *
  6485. * _.isArrayLike(_.noop);
  6486. * // => false
  6487. */
  6488. function isArrayLike(value) {
  6489. return value != null && isLength(value.length) && !isFunction(value);
  6490. }
  6491. /**
  6492. * This method is like `_.isArrayLike` except that it also checks if `value`
  6493. * is an object.
  6494. *
  6495. * @static
  6496. * @memberOf _
  6497. * @since 4.0.0
  6498. * @category Lang
  6499. * @param {*} value The value to check.
  6500. * @returns {boolean} Returns `true` if `value` is an array-like object,
  6501. * else `false`.
  6502. * @example
  6503. *
  6504. * _.isArrayLikeObject([1, 2, 3]);
  6505. * // => true
  6506. *
  6507. * _.isArrayLikeObject(document.body.children);
  6508. * // => true
  6509. *
  6510. * _.isArrayLikeObject('abc');
  6511. * // => false
  6512. *
  6513. * _.isArrayLikeObject(_.noop);
  6514. * // => false
  6515. */
  6516. function isArrayLikeObject(value) {
  6517. return isObjectLike(value) && isArrayLike(value);
  6518. }
  6519. /**
  6520. * Checks if `value` is classified as a `Function` object.
  6521. *
  6522. * @static
  6523. * @memberOf _
  6524. * @since 0.1.0
  6525. * @category Lang
  6526. * @param {*} value The value to check.
  6527. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  6528. * @example
  6529. *
  6530. * _.isFunction(_);
  6531. * // => true
  6532. *
  6533. * _.isFunction(/abc/);
  6534. * // => false
  6535. */
  6536. function isFunction(value) {
  6537. // The use of `Object#toString` avoids issues with the `typeof` operator
  6538. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  6539. var tag = isObject(value) ? objectToString.call(value) : '';
  6540. return tag == funcTag || tag == genTag;
  6541. }
  6542. /**
  6543. * Checks if `value` is a valid array-like length.
  6544. *
  6545. * **Note:** This method is loosely based on
  6546. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6547. *
  6548. * @static
  6549. * @memberOf _
  6550. * @since 4.0.0
  6551. * @category Lang
  6552. * @param {*} value The value to check.
  6553. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6554. * @example
  6555. *
  6556. * _.isLength(3);
  6557. * // => true
  6558. *
  6559. * _.isLength(Number.MIN_VALUE);
  6560. * // => false
  6561. *
  6562. * _.isLength(Infinity);
  6563. * // => false
  6564. *
  6565. * _.isLength('3');
  6566. * // => false
  6567. */
  6568. function isLength(value) {
  6569. return typeof value == 'number' &&
  6570. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  6571. }
  6572. /**
  6573. * Checks if `value` is the
  6574. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6575. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6576. *
  6577. * @static
  6578. * @memberOf _
  6579. * @since 0.1.0
  6580. * @category Lang
  6581. * @param {*} value The value to check.
  6582. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6583. * @example
  6584. *
  6585. * _.isObject({});
  6586. * // => true
  6587. *
  6588. * _.isObject([1, 2, 3]);
  6589. * // => true
  6590. *
  6591. * _.isObject(_.noop);
  6592. * // => true
  6593. *
  6594. * _.isObject(null);
  6595. * // => false
  6596. */
  6597. function isObject(value) {
  6598. var type = typeof value;
  6599. return !!value && (type == 'object' || type == 'function');
  6600. }
  6601. /**
  6602. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6603. * and has a `typeof` result of "object".
  6604. *
  6605. * @static
  6606. * @memberOf _
  6607. * @since 4.0.0
  6608. * @category Lang
  6609. * @param {*} value The value to check.
  6610. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6611. * @example
  6612. *
  6613. * _.isObjectLike({});
  6614. * // => true
  6615. *
  6616. * _.isObjectLike([1, 2, 3]);
  6617. * // => true
  6618. *
  6619. * _.isObjectLike(_.noop);
  6620. * // => false
  6621. *
  6622. * _.isObjectLike(null);
  6623. * // => false
  6624. */
  6625. function isObjectLike(value) {
  6626. return !!value && typeof value == 'object';
  6627. }
  6628. /**
  6629. * Checks if `value` is classified as a `Symbol` primitive or object.
  6630. *
  6631. * @static
  6632. * @memberOf _
  6633. * @since 4.0.0
  6634. * @category Lang
  6635. * @param {*} value The value to check.
  6636. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6637. * @example
  6638. *
  6639. * _.isSymbol(Symbol.iterator);
  6640. * // => true
  6641. *
  6642. * _.isSymbol('abc');
  6643. * // => false
  6644. */
  6645. function isSymbol(value) {
  6646. return typeof value == 'symbol' ||
  6647. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  6648. }
  6649. /**
  6650. * Checks if `value` is classified as a typed array.
  6651. *
  6652. * @static
  6653. * @memberOf _
  6654. * @since 3.0.0
  6655. * @category Lang
  6656. * @param {*} value The value to check.
  6657. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  6658. * @example
  6659. *
  6660. * _.isTypedArray(new Uint8Array);
  6661. * // => true
  6662. *
  6663. * _.isTypedArray([]);
  6664. * // => false
  6665. */
  6666. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  6667. /**
  6668. * Converts `value` to a string. An empty string is returned for `null`
  6669. * and `undefined` values. The sign of `-0` is preserved.
  6670. *
  6671. * @static
  6672. * @memberOf _
  6673. * @since 4.0.0
  6674. * @category Lang
  6675. * @param {*} value The value to process.
  6676. * @returns {string} Returns the string.
  6677. * @example
  6678. *
  6679. * _.toString(null);
  6680. * // => ''
  6681. *
  6682. * _.toString(-0);
  6683. * // => '-0'
  6684. *
  6685. * _.toString([1, 2, 3]);
  6686. * // => '1,2,3'
  6687. */
  6688. function toString(value) {
  6689. return value == null ? '' : baseToString(value);
  6690. }
  6691. /**
  6692. * Gets the value at `path` of `object`. If the resolved value is
  6693. * `undefined`, the `defaultValue` is returned in its place.
  6694. *
  6695. * @static
  6696. * @memberOf _
  6697. * @since 3.7.0
  6698. * @category Object
  6699. * @param {Object} object The object to query.
  6700. * @param {Array|string} path The path of the property to get.
  6701. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  6702. * @returns {*} Returns the resolved value.
  6703. * @example
  6704. *
  6705. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  6706. *
  6707. * _.get(object, 'a[0].b.c');
  6708. * // => 3
  6709. *
  6710. * _.get(object, ['a', '0', 'b', 'c']);
  6711. * // => 3
  6712. *
  6713. * _.get(object, 'a.b.c', 'default');
  6714. * // => 'default'
  6715. */
  6716. function get(object, path, defaultValue) {
  6717. var result = object == null ? undefined : baseGet(object, path);
  6718. return result === undefined ? defaultValue : result;
  6719. }
  6720. /**
  6721. * Checks if `path` is a direct or inherited property of `object`.
  6722. *
  6723. * @static
  6724. * @memberOf _
  6725. * @since 4.0.0
  6726. * @category Object
  6727. * @param {Object} object The object to query.
  6728. * @param {Array|string} path The path to check.
  6729. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6730. * @example
  6731. *
  6732. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  6733. *
  6734. * _.hasIn(object, 'a');
  6735. * // => true
  6736. *
  6737. * _.hasIn(object, 'a.b');
  6738. * // => true
  6739. *
  6740. * _.hasIn(object, ['a', 'b']);
  6741. * // => true
  6742. *
  6743. * _.hasIn(object, 'b');
  6744. * // => false
  6745. */
  6746. function hasIn(object, path) {
  6747. return object != null && hasPath(object, path, baseHasIn);
  6748. }
  6749. /**
  6750. * Creates an array of the own enumerable property names of `object`.
  6751. *
  6752. * **Note:** Non-object values are coerced to objects. See the
  6753. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6754. * for more details.
  6755. *
  6756. * @static
  6757. * @since 0.1.0
  6758. * @memberOf _
  6759. * @category Object
  6760. * @param {Object} object The object to query.
  6761. * @returns {Array} Returns the array of property names.
  6762. * @example
  6763. *
  6764. * function Foo() {
  6765. * this.a = 1;
  6766. * this.b = 2;
  6767. * }
  6768. *
  6769. * Foo.prototype.c = 3;
  6770. *
  6771. * _.keys(new Foo);
  6772. * // => ['a', 'b'] (iteration order is not guaranteed)
  6773. *
  6774. * _.keys('hi');
  6775. * // => ['0', '1']
  6776. */
  6777. function keys(object) {
  6778. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  6779. }
  6780. /**
  6781. * This method returns the first argument it receives.
  6782. *
  6783. * @static
  6784. * @since 0.1.0
  6785. * @memberOf _
  6786. * @category Util
  6787. * @param {*} value Any value.
  6788. * @returns {*} Returns `value`.
  6789. * @example
  6790. *
  6791. * var object = { 'a': 1 };
  6792. *
  6793. * console.log(_.identity(object) === object);
  6794. * // => true
  6795. */
  6796. function identity(value) {
  6797. return value;
  6798. }
  6799. /**
  6800. * This method returns `undefined`.
  6801. *
  6802. * @static
  6803. * @memberOf _
  6804. * @since 2.3.0
  6805. * @category Util
  6806. * @example
  6807. *
  6808. * _.times(2, _.noop);
  6809. * // => [undefined, undefined]
  6810. */
  6811. function noop() {
  6812. // No operation performed.
  6813. }
  6814. /**
  6815. * Creates a function that returns the value at `path` of a given object.
  6816. *
  6817. * @static
  6818. * @memberOf _
  6819. * @since 2.4.0
  6820. * @category Util
  6821. * @param {Array|string} path The path of the property to get.
  6822. * @returns {Function} Returns the new accessor function.
  6823. * @example
  6824. *
  6825. * var objects = [
  6826. * { 'a': { 'b': 2 } },
  6827. * { 'a': { 'b': 1 } }
  6828. * ];
  6829. *
  6830. * _.map(objects, _.property('a.b'));
  6831. * // => [2, 1]
  6832. *
  6833. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  6834. * // => [1, 2]
  6835. */
  6836. function property(path) {
  6837. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  6838. }
  6839. module.exports = uniqBy;
  6840. /***/ }),
  6841. /***/ 614:
  6842. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6843. "use strict";
  6844. module.exports = Pbf;
  6845. var ieee754 = __webpack_require__(645);
  6846. function Pbf(buf) {
  6847. this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
  6848. this.pos = 0;
  6849. this.type = 0;
  6850. this.length = this.buf.length;
  6851. }
  6852. Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
  6853. Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
  6854. Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
  6855. Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
  6856. var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
  6857. SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
  6858. // Threshold chosen based on both benchmarking and knowledge about browser string
  6859. // data structures (which currently switch structure types at 12 bytes or more)
  6860. var TEXT_DECODER_MIN_LENGTH = 12;
  6861. var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
  6862. Pbf.prototype = {
  6863. destroy: function() {
  6864. this.buf = null;
  6865. },
  6866. // === READING =================================================================
  6867. readFields: function(readField, result, end) {
  6868. end = end || this.length;
  6869. while (this.pos < end) {
  6870. var val = this.readVarint(),
  6871. tag = val >> 3,
  6872. startPos = this.pos;
  6873. this.type = val & 0x7;
  6874. readField(tag, result, this);
  6875. if (this.pos === startPos) this.skip(val);
  6876. }
  6877. return result;
  6878. },
  6879. readMessage: function(readField, result) {
  6880. return this.readFields(readField, result, this.readVarint() + this.pos);
  6881. },
  6882. readFixed32: function() {
  6883. var val = readUInt32(this.buf, this.pos);
  6884. this.pos += 4;
  6885. return val;
  6886. },
  6887. readSFixed32: function() {
  6888. var val = readInt32(this.buf, this.pos);
  6889. this.pos += 4;
  6890. return val;
  6891. },
  6892. // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
  6893. readFixed64: function() {
  6894. var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
  6895. this.pos += 8;
  6896. return val;
  6897. },
  6898. readSFixed64: function() {
  6899. var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
  6900. this.pos += 8;
  6901. return val;
  6902. },
  6903. readFloat: function() {
  6904. var val = ieee754.read(this.buf, this.pos, true, 23, 4);
  6905. this.pos += 4;
  6906. return val;
  6907. },
  6908. readDouble: function() {
  6909. var val = ieee754.read(this.buf, this.pos, true, 52, 8);
  6910. this.pos += 8;
  6911. return val;
  6912. },
  6913. readVarint: function(isSigned) {
  6914. var buf = this.buf,
  6915. val, b;
  6916. b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
  6917. b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
  6918. b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
  6919. b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
  6920. b = buf[this.pos]; val |= (b & 0x0f) << 28;
  6921. return readVarintRemainder(val, isSigned, this);
  6922. },
  6923. readVarint64: function() { // for compatibility with v2.0.1
  6924. return this.readVarint(true);
  6925. },
  6926. readSVarint: function() {
  6927. var num = this.readVarint();
  6928. return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
  6929. },
  6930. readBoolean: function() {
  6931. return Boolean(this.readVarint());
  6932. },
  6933. readString: function() {
  6934. var end = this.readVarint() + this.pos;
  6935. var pos = this.pos;
  6936. this.pos = end;
  6937. if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
  6938. // longer strings are fast with the built-in browser TextDecoder API
  6939. return readUtf8TextDecoder(this.buf, pos, end);
  6940. }
  6941. // short strings are fast with our custom implementation
  6942. return readUtf8(this.buf, pos, end);
  6943. },
  6944. readBytes: function() {
  6945. var end = this.readVarint() + this.pos,
  6946. buffer = this.buf.subarray(this.pos, end);
  6947. this.pos = end;
  6948. return buffer;
  6949. },
  6950. // verbose for performance reasons; doesn't affect gzipped size
  6951. readPackedVarint: function(arr, isSigned) {
  6952. if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
  6953. var end = readPackedEnd(this);
  6954. arr = arr || [];
  6955. while (this.pos < end) arr.push(this.readVarint(isSigned));
  6956. return arr;
  6957. },
  6958. readPackedSVarint: function(arr) {
  6959. if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
  6960. var end = readPackedEnd(this);
  6961. arr = arr || [];
  6962. while (this.pos < end) arr.push(this.readSVarint());
  6963. return arr;
  6964. },
  6965. readPackedBoolean: function(arr) {
  6966. if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
  6967. var end = readPackedEnd(this);
  6968. arr = arr || [];
  6969. while (this.pos < end) arr.push(this.readBoolean());
  6970. return arr;
  6971. },
  6972. readPackedFloat: function(arr) {
  6973. if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
  6974. var end = readPackedEnd(this);
  6975. arr = arr || [];
  6976. while (this.pos < end) arr.push(this.readFloat());
  6977. return arr;
  6978. },
  6979. readPackedDouble: function(arr) {
  6980. if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
  6981. var end = readPackedEnd(this);
  6982. arr = arr || [];
  6983. while (this.pos < end) arr.push(this.readDouble());
  6984. return arr;
  6985. },
  6986. readPackedFixed32: function(arr) {
  6987. if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
  6988. var end = readPackedEnd(this);
  6989. arr = arr || [];
  6990. while (this.pos < end) arr.push(this.readFixed32());
  6991. return arr;
  6992. },
  6993. readPackedSFixed32: function(arr) {
  6994. if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
  6995. var end = readPackedEnd(this);
  6996. arr = arr || [];
  6997. while (this.pos < end) arr.push(this.readSFixed32());
  6998. return arr;
  6999. },
  7000. readPackedFixed64: function(arr) {
  7001. if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
  7002. var end = readPackedEnd(this);
  7003. arr = arr || [];
  7004. while (this.pos < end) arr.push(this.readFixed64());
  7005. return arr;
  7006. },
  7007. readPackedSFixed64: function(arr) {
  7008. if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
  7009. var end = readPackedEnd(this);
  7010. arr = arr || [];
  7011. while (this.pos < end) arr.push(this.readSFixed64());
  7012. return arr;
  7013. },
  7014. skip: function(val) {
  7015. var type = val & 0x7;
  7016. if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
  7017. else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
  7018. else if (type === Pbf.Fixed32) this.pos += 4;
  7019. else if (type === Pbf.Fixed64) this.pos += 8;
  7020. else throw new Error('Unimplemented type: ' + type);
  7021. },
  7022. // === WRITING =================================================================
  7023. writeTag: function(tag, type) {
  7024. this.writeVarint((tag << 3) | type);
  7025. },
  7026. realloc: function(min) {
  7027. var length = this.length || 16;
  7028. while (length < this.pos + min) length *= 2;
  7029. if (length !== this.length) {
  7030. var buf = new Uint8Array(length);
  7031. buf.set(this.buf);
  7032. this.buf = buf;
  7033. this.length = length;
  7034. }
  7035. },
  7036. finish: function() {
  7037. this.length = this.pos;
  7038. this.pos = 0;
  7039. return this.buf.subarray(0, this.length);
  7040. },
  7041. writeFixed32: function(val) {
  7042. this.realloc(4);
  7043. writeInt32(this.buf, val, this.pos);
  7044. this.pos += 4;
  7045. },
  7046. writeSFixed32: function(val) {
  7047. this.realloc(4);
  7048. writeInt32(this.buf, val, this.pos);
  7049. this.pos += 4;
  7050. },
  7051. writeFixed64: function(val) {
  7052. this.realloc(8);
  7053. writeInt32(this.buf, val & -1, this.pos);
  7054. writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
  7055. this.pos += 8;
  7056. },
  7057. writeSFixed64: function(val) {
  7058. this.realloc(8);
  7059. writeInt32(this.buf, val & -1, this.pos);
  7060. writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
  7061. this.pos += 8;
  7062. },
  7063. writeVarint: function(val) {
  7064. val = +val || 0;
  7065. if (val > 0xfffffff || val < 0) {
  7066. writeBigVarint(val, this);
  7067. return;
  7068. }
  7069. this.realloc(4);
  7070. this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  7071. this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  7072. this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  7073. this.buf[this.pos++] = (val >>> 7) & 0x7f;
  7074. },
  7075. writeSVarint: function(val) {
  7076. this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
  7077. },
  7078. writeBoolean: function(val) {
  7079. this.writeVarint(Boolean(val));
  7080. },
  7081. writeString: function(str) {
  7082. str = String(str);
  7083. this.realloc(str.length * 4);
  7084. this.pos++; // reserve 1 byte for short string length
  7085. var startPos = this.pos;
  7086. // write the string directly to the buffer and see how much was written
  7087. this.pos = writeUtf8(this.buf, str, this.pos);
  7088. var len = this.pos - startPos;
  7089. if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
  7090. // finally, write the message length in the reserved place and restore the position
  7091. this.pos = startPos - 1;
  7092. this.writeVarint(len);
  7093. this.pos += len;
  7094. },
  7095. writeFloat: function(val) {
  7096. this.realloc(4);
  7097. ieee754.write(this.buf, val, this.pos, true, 23, 4);
  7098. this.pos += 4;
  7099. },
  7100. writeDouble: function(val) {
  7101. this.realloc(8);
  7102. ieee754.write(this.buf, val, this.pos, true, 52, 8);
  7103. this.pos += 8;
  7104. },
  7105. writeBytes: function(buffer) {
  7106. var len = buffer.length;
  7107. this.writeVarint(len);
  7108. this.realloc(len);
  7109. for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
  7110. },
  7111. writeRawMessage: function(fn, obj) {
  7112. this.pos++; // reserve 1 byte for short message length
  7113. // write the message directly to the buffer and see how much was written
  7114. var startPos = this.pos;
  7115. fn(obj, this);
  7116. var len = this.pos - startPos;
  7117. if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
  7118. // finally, write the message length in the reserved place and restore the position
  7119. this.pos = startPos - 1;
  7120. this.writeVarint(len);
  7121. this.pos += len;
  7122. },
  7123. writeMessage: function(tag, fn, obj) {
  7124. this.writeTag(tag, Pbf.Bytes);
  7125. this.writeRawMessage(fn, obj);
  7126. },
  7127. writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
  7128. writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
  7129. writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
  7130. writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
  7131. writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
  7132. writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
  7133. writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
  7134. writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
  7135. writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
  7136. writeBytesField: function(tag, buffer) {
  7137. this.writeTag(tag, Pbf.Bytes);
  7138. this.writeBytes(buffer);
  7139. },
  7140. writeFixed32Field: function(tag, val) {
  7141. this.writeTag(tag, Pbf.Fixed32);
  7142. this.writeFixed32(val);
  7143. },
  7144. writeSFixed32Field: function(tag, val) {
  7145. this.writeTag(tag, Pbf.Fixed32);
  7146. this.writeSFixed32(val);
  7147. },
  7148. writeFixed64Field: function(tag, val) {
  7149. this.writeTag(tag, Pbf.Fixed64);
  7150. this.writeFixed64(val);
  7151. },
  7152. writeSFixed64Field: function(tag, val) {
  7153. this.writeTag(tag, Pbf.Fixed64);
  7154. this.writeSFixed64(val);
  7155. },
  7156. writeVarintField: function(tag, val) {
  7157. this.writeTag(tag, Pbf.Varint);
  7158. this.writeVarint(val);
  7159. },
  7160. writeSVarintField: function(tag, val) {
  7161. this.writeTag(tag, Pbf.Varint);
  7162. this.writeSVarint(val);
  7163. },
  7164. writeStringField: function(tag, str) {
  7165. this.writeTag(tag, Pbf.Bytes);
  7166. this.writeString(str);
  7167. },
  7168. writeFloatField: function(tag, val) {
  7169. this.writeTag(tag, Pbf.Fixed32);
  7170. this.writeFloat(val);
  7171. },
  7172. writeDoubleField: function(tag, val) {
  7173. this.writeTag(tag, Pbf.Fixed64);
  7174. this.writeDouble(val);
  7175. },
  7176. writeBooleanField: function(tag, val) {
  7177. this.writeVarintField(tag, Boolean(val));
  7178. }
  7179. };
  7180. function readVarintRemainder(l, s, p) {
  7181. var buf = p.buf,
  7182. h, b;
  7183. b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
  7184. b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
  7185. b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
  7186. b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
  7187. b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
  7188. b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
  7189. throw new Error('Expected varint not more than 10 bytes');
  7190. }
  7191. function readPackedEnd(pbf) {
  7192. return pbf.type === Pbf.Bytes ?
  7193. pbf.readVarint() + pbf.pos : pbf.pos + 1;
  7194. }
  7195. function toNum(low, high, isSigned) {
  7196. if (isSigned) {
  7197. return high * 0x100000000 + (low >>> 0);
  7198. }
  7199. return ((high >>> 0) * 0x100000000) + (low >>> 0);
  7200. }
  7201. function writeBigVarint(val, pbf) {
  7202. var low, high;
  7203. if (val >= 0) {
  7204. low = (val % 0x100000000) | 0;
  7205. high = (val / 0x100000000) | 0;
  7206. } else {
  7207. low = ~(-val % 0x100000000);
  7208. high = ~(-val / 0x100000000);
  7209. if (low ^ 0xffffffff) {
  7210. low = (low + 1) | 0;
  7211. } else {
  7212. low = 0;
  7213. high = (high + 1) | 0;
  7214. }
  7215. }
  7216. if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
  7217. throw new Error('Given varint doesn\'t fit into 10 bytes');
  7218. }
  7219. pbf.realloc(10);
  7220. writeBigVarintLow(low, high, pbf);
  7221. writeBigVarintHigh(high, pbf);
  7222. }
  7223. function writeBigVarintLow(low, high, pbf) {
  7224. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  7225. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  7226. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  7227. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  7228. pbf.buf[pbf.pos] = low & 0x7f;
  7229. }
  7230. function writeBigVarintHigh(high, pbf) {
  7231. var lsb = (high & 0x07) << 4;
  7232. pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
  7233. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  7234. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  7235. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  7236. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  7237. pbf.buf[pbf.pos++] = high & 0x7f;
  7238. }
  7239. function makeRoomForExtraLength(startPos, len, pbf) {
  7240. var extraLen =
  7241. len <= 0x3fff ? 1 :
  7242. len <= 0x1fffff ? 2 :
  7243. len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
  7244. // if 1 byte isn't enough for encoding message length, shift the data to the right
  7245. pbf.realloc(extraLen);
  7246. for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
  7247. }
  7248. function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
  7249. function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
  7250. function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
  7251. function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
  7252. function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
  7253. function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
  7254. function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
  7255. function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
  7256. function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
  7257. // Buffer code below from https://github.com/feross/buffer, MIT-licensed
  7258. function readUInt32(buf, pos) {
  7259. return ((buf[pos]) |
  7260. (buf[pos + 1] << 8) |
  7261. (buf[pos + 2] << 16)) +
  7262. (buf[pos + 3] * 0x1000000);
  7263. }
  7264. function writeInt32(buf, val, pos) {
  7265. buf[pos] = val;
  7266. buf[pos + 1] = (val >>> 8);
  7267. buf[pos + 2] = (val >>> 16);
  7268. buf[pos + 3] = (val >>> 24);
  7269. }
  7270. function readInt32(buf, pos) {
  7271. return ((buf[pos]) |
  7272. (buf[pos + 1] << 8) |
  7273. (buf[pos + 2] << 16)) +
  7274. (buf[pos + 3] << 24);
  7275. }
  7276. function readUtf8(buf, pos, end) {
  7277. var str = '';
  7278. var i = pos;
  7279. while (i < end) {
  7280. var b0 = buf[i];
  7281. var c = null; // codepoint
  7282. var bytesPerSequence =
  7283. b0 > 0xEF ? 4 :
  7284. b0 > 0xDF ? 3 :
  7285. b0 > 0xBF ? 2 : 1;
  7286. if (i + bytesPerSequence > end) break;
  7287. var b1, b2, b3;
  7288. if (bytesPerSequence === 1) {
  7289. if (b0 < 0x80) {
  7290. c = b0;
  7291. }
  7292. } else if (bytesPerSequence === 2) {
  7293. b1 = buf[i + 1];
  7294. if ((b1 & 0xC0) === 0x80) {
  7295. c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
  7296. if (c <= 0x7F) {
  7297. c = null;
  7298. }
  7299. }
  7300. } else if (bytesPerSequence === 3) {
  7301. b1 = buf[i + 1];
  7302. b2 = buf[i + 2];
  7303. if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
  7304. c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
  7305. if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
  7306. c = null;
  7307. }
  7308. }
  7309. } else if (bytesPerSequence === 4) {
  7310. b1 = buf[i + 1];
  7311. b2 = buf[i + 2];
  7312. b3 = buf[i + 3];
  7313. if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
  7314. c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
  7315. if (c <= 0xFFFF || c >= 0x110000) {
  7316. c = null;
  7317. }
  7318. }
  7319. }
  7320. if (c === null) {
  7321. c = 0xFFFD;
  7322. bytesPerSequence = 1;
  7323. } else if (c > 0xFFFF) {
  7324. c -= 0x10000;
  7325. str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
  7326. c = 0xDC00 | c & 0x3FF;
  7327. }
  7328. str += String.fromCharCode(c);
  7329. i += bytesPerSequence;
  7330. }
  7331. return str;
  7332. }
  7333. function readUtf8TextDecoder(buf, pos, end) {
  7334. return utf8TextDecoder.decode(buf.subarray(pos, end));
  7335. }
  7336. function writeUtf8(buf, str, pos) {
  7337. for (var i = 0, c, lead; i < str.length; i++) {
  7338. c = str.charCodeAt(i); // code point
  7339. if (c > 0xD7FF && c < 0xE000) {
  7340. if (lead) {
  7341. if (c < 0xDC00) {
  7342. buf[pos++] = 0xEF;
  7343. buf[pos++] = 0xBF;
  7344. buf[pos++] = 0xBD;
  7345. lead = c;
  7346. continue;
  7347. } else {
  7348. c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
  7349. lead = null;
  7350. }
  7351. } else {
  7352. if (c > 0xDBFF || (i + 1 === str.length)) {
  7353. buf[pos++] = 0xEF;
  7354. buf[pos++] = 0xBF;
  7355. buf[pos++] = 0xBD;
  7356. } else {
  7357. lead = c;
  7358. }
  7359. continue;
  7360. }
  7361. } else if (lead) {
  7362. buf[pos++] = 0xEF;
  7363. buf[pos++] = 0xBF;
  7364. buf[pos++] = 0xBD;
  7365. lead = null;
  7366. }
  7367. if (c < 0x80) {
  7368. buf[pos++] = c;
  7369. } else {
  7370. if (c < 0x800) {
  7371. buf[pos++] = c >> 0x6 | 0xC0;
  7372. } else {
  7373. if (c < 0x10000) {
  7374. buf[pos++] = c >> 0xC | 0xE0;
  7375. } else {
  7376. buf[pos++] = c >> 0x12 | 0xF0;
  7377. buf[pos++] = c >> 0xC & 0x3F | 0x80;
  7378. }
  7379. buf[pos++] = c >> 0x6 & 0x3F | 0x80;
  7380. }
  7381. buf[pos++] = c & 0x3F | 0x80;
  7382. }
  7383. }
  7384. return pos;
  7385. }
  7386. /***/ }),
  7387. /***/ 785:
  7388. /***/ (function(module) {
  7389. (function (global, factory) {
  7390. true ? module.exports = factory() :
  7391. 0;
  7392. }(this, (function () { 'use strict';
  7393. var globals = function(defs) {
  7394. defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
  7395. defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
  7396. defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
  7397. defs.WGS84 = defs['EPSG:4326'];
  7398. defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
  7399. defs.GOOGLE = defs['EPSG:3857'];
  7400. defs['EPSG:900913'] = defs['EPSG:3857'];
  7401. defs['EPSG:102113'] = defs['EPSG:3857'];
  7402. };
  7403. var PJD_3PARAM = 1;
  7404. var PJD_7PARAM = 2;
  7405. var PJD_GRIDSHIFT = 3;
  7406. var PJD_WGS84 = 4; // WGS84 or equivalent
  7407. var PJD_NODATUM = 5; // WGS84 or equivalent
  7408. var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms
  7409. var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms
  7410. var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms
  7411. var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
  7412. var HALF_PI = Math.PI/2;
  7413. // ellipoid pj_set_ell.c
  7414. var SIXTH = 0.1666666666666666667;
  7415. /* 1/6 */
  7416. var RA4 = 0.04722222222222222222;
  7417. /* 17/360 */
  7418. var RA6 = 0.02215608465608465608;
  7419. var EPSLN = 1.0e-10;
  7420. // you'd think you could use Number.EPSILON above but that makes
  7421. // Mollweide get into an infinate loop.
  7422. var D2R = 0.01745329251994329577;
  7423. var R2D = 57.29577951308232088;
  7424. var FORTPI = Math.PI/4;
  7425. var TWO_PI = Math.PI * 2;
  7426. // SPI is slightly greater than Math.PI, so values that exceed the -180..180
  7427. // degree range by a tiny amount don't get wrapped. This prevents points that
  7428. // have drifted from their original location along the 180th meridian (due to
  7429. // floating point error) from changing their sign.
  7430. var SPI = 3.14159265359;
  7431. var exports$1 = {};
  7432. exports$1.greenwich = 0.0; //"0dE",
  7433. exports$1.lisbon = -9.131906111111; //"9d07'54.862\"W",
  7434. exports$1.paris = 2.337229166667; //"2d20'14.025\"E",
  7435. exports$1.bogota = -74.080916666667; //"74d04'51.3\"W",
  7436. exports$1.madrid = -3.687938888889; //"3d41'16.58\"W",
  7437. exports$1.rome = 12.452333333333; //"12d27'8.4\"E",
  7438. exports$1.bern = 7.439583333333; //"7d26'22.5\"E",
  7439. exports$1.jakarta = 106.807719444444; //"106d48'27.79\"E",
  7440. exports$1.ferro = -17.666666666667; //"17d40'W",
  7441. exports$1.brussels = 4.367975; //"4d22'4.71\"E",
  7442. exports$1.stockholm = 18.058277777778; //"18d3'29.8\"E",
  7443. exports$1.athens = 23.7163375; //"23d42'58.815\"E",
  7444. exports$1.oslo = 10.722916666667; //"10d43'22.5\"E"
  7445. var units = {
  7446. ft: {to_meter: 0.3048},
  7447. 'us-ft': {to_meter: 1200 / 3937}
  7448. };
  7449. var ignoredChar = /[\s_\-\/\(\)]/g;
  7450. function match(obj, key) {
  7451. if (obj[key]) {
  7452. return obj[key];
  7453. }
  7454. var keys = Object.keys(obj);
  7455. var lkey = key.toLowerCase().replace(ignoredChar, '');
  7456. var i = -1;
  7457. var testkey, processedKey;
  7458. while (++i < keys.length) {
  7459. testkey = keys[i];
  7460. processedKey = testkey.toLowerCase().replace(ignoredChar, '');
  7461. if (processedKey === lkey) {
  7462. return obj[testkey];
  7463. }
  7464. }
  7465. }
  7466. var parseProj = function(defData) {
  7467. var self = {};
  7468. var paramObj = defData.split('+').map(function(v) {
  7469. return v.trim();
  7470. }).filter(function(a) {
  7471. return a;
  7472. }).reduce(function(p, a) {
  7473. var split = a.split('=');
  7474. split.push(true);
  7475. p[split[0].toLowerCase()] = split[1];
  7476. return p;
  7477. }, {});
  7478. var paramName, paramVal, paramOutname;
  7479. var params = {
  7480. proj: 'projName',
  7481. datum: 'datumCode',
  7482. rf: function(v) {
  7483. self.rf = parseFloat(v);
  7484. },
  7485. lat_0: function(v) {
  7486. self.lat0 = v * D2R;
  7487. },
  7488. lat_1: function(v) {
  7489. self.lat1 = v * D2R;
  7490. },
  7491. lat_2: function(v) {
  7492. self.lat2 = v * D2R;
  7493. },
  7494. lat_ts: function(v) {
  7495. self.lat_ts = v * D2R;
  7496. },
  7497. lon_0: function(v) {
  7498. self.long0 = v * D2R;
  7499. },
  7500. lon_1: function(v) {
  7501. self.long1 = v * D2R;
  7502. },
  7503. lon_2: function(v) {
  7504. self.long2 = v * D2R;
  7505. },
  7506. alpha: function(v) {
  7507. self.alpha = parseFloat(v) * D2R;
  7508. },
  7509. gamma: function(v) {
  7510. self.rectified_grid_angle = parseFloat(v);
  7511. },
  7512. lonc: function(v) {
  7513. self.longc = v * D2R;
  7514. },
  7515. x_0: function(v) {
  7516. self.x0 = parseFloat(v);
  7517. },
  7518. y_0: function(v) {
  7519. self.y0 = parseFloat(v);
  7520. },
  7521. k_0: function(v) {
  7522. self.k0 = parseFloat(v);
  7523. },
  7524. k: function(v) {
  7525. self.k0 = parseFloat(v);
  7526. },
  7527. a: function(v) {
  7528. self.a = parseFloat(v);
  7529. },
  7530. b: function(v) {
  7531. self.b = parseFloat(v);
  7532. },
  7533. r_a: function() {
  7534. self.R_A = true;
  7535. },
  7536. zone: function(v) {
  7537. self.zone = parseInt(v, 10);
  7538. },
  7539. south: function() {
  7540. self.utmSouth = true;
  7541. },
  7542. towgs84: function(v) {
  7543. self.datum_params = v.split(",").map(function(a) {
  7544. return parseFloat(a);
  7545. });
  7546. },
  7547. to_meter: function(v) {
  7548. self.to_meter = parseFloat(v);
  7549. },
  7550. units: function(v) {
  7551. self.units = v;
  7552. var unit = match(units, v);
  7553. if (unit) {
  7554. self.to_meter = unit.to_meter;
  7555. }
  7556. },
  7557. from_greenwich: function(v) {
  7558. self.from_greenwich = v * D2R;
  7559. },
  7560. pm: function(v) {
  7561. var pm = match(exports$1, v);
  7562. self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
  7563. },
  7564. nadgrids: function(v) {
  7565. if (v === '@null') {
  7566. self.datumCode = 'none';
  7567. }
  7568. else {
  7569. self.nadgrids = v;
  7570. }
  7571. },
  7572. axis: function(v) {
  7573. var legalAxis = "ewnsud";
  7574. if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
  7575. self.axis = v;
  7576. }
  7577. },
  7578. approx: function() {
  7579. self.approx = true;
  7580. }
  7581. };
  7582. for (paramName in paramObj) {
  7583. paramVal = paramObj[paramName];
  7584. if (paramName in params) {
  7585. paramOutname = params[paramName];
  7586. if (typeof paramOutname === 'function') {
  7587. paramOutname(paramVal);
  7588. }
  7589. else {
  7590. self[paramOutname] = paramVal;
  7591. }
  7592. }
  7593. else {
  7594. self[paramName] = paramVal;
  7595. }
  7596. }
  7597. if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
  7598. self.datumCode = self.datumCode.toLowerCase();
  7599. }
  7600. return self;
  7601. };
  7602. var NEUTRAL = 1;
  7603. var KEYWORD = 2;
  7604. var NUMBER = 3;
  7605. var QUOTED = 4;
  7606. var AFTERQUOTE = 5;
  7607. var ENDED = -1;
  7608. var whitespace = /\s/;
  7609. var latin = /[A-Za-z]/;
  7610. var keyword = /[A-Za-z84_]/;
  7611. var endThings = /[,\]]/;
  7612. var digets = /[\d\.E\-\+]/;
  7613. // const ignoredChar = /[\s_\-\/\(\)]/g;
  7614. function Parser(text) {
  7615. if (typeof text !== 'string') {
  7616. throw new Error('not a string');
  7617. }
  7618. this.text = text.trim();
  7619. this.level = 0;
  7620. this.place = 0;
  7621. this.root = null;
  7622. this.stack = [];
  7623. this.currentObject = null;
  7624. this.state = NEUTRAL;
  7625. }
  7626. Parser.prototype.readCharicter = function() {
  7627. var char = this.text[this.place++];
  7628. if (this.state !== QUOTED) {
  7629. while (whitespace.test(char)) {
  7630. if (this.place >= this.text.length) {
  7631. return;
  7632. }
  7633. char = this.text[this.place++];
  7634. }
  7635. }
  7636. switch (this.state) {
  7637. case NEUTRAL:
  7638. return this.neutral(char);
  7639. case KEYWORD:
  7640. return this.keyword(char)
  7641. case QUOTED:
  7642. return this.quoted(char);
  7643. case AFTERQUOTE:
  7644. return this.afterquote(char);
  7645. case NUMBER:
  7646. return this.number(char);
  7647. case ENDED:
  7648. return;
  7649. }
  7650. };
  7651. Parser.prototype.afterquote = function(char) {
  7652. if (char === '"') {
  7653. this.word += '"';
  7654. this.state = QUOTED;
  7655. return;
  7656. }
  7657. if (endThings.test(char)) {
  7658. this.word = this.word.trim();
  7659. this.afterItem(char);
  7660. return;
  7661. }
  7662. throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
  7663. };
  7664. Parser.prototype.afterItem = function(char) {
  7665. if (char === ',') {
  7666. if (this.word !== null) {
  7667. this.currentObject.push(this.word);
  7668. }
  7669. this.word = null;
  7670. this.state = NEUTRAL;
  7671. return;
  7672. }
  7673. if (char === ']') {
  7674. this.level--;
  7675. if (this.word !== null) {
  7676. this.currentObject.push(this.word);
  7677. this.word = null;
  7678. }
  7679. this.state = NEUTRAL;
  7680. this.currentObject = this.stack.pop();
  7681. if (!this.currentObject) {
  7682. this.state = ENDED;
  7683. }
  7684. return;
  7685. }
  7686. };
  7687. Parser.prototype.number = function(char) {
  7688. if (digets.test(char)) {
  7689. this.word += char;
  7690. return;
  7691. }
  7692. if (endThings.test(char)) {
  7693. this.word = parseFloat(this.word);
  7694. this.afterItem(char);
  7695. return;
  7696. }
  7697. throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
  7698. };
  7699. Parser.prototype.quoted = function(char) {
  7700. if (char === '"') {
  7701. this.state = AFTERQUOTE;
  7702. return;
  7703. }
  7704. this.word += char;
  7705. return;
  7706. };
  7707. Parser.prototype.keyword = function(char) {
  7708. if (keyword.test(char)) {
  7709. this.word += char;
  7710. return;
  7711. }
  7712. if (char === '[') {
  7713. var newObjects = [];
  7714. newObjects.push(this.word);
  7715. this.level++;
  7716. if (this.root === null) {
  7717. this.root = newObjects;
  7718. } else {
  7719. this.currentObject.push(newObjects);
  7720. }
  7721. this.stack.push(this.currentObject);
  7722. this.currentObject = newObjects;
  7723. this.state = NEUTRAL;
  7724. return;
  7725. }
  7726. if (endThings.test(char)) {
  7727. this.afterItem(char);
  7728. return;
  7729. }
  7730. throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
  7731. };
  7732. Parser.prototype.neutral = function(char) {
  7733. if (latin.test(char)) {
  7734. this.word = char;
  7735. this.state = KEYWORD;
  7736. return;
  7737. }
  7738. if (char === '"') {
  7739. this.word = '';
  7740. this.state = QUOTED;
  7741. return;
  7742. }
  7743. if (digets.test(char)) {
  7744. this.word = char;
  7745. this.state = NUMBER;
  7746. return;
  7747. }
  7748. if (endThings.test(char)) {
  7749. this.afterItem(char);
  7750. return;
  7751. }
  7752. throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
  7753. };
  7754. Parser.prototype.output = function() {
  7755. while (this.place < this.text.length) {
  7756. this.readCharicter();
  7757. }
  7758. if (this.state === ENDED) {
  7759. return this.root;
  7760. }
  7761. throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
  7762. };
  7763. function parseString(txt) {
  7764. var parser = new Parser(txt);
  7765. return parser.output();
  7766. }
  7767. function mapit(obj, key, value) {
  7768. if (Array.isArray(key)) {
  7769. value.unshift(key);
  7770. key = null;
  7771. }
  7772. var thing = key ? {} : obj;
  7773. var out = value.reduce(function(newObj, item) {
  7774. sExpr(item, newObj);
  7775. return newObj
  7776. }, thing);
  7777. if (key) {
  7778. obj[key] = out;
  7779. }
  7780. }
  7781. function sExpr(v, obj) {
  7782. if (!Array.isArray(v)) {
  7783. obj[v] = true;
  7784. return;
  7785. }
  7786. var key = v.shift();
  7787. if (key === 'PARAMETER') {
  7788. key = v.shift();
  7789. }
  7790. if (v.length === 1) {
  7791. if (Array.isArray(v[0])) {
  7792. obj[key] = {};
  7793. sExpr(v[0], obj[key]);
  7794. return;
  7795. }
  7796. obj[key] = v[0];
  7797. return;
  7798. }
  7799. if (!v.length) {
  7800. obj[key] = true;
  7801. return;
  7802. }
  7803. if (key === 'TOWGS84') {
  7804. obj[key] = v;
  7805. return;
  7806. }
  7807. if (key === 'AXIS') {
  7808. if (!(key in obj)) {
  7809. obj[key] = [];
  7810. }
  7811. obj[key].push(v);
  7812. return;
  7813. }
  7814. if (!Array.isArray(key)) {
  7815. obj[key] = {};
  7816. }
  7817. var i;
  7818. switch (key) {
  7819. case 'UNIT':
  7820. case 'PRIMEM':
  7821. case 'VERT_DATUM':
  7822. obj[key] = {
  7823. name: v[0].toLowerCase(),
  7824. convert: v[1]
  7825. };
  7826. if (v.length === 3) {
  7827. sExpr(v[2], obj[key]);
  7828. }
  7829. return;
  7830. case 'SPHEROID':
  7831. case 'ELLIPSOID':
  7832. obj[key] = {
  7833. name: v[0],
  7834. a: v[1],
  7835. rf: v[2]
  7836. };
  7837. if (v.length === 4) {
  7838. sExpr(v[3], obj[key]);
  7839. }
  7840. return;
  7841. case 'PROJECTEDCRS':
  7842. case 'PROJCRS':
  7843. case 'GEOGCS':
  7844. case 'GEOCCS':
  7845. case 'PROJCS':
  7846. case 'LOCAL_CS':
  7847. case 'GEODCRS':
  7848. case 'GEODETICCRS':
  7849. case 'GEODETICDATUM':
  7850. case 'EDATUM':
  7851. case 'ENGINEERINGDATUM':
  7852. case 'VERT_CS':
  7853. case 'VERTCRS':
  7854. case 'VERTICALCRS':
  7855. case 'COMPD_CS':
  7856. case 'COMPOUNDCRS':
  7857. case 'ENGINEERINGCRS':
  7858. case 'ENGCRS':
  7859. case 'FITTED_CS':
  7860. case 'LOCAL_DATUM':
  7861. case 'DATUM':
  7862. v[0] = ['name', v[0]];
  7863. mapit(obj, key, v);
  7864. return;
  7865. default:
  7866. i = -1;
  7867. while (++i < v.length) {
  7868. if (!Array.isArray(v[i])) {
  7869. return sExpr(v, obj[key]);
  7870. }
  7871. }
  7872. return mapit(obj, key, v);
  7873. }
  7874. }
  7875. var D2R$1 = 0.01745329251994329577;
  7876. function rename(obj, params) {
  7877. var outName = params[0];
  7878. var inName = params[1];
  7879. if (!(outName in obj) && (inName in obj)) {
  7880. obj[outName] = obj[inName];
  7881. if (params.length === 3) {
  7882. obj[outName] = params[2](obj[outName]);
  7883. }
  7884. }
  7885. }
  7886. function d2r(input) {
  7887. return input * D2R$1;
  7888. }
  7889. function cleanWKT(wkt) {
  7890. if (wkt.type === 'GEOGCS') {
  7891. wkt.projName = 'longlat';
  7892. } else if (wkt.type === 'LOCAL_CS') {
  7893. wkt.projName = 'identity';
  7894. wkt.local = true;
  7895. } else {
  7896. if (typeof wkt.PROJECTION === 'object') {
  7897. wkt.projName = Object.keys(wkt.PROJECTION)[0];
  7898. } else {
  7899. wkt.projName = wkt.PROJECTION;
  7900. }
  7901. }
  7902. if (wkt.AXIS) {
  7903. var axisOrder = '';
  7904. for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
  7905. var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];
  7906. if (axis[0].indexOf('north') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north')) {
  7907. axisOrder += 'n';
  7908. } else if (axis[0].indexOf('south') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south')) {
  7909. axisOrder += 's';
  7910. } else if (axis[0].indexOf('east') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east')) {
  7911. axisOrder += 'e';
  7912. } else if (axis[0].indexOf('west') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west')) {
  7913. axisOrder += 'w';
  7914. }
  7915. }
  7916. if (axisOrder.length === 2) {
  7917. axisOrder += 'u';
  7918. }
  7919. if (axisOrder.length === 3) {
  7920. wkt.axis = axisOrder;
  7921. }
  7922. }
  7923. if (wkt.UNIT) {
  7924. wkt.units = wkt.UNIT.name.toLowerCase();
  7925. if (wkt.units === 'metre') {
  7926. wkt.units = 'meter';
  7927. }
  7928. if (wkt.UNIT.convert) {
  7929. if (wkt.type === 'GEOGCS') {
  7930. if (wkt.DATUM && wkt.DATUM.SPHEROID) {
  7931. wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
  7932. }
  7933. } else {
  7934. wkt.to_meter = wkt.UNIT.convert;
  7935. }
  7936. }
  7937. }
  7938. var geogcs = wkt.GEOGCS;
  7939. if (wkt.type === 'GEOGCS') {
  7940. geogcs = wkt;
  7941. }
  7942. if (geogcs) {
  7943. //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
  7944. // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
  7945. //}
  7946. if (geogcs.DATUM) {
  7947. wkt.datumCode = geogcs.DATUM.name.toLowerCase();
  7948. } else {
  7949. wkt.datumCode = geogcs.name.toLowerCase();
  7950. }
  7951. if (wkt.datumCode.slice(0, 2) === 'd_') {
  7952. wkt.datumCode = wkt.datumCode.slice(2);
  7953. }
  7954. if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
  7955. wkt.datumCode = 'nzgd49';
  7956. }
  7957. if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
  7958. if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
  7959. wkt.sphere = true;
  7960. }
  7961. wkt.datumCode = 'wgs84';
  7962. }
  7963. if (wkt.datumCode.slice(-6) === '_ferro') {
  7964. wkt.datumCode = wkt.datumCode.slice(0, - 6);
  7965. }
  7966. if (wkt.datumCode.slice(-8) === '_jakarta') {
  7967. wkt.datumCode = wkt.datumCode.slice(0, - 8);
  7968. }
  7969. if (~wkt.datumCode.indexOf('belge')) {
  7970. wkt.datumCode = 'rnb72';
  7971. }
  7972. if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
  7973. wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
  7974. if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
  7975. wkt.ellps = 'intl';
  7976. }
  7977. wkt.a = geogcs.DATUM.SPHEROID.a;
  7978. wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
  7979. }
  7980. if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
  7981. wkt.datum_params = geogcs.DATUM.TOWGS84;
  7982. }
  7983. if (~wkt.datumCode.indexOf('osgb_1936')) {
  7984. wkt.datumCode = 'osgb36';
  7985. }
  7986. if (~wkt.datumCode.indexOf('osni_1952')) {
  7987. wkt.datumCode = 'osni52';
  7988. }
  7989. if (~wkt.datumCode.indexOf('tm65')
  7990. || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
  7991. wkt.datumCode = 'ire65';
  7992. }
  7993. if (wkt.datumCode === 'ch1903+') {
  7994. wkt.datumCode = 'ch1903';
  7995. }
  7996. if (~wkt.datumCode.indexOf('israel')) {
  7997. wkt.datumCode = 'isr93';
  7998. }
  7999. }
  8000. if (wkt.b && !isFinite(wkt.b)) {
  8001. wkt.b = wkt.a;
  8002. }
  8003. function toMeter(input) {
  8004. var ratio = wkt.to_meter || 1;
  8005. return input * ratio;
  8006. }
  8007. var renamer = function(a) {
  8008. return rename(wkt, a);
  8009. };
  8010. var list = [
  8011. ['standard_parallel_1', 'Standard_Parallel_1'],
  8012. ['standard_parallel_1', 'Latitude of 1st standard parallel'],
  8013. ['standard_parallel_2', 'Standard_Parallel_2'],
  8014. ['standard_parallel_2', 'Latitude of 2nd standard parallel'],
  8015. ['false_easting', 'False_Easting'],
  8016. ['false_easting', 'False easting'],
  8017. ['false-easting', 'Easting at false origin'],
  8018. ['false_northing', 'False_Northing'],
  8019. ['false_northing', 'False northing'],
  8020. ['false_northing', 'Northing at false origin'],
  8021. ['central_meridian', 'Central_Meridian'],
  8022. ['central_meridian', 'Longitude of natural origin'],
  8023. ['central_meridian', 'Longitude of false origin'],
  8024. ['latitude_of_origin', 'Latitude_Of_Origin'],
  8025. ['latitude_of_origin', 'Central_Parallel'],
  8026. ['latitude_of_origin', 'Latitude of natural origin'],
  8027. ['latitude_of_origin', 'Latitude of false origin'],
  8028. ['scale_factor', 'Scale_Factor'],
  8029. ['k0', 'scale_factor'],
  8030. ['latitude_of_center', 'Latitude_Of_Center'],
  8031. ['latitude_of_center', 'Latitude_of_center'],
  8032. ['lat0', 'latitude_of_center', d2r],
  8033. ['longitude_of_center', 'Longitude_Of_Center'],
  8034. ['longitude_of_center', 'Longitude_of_center'],
  8035. ['longc', 'longitude_of_center', d2r],
  8036. ['x0', 'false_easting', toMeter],
  8037. ['y0', 'false_northing', toMeter],
  8038. ['long0', 'central_meridian', d2r],
  8039. ['lat0', 'latitude_of_origin', d2r],
  8040. ['lat0', 'standard_parallel_1', d2r],
  8041. ['lat1', 'standard_parallel_1', d2r],
  8042. ['lat2', 'standard_parallel_2', d2r],
  8043. ['azimuth', 'Azimuth'],
  8044. ['alpha', 'azimuth', d2r],
  8045. ['srsCode', 'name']
  8046. ];
  8047. list.forEach(renamer);
  8048. if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
  8049. wkt.long0 = wkt.longc;
  8050. }
  8051. if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
  8052. wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
  8053. wkt.lat_ts = wkt.lat1;
  8054. }
  8055. }
  8056. var wkt = function(wkt) {
  8057. var lisp = parseString(wkt);
  8058. var type = lisp.shift();
  8059. var name = lisp.shift();
  8060. lisp.unshift(['name', name]);
  8061. lisp.unshift(['type', type]);
  8062. var obj = {};
  8063. sExpr(lisp, obj);
  8064. cleanWKT(obj);
  8065. return obj;
  8066. };
  8067. function defs(name) {
  8068. /*global console*/
  8069. var that = this;
  8070. if (arguments.length === 2) {
  8071. var def = arguments[1];
  8072. if (typeof def === 'string') {
  8073. if (def.charAt(0) === '+') {
  8074. defs[name] = parseProj(arguments[1]);
  8075. }
  8076. else {
  8077. defs[name] = wkt(arguments[1]);
  8078. }
  8079. } else {
  8080. defs[name] = def;
  8081. }
  8082. }
  8083. else if (arguments.length === 1) {
  8084. if (Array.isArray(name)) {
  8085. return name.map(function(v) {
  8086. if (Array.isArray(v)) {
  8087. defs.apply(that, v);
  8088. }
  8089. else {
  8090. defs(v);
  8091. }
  8092. });
  8093. }
  8094. else if (typeof name === 'string') {
  8095. if (name in defs) {
  8096. return defs[name];
  8097. }
  8098. }
  8099. else if ('EPSG' in name) {
  8100. defs['EPSG:' + name.EPSG] = name;
  8101. }
  8102. else if ('ESRI' in name) {
  8103. defs['ESRI:' + name.ESRI] = name;
  8104. }
  8105. else if ('IAU2000' in name) {
  8106. defs['IAU2000:' + name.IAU2000] = name;
  8107. }
  8108. else {
  8109. console.log(name);
  8110. }
  8111. return;
  8112. }
  8113. }
  8114. globals(defs);
  8115. function testObj(code){
  8116. return typeof code === 'string';
  8117. }
  8118. function testDef(code){
  8119. return code in defs;
  8120. }
  8121. var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
  8122. function testWKT(code){
  8123. return codeWords.some(function (word) {
  8124. return code.indexOf(word) > -1;
  8125. });
  8126. }
  8127. var codes = ['3857', '900913', '3785', '102113'];
  8128. function checkMercator(item) {
  8129. var auth = match(item, 'authority');
  8130. if (!auth) {
  8131. return;
  8132. }
  8133. var code = match(auth, 'epsg');
  8134. return code && codes.indexOf(code) > -1;
  8135. }
  8136. function checkProjStr(item) {
  8137. var ext = match(item, 'extension');
  8138. if (!ext) {
  8139. return;
  8140. }
  8141. return match(ext, 'proj4');
  8142. }
  8143. function testProj(code){
  8144. return code[0] === '+';
  8145. }
  8146. function parse(code){
  8147. if (testObj(code)) {
  8148. //check to see if this is a WKT string
  8149. if (testDef(code)) {
  8150. return defs[code];
  8151. }
  8152. if (testWKT(code)) {
  8153. var out = wkt(code);
  8154. // test of spetial case, due to this being a very common and often malformed
  8155. if (checkMercator(out)) {
  8156. return defs['EPSG:3857'];
  8157. }
  8158. var maybeProjStr = checkProjStr(out);
  8159. if (maybeProjStr) {
  8160. return parseProj(maybeProjStr);
  8161. }
  8162. return out;
  8163. }
  8164. if (testProj(code)) {
  8165. return parseProj(code);
  8166. }
  8167. }else{
  8168. return code;
  8169. }
  8170. }
  8171. var extend = function(destination, source) {
  8172. destination = destination || {};
  8173. var value, property;
  8174. if (!source) {
  8175. return destination;
  8176. }
  8177. for (property in source) {
  8178. value = source[property];
  8179. if (value !== undefined) {
  8180. destination[property] = value;
  8181. }
  8182. }
  8183. return destination;
  8184. };
  8185. var msfnz = function(eccent, sinphi, cosphi) {
  8186. var con = eccent * sinphi;
  8187. return cosphi / (Math.sqrt(1 - con * con));
  8188. };
  8189. var sign = function(x) {
  8190. return x<0 ? -1 : 1;
  8191. };
  8192. var adjust_lon = function(x) {
  8193. return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
  8194. };
  8195. var tsfnz = function(eccent, phi, sinphi) {
  8196. var con = eccent * sinphi;
  8197. var com = 0.5 * eccent;
  8198. con = Math.pow(((1 - con) / (1 + con)), com);
  8199. return (Math.tan(0.5 * (HALF_PI - phi)) / con);
  8200. };
  8201. var phi2z = function(eccent, ts) {
  8202. var eccnth = 0.5 * eccent;
  8203. var con, dphi;
  8204. var phi = HALF_PI - 2 * Math.atan(ts);
  8205. for (var i = 0; i <= 15; i++) {
  8206. con = eccent * Math.sin(phi);
  8207. dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
  8208. phi += dphi;
  8209. if (Math.abs(dphi) <= 0.0000000001) {
  8210. return phi;
  8211. }
  8212. }
  8213. //console.log("phi2z has NoConvergence");
  8214. return -9999;
  8215. };
  8216. function init() {
  8217. var con = this.b / this.a;
  8218. this.es = 1 - con * con;
  8219. if(!('x0' in this)){
  8220. this.x0 = 0;
  8221. }
  8222. if(!('y0' in this)){
  8223. this.y0 = 0;
  8224. }
  8225. this.e = Math.sqrt(this.es);
  8226. if (this.lat_ts) {
  8227. if (this.sphere) {
  8228. this.k0 = Math.cos(this.lat_ts);
  8229. }
  8230. else {
  8231. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  8232. }
  8233. }
  8234. else {
  8235. if (!this.k0) {
  8236. if (this.k) {
  8237. this.k0 = this.k;
  8238. }
  8239. else {
  8240. this.k0 = 1;
  8241. }
  8242. }
  8243. }
  8244. }
  8245. /* Mercator forward equations--mapping lat,long to x,y
  8246. --------------------------------------------------*/
  8247. function forward(p) {
  8248. var lon = p.x;
  8249. var lat = p.y;
  8250. // convert to radians
  8251. if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
  8252. return null;
  8253. }
  8254. var x, y;
  8255. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  8256. return null;
  8257. }
  8258. else {
  8259. if (this.sphere) {
  8260. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  8261. y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
  8262. }
  8263. else {
  8264. var sinphi = Math.sin(lat);
  8265. var ts = tsfnz(this.e, lat, sinphi);
  8266. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  8267. y = this.y0 - this.a * this.k0 * Math.log(ts);
  8268. }
  8269. p.x = x;
  8270. p.y = y;
  8271. return p;
  8272. }
  8273. }
  8274. /* Mercator inverse equations--mapping x,y to lat/long
  8275. --------------------------------------------------*/
  8276. function inverse(p) {
  8277. var x = p.x - this.x0;
  8278. var y = p.y - this.y0;
  8279. var lon, lat;
  8280. if (this.sphere) {
  8281. lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
  8282. }
  8283. else {
  8284. var ts = Math.exp(-y / (this.a * this.k0));
  8285. lat = phi2z(this.e, ts);
  8286. if (lat === -9999) {
  8287. return null;
  8288. }
  8289. }
  8290. lon = adjust_lon(this.long0 + x / (this.a * this.k0));
  8291. p.x = lon;
  8292. p.y = lat;
  8293. return p;
  8294. }
  8295. var names$1 = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
  8296. var merc = {
  8297. init: init,
  8298. forward: forward,
  8299. inverse: inverse,
  8300. names: names$1
  8301. };
  8302. function init$1() {
  8303. //no-op for longlat
  8304. }
  8305. function identity(pt) {
  8306. return pt;
  8307. }
  8308. var names$2 = ["longlat", "identity"];
  8309. var longlat = {
  8310. init: init$1,
  8311. forward: identity,
  8312. inverse: identity,
  8313. names: names$2
  8314. };
  8315. var projs = [merc, longlat];
  8316. var names = {};
  8317. var projStore = [];
  8318. function add(proj, i) {
  8319. var len = projStore.length;
  8320. if (!proj.names) {
  8321. console.log(i);
  8322. return true;
  8323. }
  8324. projStore[len] = proj;
  8325. proj.names.forEach(function(n) {
  8326. names[n.toLowerCase()] = len;
  8327. });
  8328. return this;
  8329. }
  8330. function get(name) {
  8331. if (!name) {
  8332. return false;
  8333. }
  8334. var n = name.toLowerCase();
  8335. if (typeof names[n] !== 'undefined' && projStore[names[n]]) {
  8336. return projStore[names[n]];
  8337. }
  8338. }
  8339. function start() {
  8340. projs.forEach(add);
  8341. }
  8342. var projections = {
  8343. start: start,
  8344. add: add,
  8345. get: get
  8346. };
  8347. var exports$2 = {};
  8348. exports$2.MERIT = {
  8349. a: 6378137.0,
  8350. rf: 298.257,
  8351. ellipseName: "MERIT 1983"
  8352. };
  8353. exports$2.SGS85 = {
  8354. a: 6378136.0,
  8355. rf: 298.257,
  8356. ellipseName: "Soviet Geodetic System 85"
  8357. };
  8358. exports$2.GRS80 = {
  8359. a: 6378137.0,
  8360. rf: 298.257222101,
  8361. ellipseName: "GRS 1980(IUGG, 1980)"
  8362. };
  8363. exports$2.IAU76 = {
  8364. a: 6378140.0,
  8365. rf: 298.257,
  8366. ellipseName: "IAU 1976"
  8367. };
  8368. exports$2.airy = {
  8369. a: 6377563.396,
  8370. b: 6356256.910,
  8371. ellipseName: "Airy 1830"
  8372. };
  8373. exports$2.APL4 = {
  8374. a: 6378137,
  8375. rf: 298.25,
  8376. ellipseName: "Appl. Physics. 1965"
  8377. };
  8378. exports$2.NWL9D = {
  8379. a: 6378145.0,
  8380. rf: 298.25,
  8381. ellipseName: "Naval Weapons Lab., 1965"
  8382. };
  8383. exports$2.mod_airy = {
  8384. a: 6377340.189,
  8385. b: 6356034.446,
  8386. ellipseName: "Modified Airy"
  8387. };
  8388. exports$2.andrae = {
  8389. a: 6377104.43,
  8390. rf: 300.0,
  8391. ellipseName: "Andrae 1876 (Den., Iclnd.)"
  8392. };
  8393. exports$2.aust_SA = {
  8394. a: 6378160.0,
  8395. rf: 298.25,
  8396. ellipseName: "Australian Natl & S. Amer. 1969"
  8397. };
  8398. exports$2.GRS67 = {
  8399. a: 6378160.0,
  8400. rf: 298.2471674270,
  8401. ellipseName: "GRS 67(IUGG 1967)"
  8402. };
  8403. exports$2.bessel = {
  8404. a: 6377397.155,
  8405. rf: 299.1528128,
  8406. ellipseName: "Bessel 1841"
  8407. };
  8408. exports$2.bess_nam = {
  8409. a: 6377483.865,
  8410. rf: 299.1528128,
  8411. ellipseName: "Bessel 1841 (Namibia)"
  8412. };
  8413. exports$2.clrk66 = {
  8414. a: 6378206.4,
  8415. b: 6356583.8,
  8416. ellipseName: "Clarke 1866"
  8417. };
  8418. exports$2.clrk80 = {
  8419. a: 6378249.145,
  8420. rf: 293.4663,
  8421. ellipseName: "Clarke 1880 mod."
  8422. };
  8423. exports$2.clrk80ign = {
  8424. a: 6378249.2,
  8425. b: 6356515,
  8426. rf: 293.4660213,
  8427. ellipseName: "Clarke 1880 (IGN)"
  8428. };
  8429. exports$2.clrk58 = {
  8430. a: 6378293.645208759,
  8431. rf: 294.2606763692654,
  8432. ellipseName: "Clarke 1858"
  8433. };
  8434. exports$2.CPM = {
  8435. a: 6375738.7,
  8436. rf: 334.29,
  8437. ellipseName: "Comm. des Poids et Mesures 1799"
  8438. };
  8439. exports$2.delmbr = {
  8440. a: 6376428.0,
  8441. rf: 311.5,
  8442. ellipseName: "Delambre 1810 (Belgium)"
  8443. };
  8444. exports$2.engelis = {
  8445. a: 6378136.05,
  8446. rf: 298.2566,
  8447. ellipseName: "Engelis 1985"
  8448. };
  8449. exports$2.evrst30 = {
  8450. a: 6377276.345,
  8451. rf: 300.8017,
  8452. ellipseName: "Everest 1830"
  8453. };
  8454. exports$2.evrst48 = {
  8455. a: 6377304.063,
  8456. rf: 300.8017,
  8457. ellipseName: "Everest 1948"
  8458. };
  8459. exports$2.evrst56 = {
  8460. a: 6377301.243,
  8461. rf: 300.8017,
  8462. ellipseName: "Everest 1956"
  8463. };
  8464. exports$2.evrst69 = {
  8465. a: 6377295.664,
  8466. rf: 300.8017,
  8467. ellipseName: "Everest 1969"
  8468. };
  8469. exports$2.evrstSS = {
  8470. a: 6377298.556,
  8471. rf: 300.8017,
  8472. ellipseName: "Everest (Sabah & Sarawak)"
  8473. };
  8474. exports$2.fschr60 = {
  8475. a: 6378166.0,
  8476. rf: 298.3,
  8477. ellipseName: "Fischer (Mercury Datum) 1960"
  8478. };
  8479. exports$2.fschr60m = {
  8480. a: 6378155.0,
  8481. rf: 298.3,
  8482. ellipseName: "Fischer 1960"
  8483. };
  8484. exports$2.fschr68 = {
  8485. a: 6378150.0,
  8486. rf: 298.3,
  8487. ellipseName: "Fischer 1968"
  8488. };
  8489. exports$2.helmert = {
  8490. a: 6378200.0,
  8491. rf: 298.3,
  8492. ellipseName: "Helmert 1906"
  8493. };
  8494. exports$2.hough = {
  8495. a: 6378270.0,
  8496. rf: 297.0,
  8497. ellipseName: "Hough"
  8498. };
  8499. exports$2.intl = {
  8500. a: 6378388.0,
  8501. rf: 297.0,
  8502. ellipseName: "International 1909 (Hayford)"
  8503. };
  8504. exports$2.kaula = {
  8505. a: 6378163.0,
  8506. rf: 298.24,
  8507. ellipseName: "Kaula 1961"
  8508. };
  8509. exports$2.lerch = {
  8510. a: 6378139.0,
  8511. rf: 298.257,
  8512. ellipseName: "Lerch 1979"
  8513. };
  8514. exports$2.mprts = {
  8515. a: 6397300.0,
  8516. rf: 191.0,
  8517. ellipseName: "Maupertius 1738"
  8518. };
  8519. exports$2.new_intl = {
  8520. a: 6378157.5,
  8521. b: 6356772.2,
  8522. ellipseName: "New International 1967"
  8523. };
  8524. exports$2.plessis = {
  8525. a: 6376523.0,
  8526. rf: 6355863.0,
  8527. ellipseName: "Plessis 1817 (France)"
  8528. };
  8529. exports$2.krass = {
  8530. a: 6378245.0,
  8531. rf: 298.3,
  8532. ellipseName: "Krassovsky, 1942"
  8533. };
  8534. exports$2.SEasia = {
  8535. a: 6378155.0,
  8536. b: 6356773.3205,
  8537. ellipseName: "Southeast Asia"
  8538. };
  8539. exports$2.walbeck = {
  8540. a: 6376896.0,
  8541. b: 6355834.8467,
  8542. ellipseName: "Walbeck"
  8543. };
  8544. exports$2.WGS60 = {
  8545. a: 6378165.0,
  8546. rf: 298.3,
  8547. ellipseName: "WGS 60"
  8548. };
  8549. exports$2.WGS66 = {
  8550. a: 6378145.0,
  8551. rf: 298.25,
  8552. ellipseName: "WGS 66"
  8553. };
  8554. exports$2.WGS7 = {
  8555. a: 6378135.0,
  8556. rf: 298.26,
  8557. ellipseName: "WGS 72"
  8558. };
  8559. var WGS84 = exports$2.WGS84 = {
  8560. a: 6378137.0,
  8561. rf: 298.257223563,
  8562. ellipseName: "WGS 84"
  8563. };
  8564. exports$2.sphere = {
  8565. a: 6370997.0,
  8566. b: 6370997.0,
  8567. ellipseName: "Normal Sphere (r=6370997)"
  8568. };
  8569. function eccentricity(a, b, rf, R_A) {
  8570. var a2 = a * a; // used in geocentric
  8571. var b2 = b * b; // used in geocentric
  8572. var es = (a2 - b2) / a2; // e ^ 2
  8573. var e = 0;
  8574. if (R_A) {
  8575. a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
  8576. a2 = a * a;
  8577. es = 0;
  8578. } else {
  8579. e = Math.sqrt(es); // eccentricity
  8580. }
  8581. var ep2 = (a2 - b2) / b2; // used in geocentric
  8582. return {
  8583. es: es,
  8584. e: e,
  8585. ep2: ep2
  8586. };
  8587. }
  8588. function sphere(a, b, rf, ellps, sphere) {
  8589. if (!a) { // do we have an ellipsoid?
  8590. var ellipse = match(exports$2, ellps);
  8591. if (!ellipse) {
  8592. ellipse = WGS84;
  8593. }
  8594. a = ellipse.a;
  8595. b = ellipse.b;
  8596. rf = ellipse.rf;
  8597. }
  8598. if (rf && !b) {
  8599. b = (1.0 - 1.0 / rf) * a;
  8600. }
  8601. if (rf === 0 || Math.abs(a - b) < EPSLN) {
  8602. sphere = true;
  8603. b = a;
  8604. }
  8605. return {
  8606. a: a,
  8607. b: b,
  8608. rf: rf,
  8609. sphere: sphere
  8610. };
  8611. }
  8612. var exports$3 = {};
  8613. exports$3.wgs84 = {
  8614. towgs84: "0,0,0",
  8615. ellipse: "WGS84",
  8616. datumName: "WGS84"
  8617. };
  8618. exports$3.ch1903 = {
  8619. towgs84: "674.374,15.056,405.346",
  8620. ellipse: "bessel",
  8621. datumName: "swiss"
  8622. };
  8623. exports$3.ggrs87 = {
  8624. towgs84: "-199.87,74.79,246.62",
  8625. ellipse: "GRS80",
  8626. datumName: "Greek_Geodetic_Reference_System_1987"
  8627. };
  8628. exports$3.nad83 = {
  8629. towgs84: "0,0,0",
  8630. ellipse: "GRS80",
  8631. datumName: "North_American_Datum_1983"
  8632. };
  8633. exports$3.nad27 = {
  8634. nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
  8635. ellipse: "clrk66",
  8636. datumName: "North_American_Datum_1927"
  8637. };
  8638. exports$3.potsdam = {
  8639. towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
  8640. ellipse: "bessel",
  8641. datumName: "Potsdam Rauenberg 1950 DHDN"
  8642. };
  8643. exports$3.carthage = {
  8644. towgs84: "-263.0,6.0,431.0",
  8645. ellipse: "clark80",
  8646. datumName: "Carthage 1934 Tunisia"
  8647. };
  8648. exports$3.hermannskogel = {
  8649. towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
  8650. ellipse: "bessel",
  8651. datumName: "Hermannskogel"
  8652. };
  8653. exports$3.osni52 = {
  8654. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  8655. ellipse: "airy",
  8656. datumName: "Irish National"
  8657. };
  8658. exports$3.ire65 = {
  8659. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  8660. ellipse: "mod_airy",
  8661. datumName: "Ireland 1965"
  8662. };
  8663. exports$3.rassadiran = {
  8664. towgs84: "-133.63,-157.5,-158.62",
  8665. ellipse: "intl",
  8666. datumName: "Rassadiran"
  8667. };
  8668. exports$3.nzgd49 = {
  8669. towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
  8670. ellipse: "intl",
  8671. datumName: "New Zealand Geodetic Datum 1949"
  8672. };
  8673. exports$3.osgb36 = {
  8674. towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
  8675. ellipse: "airy",
  8676. datumName: "Airy 1830"
  8677. };
  8678. exports$3.s_jtsk = {
  8679. towgs84: "589,76,480",
  8680. ellipse: 'bessel',
  8681. datumName: 'S-JTSK (Ferro)'
  8682. };
  8683. exports$3.beduaram = {
  8684. towgs84: '-106,-87,188',
  8685. ellipse: 'clrk80',
  8686. datumName: 'Beduaram'
  8687. };
  8688. exports$3.gunung_segara = {
  8689. towgs84: '-403,684,41',
  8690. ellipse: 'bessel',
  8691. datumName: 'Gunung Segara Jakarta'
  8692. };
  8693. exports$3.rnb72 = {
  8694. towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
  8695. ellipse: "intl",
  8696. datumName: "Reseau National Belge 1972"
  8697. };
  8698. function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
  8699. var out = {};
  8700. if (datumCode === undefined || datumCode === 'none') {
  8701. out.datum_type = PJD_NODATUM;
  8702. } else {
  8703. out.datum_type = PJD_WGS84;
  8704. }
  8705. if (datum_params) {
  8706. out.datum_params = datum_params.map(parseFloat);
  8707. if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
  8708. out.datum_type = PJD_3PARAM;
  8709. }
  8710. if (out.datum_params.length > 3) {
  8711. if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
  8712. out.datum_type = PJD_7PARAM;
  8713. out.datum_params[3] *= SEC_TO_RAD;
  8714. out.datum_params[4] *= SEC_TO_RAD;
  8715. out.datum_params[5] *= SEC_TO_RAD;
  8716. out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
  8717. }
  8718. }
  8719. }
  8720. if (nadgrids) {
  8721. out.datum_type = PJD_GRIDSHIFT;
  8722. out.grids = nadgrids;
  8723. }
  8724. out.a = a; //datum object also uses these values
  8725. out.b = b;
  8726. out.es = es;
  8727. out.ep2 = ep2;
  8728. return out;
  8729. }
  8730. /**
  8731. * Resources for details of NTv2 file formats:
  8732. * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf
  8733. * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm
  8734. */
  8735. var loadedNadgrids = {};
  8736. /**
  8737. * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file
  8738. * as an ArrayBuffer.
  8739. */
  8740. function nadgrid(key, data) {
  8741. var view = new DataView(data);
  8742. var isLittleEndian = detectLittleEndian(view);
  8743. var header = readHeader(view, isLittleEndian);
  8744. if (header.nSubgrids > 1) {
  8745. console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored');
  8746. }
  8747. var subgrids = readSubgrids(view, header, isLittleEndian);
  8748. var nadgrid = {header: header, subgrids: subgrids};
  8749. loadedNadgrids[key] = nadgrid;
  8750. return nadgrid;
  8751. }
  8752. /**
  8753. * Given a proj4 value for nadgrids, return an array of loaded grids
  8754. */
  8755. function getNadgrids(nadgrids) {
  8756. // Format details: http://proj.maptools.org/gen_parms.html
  8757. if (nadgrids === undefined) { return null; }
  8758. var grids = nadgrids.split(',');
  8759. return grids.map(parseNadgridString);
  8760. }
  8761. function parseNadgridString(value) {
  8762. if (value.length === 0) {
  8763. return null;
  8764. }
  8765. var optional = value[0] === '@';
  8766. if (optional) {
  8767. value = value.slice(1);
  8768. }
  8769. if (value === 'null') {
  8770. return {name: 'null', mandatory: !optional, grid: null, isNull: true};
  8771. }
  8772. return {
  8773. name: value,
  8774. mandatory: !optional,
  8775. grid: loadedNadgrids[value] || null,
  8776. isNull: false
  8777. };
  8778. }
  8779. function secondsToRadians(seconds) {
  8780. return (seconds / 3600) * Math.PI / 180;
  8781. }
  8782. function detectLittleEndian(view) {
  8783. var nFields = view.getInt32(8, false);
  8784. if (nFields === 11) {
  8785. return false;
  8786. }
  8787. nFields = view.getInt32(8, true);
  8788. if (nFields !== 11) {
  8789. console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');
  8790. }
  8791. return true;
  8792. }
  8793. function readHeader(view, isLittleEndian) {
  8794. return {
  8795. nFields: view.getInt32(8, isLittleEndian),
  8796. nSubgridFields: view.getInt32(24, isLittleEndian),
  8797. nSubgrids: view.getInt32(40, isLittleEndian),
  8798. shiftType: decodeString(view, 56, 56 + 8).trim(),
  8799. fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),
  8800. fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),
  8801. toSemiMajorAxis: view.getFloat64(152, isLittleEndian),
  8802. toSemiMinorAxis: view.getFloat64(168, isLittleEndian),
  8803. };
  8804. }
  8805. function decodeString(view, start, end) {
  8806. return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));
  8807. }
  8808. function readSubgrids(view, header, isLittleEndian) {
  8809. var gridOffset = 176;
  8810. var grids = [];
  8811. for (var i = 0; i < header.nSubgrids; i++) {
  8812. var subHeader = readGridHeader(view, gridOffset, isLittleEndian);
  8813. var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);
  8814. var lngColumnCount = Math.round(
  8815. 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);
  8816. var latColumnCount = Math.round(
  8817. 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);
  8818. // Proj4 operates on radians whereas the coordinates are in seconds in the grid
  8819. grids.push({
  8820. ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],
  8821. del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],
  8822. lim: [lngColumnCount, latColumnCount],
  8823. count: subHeader.gridNodeCount,
  8824. cvs: mapNodes(nodes)
  8825. });
  8826. }
  8827. return grids;
  8828. }
  8829. function mapNodes(nodes) {
  8830. return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];});
  8831. }
  8832. function readGridHeader(view, offset, isLittleEndian) {
  8833. return {
  8834. name: decodeString(view, offset + 8, offset + 16).trim(),
  8835. parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),
  8836. lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),
  8837. upperLatitude: view.getFloat64(offset + 88, isLittleEndian),
  8838. lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),
  8839. upperLongitude: view.getFloat64(offset + 120, isLittleEndian),
  8840. latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),
  8841. longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),
  8842. gridNodeCount: view.getInt32(offset + 168, isLittleEndian)
  8843. };
  8844. }
  8845. function readGridNodes(view, offset, gridHeader, isLittleEndian) {
  8846. var nodesOffset = offset + 176;
  8847. var gridRecordLength = 16;
  8848. var gridShiftRecords = [];
  8849. for (var i = 0; i < gridHeader.gridNodeCount; i++) {
  8850. var record = {
  8851. latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),
  8852. longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),
  8853. latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),
  8854. longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian),
  8855. };
  8856. gridShiftRecords.push(record);
  8857. }
  8858. return gridShiftRecords;
  8859. }
  8860. function Projection(srsCode,callback) {
  8861. if (!(this instanceof Projection)) {
  8862. return new Projection(srsCode);
  8863. }
  8864. callback = callback || function(error){
  8865. if(error){
  8866. throw error;
  8867. }
  8868. };
  8869. var json = parse(srsCode);
  8870. if(typeof json !== 'object'){
  8871. callback(srsCode);
  8872. return;
  8873. }
  8874. var ourProj = Projection.projections.get(json.projName);
  8875. if(!ourProj){
  8876. callback(srsCode);
  8877. return;
  8878. }
  8879. if (json.datumCode && json.datumCode !== 'none') {
  8880. var datumDef = match(exports$3, json.datumCode);
  8881. if (datumDef) {
  8882. json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);
  8883. json.ellps = datumDef.ellipse;
  8884. json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
  8885. }
  8886. }
  8887. json.k0 = json.k0 || 1.0;
  8888. json.axis = json.axis || 'enu';
  8889. json.ellps = json.ellps || 'wgs84';
  8890. json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this
  8891. var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
  8892. var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
  8893. var nadgrids = getNadgrids(json.nadgrids);
  8894. var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2,
  8895. nadgrids);
  8896. extend(this, json); // transfer everything over from the projection because we don't know what we'll need
  8897. extend(this, ourProj); // transfer all the methods from the projection
  8898. // copy the 4 things over we calculated in deriveConstants.sphere
  8899. this.a = sphere_.a;
  8900. this.b = sphere_.b;
  8901. this.rf = sphere_.rf;
  8902. this.sphere = sphere_.sphere;
  8903. // copy the 3 things we calculated in deriveConstants.eccentricity
  8904. this.es = ecc.es;
  8905. this.e = ecc.e;
  8906. this.ep2 = ecc.ep2;
  8907. // add in the datum object
  8908. this.datum = datumObj;
  8909. // init the projection
  8910. this.init();
  8911. // legecy callback from back in the day when it went to spatialreference.org
  8912. callback(null, this);
  8913. }
  8914. Projection.projections = projections;
  8915. Projection.projections.start();
  8916. 'use strict';
  8917. function compareDatums(source, dest) {
  8918. if (source.datum_type !== dest.datum_type) {
  8919. return false; // false, datums are not equal
  8920. } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
  8921. // the tolerance for es is to ensure that GRS80 and WGS84
  8922. // are considered identical
  8923. return false;
  8924. } else if (source.datum_type === PJD_3PARAM) {
  8925. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
  8926. } else if (source.datum_type === PJD_7PARAM) {
  8927. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
  8928. } else {
  8929. return true; // datums are equal
  8930. }
  8931. } // cs_compare_datums()
  8932. /*
  8933. * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
  8934. * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
  8935. * according to the current ellipsoid parameters.
  8936. *
  8937. * Latitude : Geodetic latitude in radians (input)
  8938. * Longitude : Geodetic longitude in radians (input)
  8939. * Height : Geodetic height, in meters (input)
  8940. * X : Calculated Geocentric X coordinate, in meters (output)
  8941. * Y : Calculated Geocentric Y coordinate, in meters (output)
  8942. * Z : Calculated Geocentric Z coordinate, in meters (output)
  8943. *
  8944. */
  8945. function geodeticToGeocentric(p, es, a) {
  8946. var Longitude = p.x;
  8947. var Latitude = p.y;
  8948. var Height = p.z ? p.z : 0; //Z value not always supplied
  8949. var Rn; /* Earth radius at location */
  8950. var Sin_Lat; /* Math.sin(Latitude) */
  8951. var Sin2_Lat; /* Square of Math.sin(Latitude) */
  8952. var Cos_Lat; /* Math.cos(Latitude) */
  8953. /*
  8954. ** Don't blow up if Latitude is just a little out of the value
  8955. ** range as it may just be a rounding issue. Also removed longitude
  8956. ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
  8957. */
  8958. if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
  8959. Latitude = -HALF_PI;
  8960. } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
  8961. Latitude = HALF_PI;
  8962. } else if (Latitude < -HALF_PI) {
  8963. /* Latitude out of range */
  8964. //..reportError('geocent:lat out of range:' + Latitude);
  8965. return { x: -Infinity, y: -Infinity, z: p.z };
  8966. } else if (Latitude > HALF_PI) {
  8967. /* Latitude out of range */
  8968. return { x: Infinity, y: Infinity, z: p.z };
  8969. }
  8970. if (Longitude > Math.PI) {
  8971. Longitude -= (2 * Math.PI);
  8972. }
  8973. Sin_Lat = Math.sin(Latitude);
  8974. Cos_Lat = Math.cos(Latitude);
  8975. Sin2_Lat = Sin_Lat * Sin_Lat;
  8976. Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
  8977. return {
  8978. x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
  8979. y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
  8980. z: ((Rn * (1 - es)) + Height) * Sin_Lat
  8981. };
  8982. } // cs_geodetic_to_geocentric()
  8983. function geocentricToGeodetic(p, es, a, b) {
  8984. /* local defintions and variables */
  8985. /* end-criterium of loop, accuracy of sin(Latitude) */
  8986. var genau = 1e-12;
  8987. var genau2 = (genau * genau);
  8988. var maxiter = 30;
  8989. var P; /* distance between semi-minor axis and location */
  8990. var RR; /* distance between center and location */
  8991. var CT; /* sin of geocentric latitude */
  8992. var ST; /* cos of geocentric latitude */
  8993. var RX;
  8994. var RK;
  8995. var RN; /* Earth radius at location */
  8996. var CPHI0; /* cos of start or old geodetic latitude in iterations */
  8997. var SPHI0; /* sin of start or old geodetic latitude in iterations */
  8998. var CPHI; /* cos of searched geodetic latitude */
  8999. var SPHI; /* sin of searched geodetic latitude */
  9000. var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
  9001. var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
  9002. var X = p.x;
  9003. var Y = p.y;
  9004. var Z = p.z ? p.z : 0.0; //Z value not always supplied
  9005. var Longitude;
  9006. var Latitude;
  9007. var Height;
  9008. P = Math.sqrt(X * X + Y * Y);
  9009. RR = Math.sqrt(X * X + Y * Y + Z * Z);
  9010. /* special cases for latitude and longitude */
  9011. if (P / a < genau) {
  9012. /* special case, if P=0. (X=0., Y=0.) */
  9013. Longitude = 0.0;
  9014. /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
  9015. * of ellipsoid (=center of mass), Latitude becomes PI/2 */
  9016. if (RR / a < genau) {
  9017. Latitude = HALF_PI;
  9018. Height = -b;
  9019. return {
  9020. x: p.x,
  9021. y: p.y,
  9022. z: p.z
  9023. };
  9024. }
  9025. } else {
  9026. /* ellipsoidal (geodetic) longitude
  9027. * interval: -PI < Longitude <= +PI */
  9028. Longitude = Math.atan2(Y, X);
  9029. }
  9030. /* --------------------------------------------------------------
  9031. * Following iterative algorithm was developped by
  9032. * "Institut for Erdmessung", University of Hannover, July 1988.
  9033. * Internet: www.ife.uni-hannover.de
  9034. * Iterative computation of CPHI,SPHI and Height.
  9035. * Iteration of CPHI and SPHI to 10**-12 radian resp.
  9036. * 2*10**-7 arcsec.
  9037. * --------------------------------------------------------------
  9038. */
  9039. CT = Z / RR;
  9040. ST = P / RR;
  9041. RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
  9042. CPHI0 = ST * (1.0 - es) * RX;
  9043. SPHI0 = CT * RX;
  9044. iter = 0;
  9045. /* loop to find sin(Latitude) resp. Latitude
  9046. * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
  9047. do {
  9048. iter++;
  9049. RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
  9050. /* ellipsoidal (geodetic) height */
  9051. Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
  9052. RK = es * RN / (RN + Height);
  9053. RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
  9054. CPHI = ST * (1.0 - RK) * RX;
  9055. SPHI = CT * RX;
  9056. SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
  9057. CPHI0 = CPHI;
  9058. SPHI0 = SPHI;
  9059. }
  9060. while (SDPHI * SDPHI > genau2 && iter < maxiter);
  9061. /* ellipsoidal (geodetic) latitude */
  9062. Latitude = Math.atan(SPHI / Math.abs(CPHI));
  9063. return {
  9064. x: Longitude,
  9065. y: Latitude,
  9066. z: Height
  9067. };
  9068. } // cs_geocentric_to_geodetic()
  9069. /****************************************************************/
  9070. // pj_geocentic_to_wgs84( p )
  9071. // p = point to transform in geocentric coordinates (x,y,z)
  9072. /** point object, nothing fancy, just allows values to be
  9073. passed back and forth by reference rather than by value.
  9074. Other point classes may be used as long as they have
  9075. x and y properties, which will get modified in the transform method.
  9076. */
  9077. function geocentricToWgs84(p, datum_type, datum_params) {
  9078. if (datum_type === PJD_3PARAM) {
  9079. // if( x[io] === HUGE_VAL )
  9080. // continue;
  9081. return {
  9082. x: p.x + datum_params[0],
  9083. y: p.y + datum_params[1],
  9084. z: p.z + datum_params[2],
  9085. };
  9086. } else if (datum_type === PJD_7PARAM) {
  9087. var Dx_BF = datum_params[0];
  9088. var Dy_BF = datum_params[1];
  9089. var Dz_BF = datum_params[2];
  9090. var Rx_BF = datum_params[3];
  9091. var Ry_BF = datum_params[4];
  9092. var Rz_BF = datum_params[5];
  9093. var M_BF = datum_params[6];
  9094. // if( x[io] === HUGE_VAL )
  9095. // continue;
  9096. return {
  9097. x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
  9098. y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
  9099. z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
  9100. };
  9101. }
  9102. } // cs_geocentric_to_wgs84
  9103. /****************************************************************/
  9104. // pj_geocentic_from_wgs84()
  9105. // coordinate system definition,
  9106. // point to transform in geocentric coordinates (x,y,z)
  9107. function geocentricFromWgs84(p, datum_type, datum_params) {
  9108. if (datum_type === PJD_3PARAM) {
  9109. //if( x[io] === HUGE_VAL )
  9110. // continue;
  9111. return {
  9112. x: p.x - datum_params[0],
  9113. y: p.y - datum_params[1],
  9114. z: p.z - datum_params[2],
  9115. };
  9116. } else if (datum_type === PJD_7PARAM) {
  9117. var Dx_BF = datum_params[0];
  9118. var Dy_BF = datum_params[1];
  9119. var Dz_BF = datum_params[2];
  9120. var Rx_BF = datum_params[3];
  9121. var Ry_BF = datum_params[4];
  9122. var Rz_BF = datum_params[5];
  9123. var M_BF = datum_params[6];
  9124. var x_tmp = (p.x - Dx_BF) / M_BF;
  9125. var y_tmp = (p.y - Dy_BF) / M_BF;
  9126. var z_tmp = (p.z - Dz_BF) / M_BF;
  9127. //if( x[io] === HUGE_VAL )
  9128. // continue;
  9129. return {
  9130. x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
  9131. y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
  9132. z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
  9133. };
  9134. } //cs_geocentric_from_wgs84()
  9135. }
  9136. function checkParams(type) {
  9137. return (type === PJD_3PARAM || type === PJD_7PARAM);
  9138. }
  9139. var datum_transform = function(source, dest, point) {
  9140. // Short cut if the datums are identical.
  9141. if (compareDatums(source, dest)) {
  9142. return point; // in this case, zero is sucess,
  9143. // whereas cs_compare_datums returns 1 to indicate TRUE
  9144. // confusing, should fix this
  9145. }
  9146. // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
  9147. if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
  9148. return point;
  9149. }
  9150. // If this datum requires grid shifts, then apply it to geodetic coordinates.
  9151. var source_a = source.a;
  9152. var source_es = source.es;
  9153. if (source.datum_type === PJD_GRIDSHIFT) {
  9154. var gridShiftCode = applyGridShift(source, false, point);
  9155. if (gridShiftCode !== 0) {
  9156. return undefined;
  9157. }
  9158. source_a = SRS_WGS84_SEMIMAJOR;
  9159. source_es = SRS_WGS84_ESQUARED;
  9160. }
  9161. var dest_a = dest.a;
  9162. var dest_b = dest.b;
  9163. var dest_es = dest.es;
  9164. if (dest.datum_type === PJD_GRIDSHIFT) {
  9165. dest_a = SRS_WGS84_SEMIMAJOR;
  9166. dest_b = SRS_WGS84_SEMIMINOR;
  9167. dest_es = SRS_WGS84_ESQUARED;
  9168. }
  9169. // Do we need to go through geocentric coordinates?
  9170. if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
  9171. return point;
  9172. }
  9173. // Convert to geocentric coordinates.
  9174. point = geodeticToGeocentric(point, source_es, source_a);
  9175. // Convert between datums
  9176. if (checkParams(source.datum_type)) {
  9177. point = geocentricToWgs84(point, source.datum_type, source.datum_params);
  9178. }
  9179. if (checkParams(dest.datum_type)) {
  9180. point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
  9181. }
  9182. point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);
  9183. if (dest.datum_type === PJD_GRIDSHIFT) {
  9184. var destGridShiftResult = applyGridShift(dest, true, point);
  9185. if (destGridShiftResult !== 0) {
  9186. return undefined;
  9187. }
  9188. }
  9189. return point;
  9190. };
  9191. function applyGridShift(source, inverse, point) {
  9192. if (source.grids === null || source.grids.length === 0) {
  9193. console.log('Grid shift grids not found');
  9194. return -1;
  9195. }
  9196. var input = {x: -point.x, y: point.y};
  9197. var output = {x: Number.NaN, y: Number.NaN};
  9198. var attemptedGrids = [];
  9199. for (var i = 0; i < source.grids.length; i++) {
  9200. var grid = source.grids[i];
  9201. attemptedGrids.push(grid.name);
  9202. if (grid.isNull) {
  9203. output = input;
  9204. break;
  9205. }
  9206. if (grid.grid === null) {
  9207. if (grid.mandatory) {
  9208. console.log("Unable to find mandatory grid '" + grid.name + "'");
  9209. return -1;
  9210. }
  9211. continue;
  9212. }
  9213. var subgrid = grid.grid.subgrids[0];
  9214. // skip tables that don't match our point at all
  9215. var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;
  9216. var minX = subgrid.ll[0] - epsilon;
  9217. var minY = subgrid.ll[1] - epsilon;
  9218. var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;
  9219. var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;
  9220. if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) {
  9221. continue;
  9222. }
  9223. output = applySubgridShift(input, inverse, subgrid);
  9224. if (!isNaN(output.x)) {
  9225. break;
  9226. }
  9227. }
  9228. if (isNaN(output.x)) {
  9229. console.log("Failed to find a grid shift table for location '"+
  9230. -input.x * R2D + " " + input.y * R2D + " tried: '" + attemptedGrids + "'");
  9231. return -1;
  9232. }
  9233. point.x = -output.x;
  9234. point.y = output.y;
  9235. return 0;
  9236. }
  9237. function applySubgridShift(pin, inverse, ct) {
  9238. var val = {x: Number.NaN, y: Number.NaN};
  9239. if (isNaN(pin.x)) { return val; }
  9240. var tb = {x: pin.x, y: pin.y};
  9241. tb.x -= ct.ll[0];
  9242. tb.y -= ct.ll[1];
  9243. tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;
  9244. var t = nadInterpolate(tb, ct);
  9245. if (inverse) {
  9246. if (isNaN(t.x)) {
  9247. return val;
  9248. }
  9249. t.x = tb.x - t.x;
  9250. t.y = tb.y - t.y;
  9251. var i = 9, tol = 1e-12;
  9252. var dif, del;
  9253. do {
  9254. del = nadInterpolate(t, ct);
  9255. if (isNaN(del.x)) {
  9256. console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");
  9257. break;
  9258. }
  9259. dif = {x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y)};
  9260. t.x += dif.x;
  9261. t.y += dif.y;
  9262. } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);
  9263. if (i < 0) {
  9264. console.log("Inverse grid shift iterator failed to converge.");
  9265. return val;
  9266. }
  9267. val.x = adjust_lon(t.x + ct.ll[0]);
  9268. val.y = t.y + ct.ll[1];
  9269. } else {
  9270. if (!isNaN(t.x)) {
  9271. val.x = pin.x + t.x;
  9272. val.y = pin.y + t.y;
  9273. }
  9274. }
  9275. return val;
  9276. }
  9277. function nadInterpolate(pin, ct) {
  9278. var t = {x: pin.x / ct.del[0], y: pin.y / ct.del[1]};
  9279. var indx = {x: Math.floor(t.x), y: Math.floor(t.y)};
  9280. var frct = {x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y};
  9281. var val= {x: Number.NaN, y: Number.NaN};
  9282. var inx;
  9283. if (indx.x < 0 || indx.x >= ct.lim[0]) {
  9284. return val;
  9285. }
  9286. if (indx.y < 0 || indx.y >= ct.lim[1]) {
  9287. return val;
  9288. }
  9289. inx = (indx.y * ct.lim[0]) + indx.x;
  9290. var f00 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  9291. inx++;
  9292. var f10= {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  9293. inx += ct.lim[0];
  9294. var f11 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  9295. inx--;
  9296. var f01 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  9297. var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y),
  9298. m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y;
  9299. val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x);
  9300. val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y);
  9301. return val;
  9302. }
  9303. var adjust_axis = function(crs, denorm, point) {
  9304. var xin = point.x,
  9305. yin = point.y,
  9306. zin = point.z || 0.0;
  9307. var v, t, i;
  9308. var out = {};
  9309. for (i = 0; i < 3; i++) {
  9310. if (denorm && i === 2 && point.z === undefined) {
  9311. continue;
  9312. }
  9313. if (i === 0) {
  9314. v = xin;
  9315. if ("ew".indexOf(crs.axis[i]) !== -1) {
  9316. t = 'x';
  9317. } else {
  9318. t = 'y';
  9319. }
  9320. }
  9321. else if (i === 1) {
  9322. v = yin;
  9323. if ("ns".indexOf(crs.axis[i]) !== -1) {
  9324. t = 'y';
  9325. } else {
  9326. t = 'x';
  9327. }
  9328. }
  9329. else {
  9330. v = zin;
  9331. t = 'z';
  9332. }
  9333. switch (crs.axis[i]) {
  9334. case 'e':
  9335. out[t] = v;
  9336. break;
  9337. case 'w':
  9338. out[t] = -v;
  9339. break;
  9340. case 'n':
  9341. out[t] = v;
  9342. break;
  9343. case 's':
  9344. out[t] = -v;
  9345. break;
  9346. case 'u':
  9347. if (point[t] !== undefined) {
  9348. out.z = v;
  9349. }
  9350. break;
  9351. case 'd':
  9352. if (point[t] !== undefined) {
  9353. out.z = -v;
  9354. }
  9355. break;
  9356. default:
  9357. //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
  9358. return null;
  9359. }
  9360. }
  9361. return out;
  9362. };
  9363. var toPoint = function (array){
  9364. var out = {
  9365. x: array[0],
  9366. y: array[1]
  9367. };
  9368. if (array.length>2) {
  9369. out.z = array[2];
  9370. }
  9371. if (array.length>3) {
  9372. out.m = array[3];
  9373. }
  9374. return out;
  9375. };
  9376. var checkSanity = function (point) {
  9377. checkCoord(point.x);
  9378. checkCoord(point.y);
  9379. };
  9380. function checkCoord(num) {
  9381. if (typeof Number.isFinite === 'function') {
  9382. if (Number.isFinite(num)) {
  9383. return;
  9384. }
  9385. throw new TypeError('coordinates must be finite numbers');
  9386. }
  9387. if (typeof num !== 'number' || num !== num || !isFinite(num)) {
  9388. throw new TypeError('coordinates must be finite numbers');
  9389. }
  9390. }
  9391. function checkNotWGS(source, dest) {
  9392. return (
  9393. (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM || source.datum.datum_type === PJD_GRIDSHIFT) && dest.datumCode !== 'WGS84') ||
  9394. ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84');
  9395. }
  9396. function transform(source, dest, point, enforceAxis) {
  9397. var wgs84;
  9398. if (Array.isArray(point)) {
  9399. point = toPoint(point);
  9400. } else {
  9401. // Clone the point object so inputs don't get modified
  9402. point = {
  9403. x: point.x,
  9404. y: point.y,
  9405. z: point.z,
  9406. m: point.m
  9407. };
  9408. }
  9409. var hasZ = point.z !== undefined;
  9410. checkSanity(point);
  9411. // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
  9412. if (source.datum && dest.datum && checkNotWGS(source, dest)) {
  9413. wgs84 = new Projection('WGS84');
  9414. point = transform(source, wgs84, point, enforceAxis);
  9415. source = wgs84;
  9416. }
  9417. // DGR, 2010/11/12
  9418. if (enforceAxis && source.axis !== 'enu') {
  9419. point = adjust_axis(source, false, point);
  9420. }
  9421. // Transform source points to long/lat, if they aren't already.
  9422. if (source.projName === 'longlat') {
  9423. point = {
  9424. x: point.x * D2R,
  9425. y: point.y * D2R,
  9426. z: point.z || 0
  9427. };
  9428. } else {
  9429. if (source.to_meter) {
  9430. point = {
  9431. x: point.x * source.to_meter,
  9432. y: point.y * source.to_meter,
  9433. z: point.z || 0
  9434. };
  9435. }
  9436. point = source.inverse(point); // Convert Cartesian to longlat
  9437. if (!point) {
  9438. return;
  9439. }
  9440. }
  9441. // Adjust for the prime meridian if necessary
  9442. if (source.from_greenwich) {
  9443. point.x += source.from_greenwich;
  9444. }
  9445. // Convert datums if needed, and if possible.
  9446. point = datum_transform(source.datum, dest.datum, point);
  9447. if (!point) {
  9448. return;
  9449. }
  9450. // Adjust for the prime meridian if necessary
  9451. if (dest.from_greenwich) {
  9452. point = {
  9453. x: point.x - dest.from_greenwich,
  9454. y: point.y,
  9455. z: point.z || 0
  9456. };
  9457. }
  9458. if (dest.projName === 'longlat') {
  9459. // convert radians to decimal degrees
  9460. point = {
  9461. x: point.x * R2D,
  9462. y: point.y * R2D,
  9463. z: point.z || 0
  9464. };
  9465. } else { // else project
  9466. point = dest.forward(point);
  9467. if (dest.to_meter) {
  9468. point = {
  9469. x: point.x / dest.to_meter,
  9470. y: point.y / dest.to_meter,
  9471. z: point.z || 0
  9472. };
  9473. }
  9474. }
  9475. // DGR, 2010/11/12
  9476. if (enforceAxis && dest.axis !== 'enu') {
  9477. return adjust_axis(dest, true, point);
  9478. }
  9479. if (!hasZ) {
  9480. delete point.z;
  9481. }
  9482. return point;
  9483. }
  9484. var wgs84 = Projection('WGS84');
  9485. function transformer(from, to, coords, enforceAxis) {
  9486. var transformedArray, out, keys;
  9487. if (Array.isArray(coords)) {
  9488. transformedArray = transform(from, to, coords, enforceAxis) || {x: NaN, y: NaN};
  9489. if (coords.length > 2) {
  9490. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  9491. if (typeof transformedArray.z === 'number') {
  9492. return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
  9493. } else {
  9494. return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
  9495. }
  9496. } else {
  9497. return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
  9498. }
  9499. } else {
  9500. return [transformedArray.x, transformedArray.y];
  9501. }
  9502. } else {
  9503. out = transform(from, to, coords, enforceAxis);
  9504. keys = Object.keys(coords);
  9505. if (keys.length === 2) {
  9506. return out;
  9507. }
  9508. keys.forEach(function (key) {
  9509. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  9510. if (key === 'x' || key === 'y' || key === 'z') {
  9511. return;
  9512. }
  9513. } else {
  9514. if (key === 'x' || key === 'y') {
  9515. return;
  9516. }
  9517. }
  9518. out[key] = coords[key];
  9519. });
  9520. return out;
  9521. }
  9522. }
  9523. function checkProj(item) {
  9524. if (item instanceof Projection) {
  9525. return item;
  9526. }
  9527. if (item.oProj) {
  9528. return item.oProj;
  9529. }
  9530. return Projection(item);
  9531. }
  9532. function proj4$1(fromProj, toProj, coord) {
  9533. fromProj = checkProj(fromProj);
  9534. var single = false;
  9535. var obj;
  9536. if (typeof toProj === 'undefined') {
  9537. toProj = fromProj;
  9538. fromProj = wgs84;
  9539. single = true;
  9540. } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
  9541. coord = toProj;
  9542. toProj = fromProj;
  9543. fromProj = wgs84;
  9544. single = true;
  9545. }
  9546. toProj = checkProj(toProj);
  9547. if (coord) {
  9548. return transformer(fromProj, toProj, coord);
  9549. } else {
  9550. obj = {
  9551. forward: function (coords, enforceAxis) {
  9552. return transformer(fromProj, toProj, coords, enforceAxis);
  9553. },
  9554. inverse: function (coords, enforceAxis) {
  9555. return transformer(toProj, fromProj, coords, enforceAxis);
  9556. }
  9557. };
  9558. if (single) {
  9559. obj.oProj = toProj;
  9560. }
  9561. return obj;
  9562. }
  9563. }
  9564. /**
  9565. * UTM zones are grouped, and assigned to one of a group of 6
  9566. * sets.
  9567. *
  9568. * {int} @private
  9569. */
  9570. var NUM_100K_SETS = 6;
  9571. /**
  9572. * The column letters (for easting) of the lower left value, per
  9573. * set.
  9574. *
  9575. * {string} @private
  9576. */
  9577. var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
  9578. /**
  9579. * The row letters (for northing) of the lower left value, per
  9580. * set.
  9581. *
  9582. * {string} @private
  9583. */
  9584. var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
  9585. var A = 65; // A
  9586. var I = 73; // I
  9587. var O = 79; // O
  9588. var V = 86; // V
  9589. var Z = 90; // Z
  9590. var mgrs = {
  9591. forward: forward$1,
  9592. inverse: inverse$1,
  9593. toPoint: toPoint$1
  9594. };
  9595. /**
  9596. * Conversion of lat/lon to MGRS.
  9597. *
  9598. * @param {object} ll Object literal with lat and lon properties on a
  9599. * WGS84 ellipsoid.
  9600. * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
  9601. * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
  9602. * @return {string} the MGRS string for the given location and accuracy.
  9603. */
  9604. function forward$1(ll, accuracy) {
  9605. accuracy = accuracy || 5; // default accuracy 1m
  9606. return encode(LLtoUTM({
  9607. lat: ll[1],
  9608. lon: ll[0]
  9609. }), accuracy);
  9610. }
  9611. /**
  9612. * Conversion of MGRS to lat/lon.
  9613. *
  9614. * @param {string} mgrs MGRS string.
  9615. * @return {array} An array with left (longitude), bottom (latitude), right
  9616. * (longitude) and top (latitude) values in WGS84, representing the
  9617. * bounding box for the provided MGRS reference.
  9618. */
  9619. function inverse$1(mgrs) {
  9620. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  9621. if (bbox.lat && bbox.lon) {
  9622. return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
  9623. }
  9624. return [bbox.left, bbox.bottom, bbox.right, bbox.top];
  9625. }
  9626. function toPoint$1(mgrs) {
  9627. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  9628. if (bbox.lat && bbox.lon) {
  9629. return [bbox.lon, bbox.lat];
  9630. }
  9631. return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
  9632. }
  9633. /**
  9634. * Conversion from degrees to radians.
  9635. *
  9636. * @private
  9637. * @param {number} deg the angle in degrees.
  9638. * @return {number} the angle in radians.
  9639. */
  9640. function degToRad(deg) {
  9641. return (deg * (Math.PI / 180.0));
  9642. }
  9643. /**
  9644. * Conversion from radians to degrees.
  9645. *
  9646. * @private
  9647. * @param {number} rad the angle in radians.
  9648. * @return {number} the angle in degrees.
  9649. */
  9650. function radToDeg(rad) {
  9651. return (180.0 * (rad / Math.PI));
  9652. }
  9653. /**
  9654. * Converts a set of Longitude and Latitude co-ordinates to UTM
  9655. * using the WGS84 ellipsoid.
  9656. *
  9657. * @private
  9658. * @param {object} ll Object literal with lat and lon properties
  9659. * representing the WGS84 coordinate to be converted.
  9660. * @return {object} Object literal containing the UTM value with easting,
  9661. * northing, zoneNumber and zoneLetter properties, and an optional
  9662. * accuracy property in digits. Returns null if the conversion failed.
  9663. */
  9664. function LLtoUTM(ll) {
  9665. var Lat = ll.lat;
  9666. var Long = ll.lon;
  9667. var a = 6378137.0; //ellip.radius;
  9668. var eccSquared = 0.00669438; //ellip.eccsq;
  9669. var k0 = 0.9996;
  9670. var LongOrigin;
  9671. var eccPrimeSquared;
  9672. var N, T, C, A, M;
  9673. var LatRad = degToRad(Lat);
  9674. var LongRad = degToRad(Long);
  9675. var LongOriginRad;
  9676. var ZoneNumber;
  9677. // (int)
  9678. ZoneNumber = Math.floor((Long + 180) / 6) + 1;
  9679. //Make sure the longitude 180.00 is in Zone 60
  9680. if (Long === 180) {
  9681. ZoneNumber = 60;
  9682. }
  9683. // Special zone for Norway
  9684. if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
  9685. ZoneNumber = 32;
  9686. }
  9687. // Special zones for Svalbard
  9688. if (Lat >= 72.0 && Lat < 84.0) {
  9689. if (Long >= 0.0 && Long < 9.0) {
  9690. ZoneNumber = 31;
  9691. }
  9692. else if (Long >= 9.0 && Long < 21.0) {
  9693. ZoneNumber = 33;
  9694. }
  9695. else if (Long >= 21.0 && Long < 33.0) {
  9696. ZoneNumber = 35;
  9697. }
  9698. else if (Long >= 33.0 && Long < 42.0) {
  9699. ZoneNumber = 37;
  9700. }
  9701. }
  9702. LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
  9703. // in middle of
  9704. // zone
  9705. LongOriginRad = degToRad(LongOrigin);
  9706. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  9707. N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
  9708. T = Math.tan(LatRad) * Math.tan(LatRad);
  9709. C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
  9710. A = Math.cos(LatRad) * (LongRad - LongOriginRad);
  9711. M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
  9712. var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
  9713. var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
  9714. if (Lat < 0.0) {
  9715. UTMNorthing += 10000000.0; //10000000 meter offset for
  9716. // southern hemisphere
  9717. }
  9718. return {
  9719. northing: Math.round(UTMNorthing),
  9720. easting: Math.round(UTMEasting),
  9721. zoneNumber: ZoneNumber,
  9722. zoneLetter: getLetterDesignator(Lat)
  9723. };
  9724. }
  9725. /**
  9726. * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
  9727. * class where the Zone can be specified as a single string eg."60N" which
  9728. * is then broken down into the ZoneNumber and ZoneLetter.
  9729. *
  9730. * @private
  9731. * @param {object} utm An object literal with northing, easting, zoneNumber
  9732. * and zoneLetter properties. If an optional accuracy property is
  9733. * provided (in meters), a bounding box will be returned instead of
  9734. * latitude and longitude.
  9735. * @return {object} An object literal containing either lat and lon values
  9736. * (if no accuracy was provided), or top, right, bottom and left values
  9737. * for the bounding box calculated according to the provided accuracy.
  9738. * Returns null if the conversion failed.
  9739. */
  9740. function UTMtoLL(utm) {
  9741. var UTMNorthing = utm.northing;
  9742. var UTMEasting = utm.easting;
  9743. var zoneLetter = utm.zoneLetter;
  9744. var zoneNumber = utm.zoneNumber;
  9745. // check the ZoneNummber is valid
  9746. if (zoneNumber < 0 || zoneNumber > 60) {
  9747. return null;
  9748. }
  9749. var k0 = 0.9996;
  9750. var a = 6378137.0; //ellip.radius;
  9751. var eccSquared = 0.00669438; //ellip.eccsq;
  9752. var eccPrimeSquared;
  9753. var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
  9754. var N1, T1, C1, R1, D, M;
  9755. var LongOrigin;
  9756. var mu, phi1Rad;
  9757. // remove 500,000 meter offset for longitude
  9758. var x = UTMEasting - 500000.0;
  9759. var y = UTMNorthing;
  9760. // We must know somehow if we are in the Northern or Southern
  9761. // hemisphere, this is the only time we use the letter So even
  9762. // if the Zone letter isn't exactly correct it should indicate
  9763. // the hemisphere correctly
  9764. if (zoneLetter < 'N') {
  9765. y -= 10000000.0; // remove 10,000,000 meter offset used
  9766. // for southern hemisphere
  9767. }
  9768. // There are 60 zones with zone 1 being at West -180 to -174
  9769. LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
  9770. // in middle of
  9771. // zone
  9772. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  9773. M = y / k0;
  9774. mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
  9775. phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
  9776. // double phi1 = ProjMath.radToDeg(phi1Rad);
  9777. N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
  9778. T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
  9779. C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
  9780. R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
  9781. D = x / (N1 * k0);
  9782. var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
  9783. lat = radToDeg(lat);
  9784. var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
  9785. lon = LongOrigin + radToDeg(lon);
  9786. var result;
  9787. if (utm.accuracy) {
  9788. var topRight = UTMtoLL({
  9789. northing: utm.northing + utm.accuracy,
  9790. easting: utm.easting + utm.accuracy,
  9791. zoneLetter: utm.zoneLetter,
  9792. zoneNumber: utm.zoneNumber
  9793. });
  9794. result = {
  9795. top: topRight.lat,
  9796. right: topRight.lon,
  9797. bottom: lat,
  9798. left: lon
  9799. };
  9800. }
  9801. else {
  9802. result = {
  9803. lat: lat,
  9804. lon: lon
  9805. };
  9806. }
  9807. return result;
  9808. }
  9809. /**
  9810. * Calculates the MGRS letter designator for the given latitude.
  9811. *
  9812. * @private
  9813. * @param {number} lat The latitude in WGS84 to get the letter designator
  9814. * for.
  9815. * @return {char} The letter designator.
  9816. */
  9817. function getLetterDesignator(lat) {
  9818. //This is here as an error flag to show that the Latitude is
  9819. //outside MGRS limits
  9820. var LetterDesignator = 'Z';
  9821. if ((84 >= lat) && (lat >= 72)) {
  9822. LetterDesignator = 'X';
  9823. }
  9824. else if ((72 > lat) && (lat >= 64)) {
  9825. LetterDesignator = 'W';
  9826. }
  9827. else if ((64 > lat) && (lat >= 56)) {
  9828. LetterDesignator = 'V';
  9829. }
  9830. else if ((56 > lat) && (lat >= 48)) {
  9831. LetterDesignator = 'U';
  9832. }
  9833. else if ((48 > lat) && (lat >= 40)) {
  9834. LetterDesignator = 'T';
  9835. }
  9836. else if ((40 > lat) && (lat >= 32)) {
  9837. LetterDesignator = 'S';
  9838. }
  9839. else if ((32 > lat) && (lat >= 24)) {
  9840. LetterDesignator = 'R';
  9841. }
  9842. else if ((24 > lat) && (lat >= 16)) {
  9843. LetterDesignator = 'Q';
  9844. }
  9845. else if ((16 > lat) && (lat >= 8)) {
  9846. LetterDesignator = 'P';
  9847. }
  9848. else if ((8 > lat) && (lat >= 0)) {
  9849. LetterDesignator = 'N';
  9850. }
  9851. else if ((0 > lat) && (lat >= -8)) {
  9852. LetterDesignator = 'M';
  9853. }
  9854. else if ((-8 > lat) && (lat >= -16)) {
  9855. LetterDesignator = 'L';
  9856. }
  9857. else if ((-16 > lat) && (lat >= -24)) {
  9858. LetterDesignator = 'K';
  9859. }
  9860. else if ((-24 > lat) && (lat >= -32)) {
  9861. LetterDesignator = 'J';
  9862. }
  9863. else if ((-32 > lat) && (lat >= -40)) {
  9864. LetterDesignator = 'H';
  9865. }
  9866. else if ((-40 > lat) && (lat >= -48)) {
  9867. LetterDesignator = 'G';
  9868. }
  9869. else if ((-48 > lat) && (lat >= -56)) {
  9870. LetterDesignator = 'F';
  9871. }
  9872. else if ((-56 > lat) && (lat >= -64)) {
  9873. LetterDesignator = 'E';
  9874. }
  9875. else if ((-64 > lat) && (lat >= -72)) {
  9876. LetterDesignator = 'D';
  9877. }
  9878. else if ((-72 > lat) && (lat >= -80)) {
  9879. LetterDesignator = 'C';
  9880. }
  9881. return LetterDesignator;
  9882. }
  9883. /**
  9884. * Encodes a UTM location as MGRS string.
  9885. *
  9886. * @private
  9887. * @param {object} utm An object literal with easting, northing,
  9888. * zoneLetter, zoneNumber
  9889. * @param {number} accuracy Accuracy in digits (1-5).
  9890. * @return {string} MGRS string for the given UTM location.
  9891. */
  9892. function encode(utm, accuracy) {
  9893. // prepend with leading zeroes
  9894. var seasting = "00000" + utm.easting,
  9895. snorthing = "00000" + utm.northing;
  9896. return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
  9897. }
  9898. /**
  9899. * Get the two letter 100k designator for a given UTM easting,
  9900. * northing and zone number value.
  9901. *
  9902. * @private
  9903. * @param {number} easting
  9904. * @param {number} northing
  9905. * @param {number} zoneNumber
  9906. * @return the two letter 100k designator for the given UTM location.
  9907. */
  9908. function get100kID(easting, northing, zoneNumber) {
  9909. var setParm = get100kSetForZone(zoneNumber);
  9910. var setColumn = Math.floor(easting / 100000);
  9911. var setRow = Math.floor(northing / 100000) % 20;
  9912. return getLetter100kID(setColumn, setRow, setParm);
  9913. }
  9914. /**
  9915. * Given a UTM zone number, figure out the MGRS 100K set it is in.
  9916. *
  9917. * @private
  9918. * @param {number} i An UTM zone number.
  9919. * @return {number} the 100k set the UTM zone is in.
  9920. */
  9921. function get100kSetForZone(i) {
  9922. var setParm = i % NUM_100K_SETS;
  9923. if (setParm === 0) {
  9924. setParm = NUM_100K_SETS;
  9925. }
  9926. return setParm;
  9927. }
  9928. /**
  9929. * Get the two-letter MGRS 100k designator given information
  9930. * translated from the UTM northing, easting and zone number.
  9931. *
  9932. * @private
  9933. * @param {number} column the column index as it relates to the MGRS
  9934. * 100k set spreadsheet, created from the UTM easting.
  9935. * Values are 1-8.
  9936. * @param {number} row the row index as it relates to the MGRS 100k set
  9937. * spreadsheet, created from the UTM northing value. Values
  9938. * are from 0-19.
  9939. * @param {number} parm the set block, as it relates to the MGRS 100k set
  9940. * spreadsheet, created from the UTM zone. Values are from
  9941. * 1-60.
  9942. * @return two letter MGRS 100k code.
  9943. */
  9944. function getLetter100kID(column, row, parm) {
  9945. // colOrigin and rowOrigin are the letters at the origin of the set
  9946. var index = parm - 1;
  9947. var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
  9948. var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
  9949. // colInt and rowInt are the letters to build to return
  9950. var colInt = colOrigin + column - 1;
  9951. var rowInt = rowOrigin + row;
  9952. var rollover = false;
  9953. if (colInt > Z) {
  9954. colInt = colInt - Z + A - 1;
  9955. rollover = true;
  9956. }
  9957. if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
  9958. colInt++;
  9959. }
  9960. if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
  9961. colInt++;
  9962. if (colInt === I) {
  9963. colInt++;
  9964. }
  9965. }
  9966. if (colInt > Z) {
  9967. colInt = colInt - Z + A - 1;
  9968. }
  9969. if (rowInt > V) {
  9970. rowInt = rowInt - V + A - 1;
  9971. rollover = true;
  9972. }
  9973. else {
  9974. rollover = false;
  9975. }
  9976. if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
  9977. rowInt++;
  9978. }
  9979. if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
  9980. rowInt++;
  9981. if (rowInt === I) {
  9982. rowInt++;
  9983. }
  9984. }
  9985. if (rowInt > V) {
  9986. rowInt = rowInt - V + A - 1;
  9987. }
  9988. var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
  9989. return twoLetter;
  9990. }
  9991. /**
  9992. * Decode the UTM parameters from a MGRS string.
  9993. *
  9994. * @private
  9995. * @param {string} mgrsString an UPPERCASE coordinate string is expected.
  9996. * @return {object} An object literal with easting, northing, zoneLetter,
  9997. * zoneNumber and accuracy (in meters) properties.
  9998. */
  9999. function decode(mgrsString) {
  10000. if (mgrsString && mgrsString.length === 0) {
  10001. throw ("MGRSPoint coverting from nothing");
  10002. }
  10003. var length = mgrsString.length;
  10004. var hunK = null;
  10005. var sb = "";
  10006. var testChar;
  10007. var i = 0;
  10008. // get Zone number
  10009. while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
  10010. if (i >= 2) {
  10011. throw ("MGRSPoint bad conversion from: " + mgrsString);
  10012. }
  10013. sb += testChar;
  10014. i++;
  10015. }
  10016. var zoneNumber = parseInt(sb, 10);
  10017. if (i === 0 || i + 3 > length) {
  10018. // A good MGRS string has to be 4-5 digits long,
  10019. // ##AAA/#AAA at least.
  10020. throw ("MGRSPoint bad conversion from: " + mgrsString);
  10021. }
  10022. var zoneLetter = mgrsString.charAt(i++);
  10023. // Should we check the zone letter here? Why not.
  10024. if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
  10025. throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
  10026. }
  10027. hunK = mgrsString.substring(i, i += 2);
  10028. var set = get100kSetForZone(zoneNumber);
  10029. var east100k = getEastingFromChar(hunK.charAt(0), set);
  10030. var north100k = getNorthingFromChar(hunK.charAt(1), set);
  10031. // We have a bug where the northing may be 2000000 too low.
  10032. // How
  10033. // do we know when to roll over?
  10034. while (north100k < getMinNorthing(zoneLetter)) {
  10035. north100k += 2000000;
  10036. }
  10037. // calculate the char index for easting/northing separator
  10038. var remainder = length - i;
  10039. if (remainder % 2 !== 0) {
  10040. throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
  10041. }
  10042. var sep = remainder / 2;
  10043. var sepEasting = 0.0;
  10044. var sepNorthing = 0.0;
  10045. var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
  10046. if (sep > 0) {
  10047. accuracyBonus = 100000.0 / Math.pow(10, sep);
  10048. sepEastingString = mgrsString.substring(i, i + sep);
  10049. sepEasting = parseFloat(sepEastingString) * accuracyBonus;
  10050. sepNorthingString = mgrsString.substring(i + sep);
  10051. sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
  10052. }
  10053. easting = sepEasting + east100k;
  10054. northing = sepNorthing + north100k;
  10055. return {
  10056. easting: easting,
  10057. northing: northing,
  10058. zoneLetter: zoneLetter,
  10059. zoneNumber: zoneNumber,
  10060. accuracy: accuracyBonus
  10061. };
  10062. }
  10063. /**
  10064. * Given the first letter from a two-letter MGRS 100k zone, and given the
  10065. * MGRS table set for the zone number, figure out the easting value that
  10066. * should be added to the other, secondary easting value.
  10067. *
  10068. * @private
  10069. * @param {char} e The first letter from a two-letter MGRS 100´k zone.
  10070. * @param {number} set The MGRS table set for the zone number.
  10071. * @return {number} The easting value for the given letter and set.
  10072. */
  10073. function getEastingFromChar(e, set) {
  10074. // colOrigin is the letter at the origin of the set for the
  10075. // column
  10076. var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
  10077. var eastingValue = 100000.0;
  10078. var rewindMarker = false;
  10079. while (curCol !== e.charCodeAt(0)) {
  10080. curCol++;
  10081. if (curCol === I) {
  10082. curCol++;
  10083. }
  10084. if (curCol === O) {
  10085. curCol++;
  10086. }
  10087. if (curCol > Z) {
  10088. if (rewindMarker) {
  10089. throw ("Bad character: " + e);
  10090. }
  10091. curCol = A;
  10092. rewindMarker = true;
  10093. }
  10094. eastingValue += 100000.0;
  10095. }
  10096. return eastingValue;
  10097. }
  10098. /**
  10099. * Given the second letter from a two-letter MGRS 100k zone, and given the
  10100. * MGRS table set for the zone number, figure out the northing value that
  10101. * should be added to the other, secondary northing value. You have to
  10102. * remember that Northings are determined from the equator, and the vertical
  10103. * cycle of letters mean a 2000000 additional northing meters. This happens
  10104. * approx. every 18 degrees of latitude. This method does *NOT* count any
  10105. * additional northings. You have to figure out how many 2000000 meters need
  10106. * to be added for the zone letter of the MGRS coordinate.
  10107. *
  10108. * @private
  10109. * @param {char} n Second letter of the MGRS 100k zone
  10110. * @param {number} set The MGRS table set number, which is dependent on the
  10111. * UTM zone number.
  10112. * @return {number} The northing value for the given letter and set.
  10113. */
  10114. function getNorthingFromChar(n, set) {
  10115. if (n > 'V') {
  10116. throw ("MGRSPoint given invalid Northing " + n);
  10117. }
  10118. // rowOrigin is the letter at the origin of the set for the
  10119. // column
  10120. var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
  10121. var northingValue = 0.0;
  10122. var rewindMarker = false;
  10123. while (curRow !== n.charCodeAt(0)) {
  10124. curRow++;
  10125. if (curRow === I) {
  10126. curRow++;
  10127. }
  10128. if (curRow === O) {
  10129. curRow++;
  10130. }
  10131. // fixing a bug making whole application hang in this loop
  10132. // when 'n' is a wrong character
  10133. if (curRow > V) {
  10134. if (rewindMarker) { // making sure that this loop ends
  10135. throw ("Bad character: " + n);
  10136. }
  10137. curRow = A;
  10138. rewindMarker = true;
  10139. }
  10140. northingValue += 100000.0;
  10141. }
  10142. return northingValue;
  10143. }
  10144. /**
  10145. * The function getMinNorthing returns the minimum northing value of a MGRS
  10146. * zone.
  10147. *
  10148. * Ported from Geotrans' c Lattitude_Band_Value structure table.
  10149. *
  10150. * @private
  10151. * @param {char} zoneLetter The MGRS zone to get the min northing for.
  10152. * @return {number}
  10153. */
  10154. function getMinNorthing(zoneLetter) {
  10155. var northing;
  10156. switch (zoneLetter) {
  10157. case 'C':
  10158. northing = 1100000.0;
  10159. break;
  10160. case 'D':
  10161. northing = 2000000.0;
  10162. break;
  10163. case 'E':
  10164. northing = 2800000.0;
  10165. break;
  10166. case 'F':
  10167. northing = 3700000.0;
  10168. break;
  10169. case 'G':
  10170. northing = 4600000.0;
  10171. break;
  10172. case 'H':
  10173. northing = 5500000.0;
  10174. break;
  10175. case 'J':
  10176. northing = 6400000.0;
  10177. break;
  10178. case 'K':
  10179. northing = 7300000.0;
  10180. break;
  10181. case 'L':
  10182. northing = 8200000.0;
  10183. break;
  10184. case 'M':
  10185. northing = 9100000.0;
  10186. break;
  10187. case 'N':
  10188. northing = 0.0;
  10189. break;
  10190. case 'P':
  10191. northing = 800000.0;
  10192. break;
  10193. case 'Q':
  10194. northing = 1700000.0;
  10195. break;
  10196. case 'R':
  10197. northing = 2600000.0;
  10198. break;
  10199. case 'S':
  10200. northing = 3500000.0;
  10201. break;
  10202. case 'T':
  10203. northing = 4400000.0;
  10204. break;
  10205. case 'U':
  10206. northing = 5300000.0;
  10207. break;
  10208. case 'V':
  10209. northing = 6200000.0;
  10210. break;
  10211. case 'W':
  10212. northing = 7000000.0;
  10213. break;
  10214. case 'X':
  10215. northing = 7900000.0;
  10216. break;
  10217. default:
  10218. northing = -1.0;
  10219. }
  10220. if (northing >= 0.0) {
  10221. return northing;
  10222. }
  10223. else {
  10224. throw ("Invalid zone letter: " + zoneLetter);
  10225. }
  10226. }
  10227. function Point(x, y, z) {
  10228. if (!(this instanceof Point)) {
  10229. return new Point(x, y, z);
  10230. }
  10231. if (Array.isArray(x)) {
  10232. this.x = x[0];
  10233. this.y = x[1];
  10234. this.z = x[2] || 0.0;
  10235. } else if(typeof x === 'object') {
  10236. this.x = x.x;
  10237. this.y = x.y;
  10238. this.z = x.z || 0.0;
  10239. } else if (typeof x === 'string' && typeof y === 'undefined') {
  10240. var coords = x.split(',');
  10241. this.x = parseFloat(coords[0], 10);
  10242. this.y = parseFloat(coords[1], 10);
  10243. this.z = parseFloat(coords[2], 10) || 0.0;
  10244. } else {
  10245. this.x = x;
  10246. this.y = y;
  10247. this.z = z || 0.0;
  10248. }
  10249. console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
  10250. }
  10251. Point.fromMGRS = function(mgrsStr) {
  10252. return new Point(toPoint$1(mgrsStr));
  10253. };
  10254. Point.prototype.toMGRS = function(accuracy) {
  10255. return forward$1([this.x, this.y], accuracy);
  10256. };
  10257. var C00 = 1;
  10258. var C02 = 0.25;
  10259. var C04 = 0.046875;
  10260. var C06 = 0.01953125;
  10261. var C08 = 0.01068115234375;
  10262. var C22 = 0.75;
  10263. var C44 = 0.46875;
  10264. var C46 = 0.01302083333333333333;
  10265. var C48 = 0.00712076822916666666;
  10266. var C66 = 0.36458333333333333333;
  10267. var C68 = 0.00569661458333333333;
  10268. var C88 = 0.3076171875;
  10269. var pj_enfn = function(es) {
  10270. var en = [];
  10271. en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
  10272. en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
  10273. var t = es * es;
  10274. en[2] = t * (C44 - es * (C46 + es * C48));
  10275. t *= es;
  10276. en[3] = t * (C66 - es * C68);
  10277. en[4] = t * es * C88;
  10278. return en;
  10279. };
  10280. var pj_mlfn = function(phi, sphi, cphi, en) {
  10281. cphi *= sphi;
  10282. sphi *= sphi;
  10283. return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
  10284. };
  10285. var MAX_ITER = 20;
  10286. var pj_inv_mlfn = function(arg, es, en) {
  10287. var k = 1 / (1 - es);
  10288. var phi = arg;
  10289. for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
  10290. var s = Math.sin(phi);
  10291. var t = 1 - es * s * s;
  10292. //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
  10293. //phi -= t * (t * Math.sqrt(t)) * k;
  10294. t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
  10295. phi -= t;
  10296. if (Math.abs(t) < EPSLN) {
  10297. return phi;
  10298. }
  10299. }
  10300. //..reportError("cass:pj_inv_mlfn: Convergence error");
  10301. return phi;
  10302. };
  10303. // Heavily based on this tmerc projection implementation
  10304. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
  10305. function init$2() {
  10306. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  10307. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  10308. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  10309. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  10310. if (this.es) {
  10311. this.en = pj_enfn(this.es);
  10312. this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
  10313. }
  10314. }
  10315. /**
  10316. Transverse Mercator Forward - long/lat to x/y
  10317. long/lat in radians
  10318. */
  10319. function forward$2(p) {
  10320. var lon = p.x;
  10321. var lat = p.y;
  10322. var delta_lon = adjust_lon(lon - this.long0);
  10323. var con;
  10324. var x, y;
  10325. var sin_phi = Math.sin(lat);
  10326. var cos_phi = Math.cos(lat);
  10327. if (!this.es) {
  10328. var b = cos_phi * Math.sin(delta_lon);
  10329. if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
  10330. return (93);
  10331. }
  10332. else {
  10333. x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
  10334. y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
  10335. b = Math.abs(y);
  10336. if (b >= 1) {
  10337. if ((b - 1) > EPSLN) {
  10338. return (93);
  10339. }
  10340. else {
  10341. y = 0;
  10342. }
  10343. }
  10344. else {
  10345. y = Math.acos(y);
  10346. }
  10347. if (lat < 0) {
  10348. y = -y;
  10349. }
  10350. y = this.a * this.k0 * (y - this.lat0) + this.y0;
  10351. }
  10352. }
  10353. else {
  10354. var al = cos_phi * delta_lon;
  10355. var als = Math.pow(al, 2);
  10356. var c = this.ep2 * Math.pow(cos_phi, 2);
  10357. var cs = Math.pow(c, 2);
  10358. var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
  10359. var t = Math.pow(tq, 2);
  10360. var ts = Math.pow(t, 2);
  10361. con = 1 - this.es * Math.pow(sin_phi, 2);
  10362. al = al / Math.sqrt(con);
  10363. var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
  10364. x = this.a * (this.k0 * al * (1 +
  10365. als / 6 * (1 - t + c +
  10366. als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
  10367. als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
  10368. this.x0;
  10369. y = this.a * (this.k0 * (ml - this.ml0 +
  10370. sin_phi * delta_lon * al / 2 * (1 +
  10371. als / 12 * (5 - t + 9 * c + 4 * cs +
  10372. als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
  10373. als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
  10374. this.y0;
  10375. }
  10376. p.x = x;
  10377. p.y = y;
  10378. return p;
  10379. }
  10380. /**
  10381. Transverse Mercator Inverse - x/y to long/lat
  10382. */
  10383. function inverse$2(p) {
  10384. var con, phi;
  10385. var lat, lon;
  10386. var x = (p.x - this.x0) * (1 / this.a);
  10387. var y = (p.y - this.y0) * (1 / this.a);
  10388. if (!this.es) {
  10389. var f = Math.exp(x / this.k0);
  10390. var g = 0.5 * (f - 1 / f);
  10391. var temp = this.lat0 + y / this.k0;
  10392. var h = Math.cos(temp);
  10393. con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
  10394. lat = Math.asin(con);
  10395. if (y < 0) {
  10396. lat = -lat;
  10397. }
  10398. if ((g === 0) && (h === 0)) {
  10399. lon = 0;
  10400. }
  10401. else {
  10402. lon = adjust_lon(Math.atan2(g, h) + this.long0);
  10403. }
  10404. }
  10405. else { // ellipsoidal form
  10406. con = this.ml0 + y / this.k0;
  10407. phi = pj_inv_mlfn(con, this.es, this.en);
  10408. if (Math.abs(phi) < HALF_PI) {
  10409. var sin_phi = Math.sin(phi);
  10410. var cos_phi = Math.cos(phi);
  10411. var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
  10412. var c = this.ep2 * Math.pow(cos_phi, 2);
  10413. var cs = Math.pow(c, 2);
  10414. var t = Math.pow(tan_phi, 2);
  10415. var ts = Math.pow(t, 2);
  10416. con = 1 - this.es * Math.pow(sin_phi, 2);
  10417. var d = x * Math.sqrt(con) / this.k0;
  10418. var ds = Math.pow(d, 2);
  10419. con = con * tan_phi;
  10420. lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
  10421. ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
  10422. ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
  10423. ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
  10424. lon = adjust_lon(this.long0 + (d * (1 -
  10425. ds / 6 * (1 + 2 * t + c -
  10426. ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
  10427. ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
  10428. }
  10429. else {
  10430. lat = HALF_PI * sign(y);
  10431. lon = 0;
  10432. }
  10433. }
  10434. p.x = lon;
  10435. p.y = lat;
  10436. return p;
  10437. }
  10438. var names$3 = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"];
  10439. var tmerc = {
  10440. init: init$2,
  10441. forward: forward$2,
  10442. inverse: inverse$2,
  10443. names: names$3
  10444. };
  10445. var sinh = function(x) {
  10446. var r = Math.exp(x);
  10447. r = (r - 1 / r) / 2;
  10448. return r;
  10449. };
  10450. var hypot = function(x, y) {
  10451. x = Math.abs(x);
  10452. y = Math.abs(y);
  10453. var a = Math.max(x, y);
  10454. var b = Math.min(x, y) / (a ? a : 1);
  10455. return a * Math.sqrt(1 + Math.pow(b, 2));
  10456. };
  10457. var log1py = function(x) {
  10458. var y = 1 + x;
  10459. var z = y - 1;
  10460. return z === 0 ? x : x * Math.log(y) / z;
  10461. };
  10462. var asinhy = function(x) {
  10463. var y = Math.abs(x);
  10464. y = log1py(y * (1 + y / (hypot(1, y) + 1)));
  10465. return x < 0 ? -y : y;
  10466. };
  10467. var gatg = function(pp, B) {
  10468. var cos_2B = 2 * Math.cos(2 * B);
  10469. var i = pp.length - 1;
  10470. var h1 = pp[i];
  10471. var h2 = 0;
  10472. var h;
  10473. while (--i >= 0) {
  10474. h = -h2 + cos_2B * h1 + pp[i];
  10475. h2 = h1;
  10476. h1 = h;
  10477. }
  10478. return (B + h * Math.sin(2 * B));
  10479. };
  10480. var clens = function(pp, arg_r) {
  10481. var r = 2 * Math.cos(arg_r);
  10482. var i = pp.length - 1;
  10483. var hr1 = pp[i];
  10484. var hr2 = 0;
  10485. var hr;
  10486. while (--i >= 0) {
  10487. hr = -hr2 + r * hr1 + pp[i];
  10488. hr2 = hr1;
  10489. hr1 = hr;
  10490. }
  10491. return Math.sin(arg_r) * hr;
  10492. };
  10493. var cosh = function(x) {
  10494. var r = Math.exp(x);
  10495. r = (r + 1 / r) / 2;
  10496. return r;
  10497. };
  10498. var clens_cmplx = function(pp, arg_r, arg_i) {
  10499. var sin_arg_r = Math.sin(arg_r);
  10500. var cos_arg_r = Math.cos(arg_r);
  10501. var sinh_arg_i = sinh(arg_i);
  10502. var cosh_arg_i = cosh(arg_i);
  10503. var r = 2 * cos_arg_r * cosh_arg_i;
  10504. var i = -2 * sin_arg_r * sinh_arg_i;
  10505. var j = pp.length - 1;
  10506. var hr = pp[j];
  10507. var hi1 = 0;
  10508. var hr1 = 0;
  10509. var hi = 0;
  10510. var hr2;
  10511. var hi2;
  10512. while (--j >= 0) {
  10513. hr2 = hr1;
  10514. hi2 = hi1;
  10515. hr1 = hr;
  10516. hi1 = hi;
  10517. hr = -hr2 + r * hr1 - i * hi1 + pp[j];
  10518. hi = -hi2 + i * hr1 + r * hi1;
  10519. }
  10520. r = sin_arg_r * cosh_arg_i;
  10521. i = cos_arg_r * sinh_arg_i;
  10522. return [r * hr - i * hi, r * hi + i * hr];
  10523. };
  10524. // Heavily based on this etmerc projection implementation
  10525. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
  10526. function init$3() {
  10527. if (!this.approx && (isNaN(this.es) || this.es <= 0)) {
  10528. throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
  10529. }
  10530. if (this.approx) {
  10531. // When '+approx' is set, use tmerc instead
  10532. tmerc.init.apply(this);
  10533. this.forward = tmerc.forward;
  10534. this.inverse = tmerc.inverse;
  10535. }
  10536. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  10537. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  10538. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  10539. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  10540. this.cgb = [];
  10541. this.cbg = [];
  10542. this.utg = [];
  10543. this.gtu = [];
  10544. var f = this.es / (1 + Math.sqrt(1 - this.es));
  10545. var n = f / (2 - f);
  10546. var np = n;
  10547. this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
  10548. this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
  10549. np = np * n;
  10550. this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
  10551. this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
  10552. np = np * n;
  10553. this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
  10554. this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
  10555. np = np * n;
  10556. this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
  10557. this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
  10558. np = np * n;
  10559. this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
  10560. this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
  10561. np = np * n;
  10562. this.cgb[5] = np * (601676 / 22275);
  10563. this.cbg[5] = np * (444337 / 155925);
  10564. np = Math.pow(n, 2);
  10565. this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
  10566. this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
  10567. this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
  10568. this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
  10569. this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
  10570. np = np * n;
  10571. this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
  10572. this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
  10573. np = np * n;
  10574. this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
  10575. this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
  10576. np = np * n;
  10577. this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
  10578. this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
  10579. np = np * n;
  10580. this.utg[5] = np * (-20648693 / 638668800);
  10581. this.gtu[5] = np * (212378941 / 319334400);
  10582. var Z = gatg(this.cbg, this.lat0);
  10583. this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
  10584. }
  10585. function forward$3(p) {
  10586. var Ce = adjust_lon(p.x - this.long0);
  10587. var Cn = p.y;
  10588. Cn = gatg(this.cbg, Cn);
  10589. var sin_Cn = Math.sin(Cn);
  10590. var cos_Cn = Math.cos(Cn);
  10591. var sin_Ce = Math.sin(Ce);
  10592. var cos_Ce = Math.cos(Ce);
  10593. Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
  10594. Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
  10595. Ce = asinhy(Math.tan(Ce));
  10596. var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
  10597. Cn = Cn + tmp[0];
  10598. Ce = Ce + tmp[1];
  10599. var x;
  10600. var y;
  10601. if (Math.abs(Ce) <= 2.623395162778) {
  10602. x = this.a * (this.Qn * Ce) + this.x0;
  10603. y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
  10604. }
  10605. else {
  10606. x = Infinity;
  10607. y = Infinity;
  10608. }
  10609. p.x = x;
  10610. p.y = y;
  10611. return p;
  10612. }
  10613. function inverse$3(p) {
  10614. var Ce = (p.x - this.x0) * (1 / this.a);
  10615. var Cn = (p.y - this.y0) * (1 / this.a);
  10616. Cn = (Cn - this.Zb) / this.Qn;
  10617. Ce = Ce / this.Qn;
  10618. var lon;
  10619. var lat;
  10620. if (Math.abs(Ce) <= 2.623395162778) {
  10621. var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
  10622. Cn = Cn + tmp[0];
  10623. Ce = Ce + tmp[1];
  10624. Ce = Math.atan(sinh(Ce));
  10625. var sin_Cn = Math.sin(Cn);
  10626. var cos_Cn = Math.cos(Cn);
  10627. var sin_Ce = Math.sin(Ce);
  10628. var cos_Ce = Math.cos(Ce);
  10629. Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
  10630. Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
  10631. lon = adjust_lon(Ce + this.long0);
  10632. lat = gatg(this.cgb, Cn);
  10633. }
  10634. else {
  10635. lon = Infinity;
  10636. lat = Infinity;
  10637. }
  10638. p.x = lon;
  10639. p.y = lat;
  10640. return p;
  10641. }
  10642. var names$4 = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"];
  10643. var etmerc = {
  10644. init: init$3,
  10645. forward: forward$3,
  10646. inverse: inverse$3,
  10647. names: names$4
  10648. };
  10649. var adjust_zone = function(zone, lon) {
  10650. if (zone === undefined) {
  10651. zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
  10652. if (zone < 0) {
  10653. return 0;
  10654. } else if (zone > 60) {
  10655. return 60;
  10656. }
  10657. }
  10658. return zone;
  10659. };
  10660. var dependsOn = 'etmerc';
  10661. function init$4() {
  10662. var zone = adjust_zone(this.zone, this.long0);
  10663. if (zone === undefined) {
  10664. throw new Error('unknown utm zone');
  10665. }
  10666. this.lat0 = 0;
  10667. this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;
  10668. this.x0 = 500000;
  10669. this.y0 = this.utmSouth ? 10000000 : 0;
  10670. this.k0 = 0.9996;
  10671. etmerc.init.apply(this);
  10672. this.forward = etmerc.forward;
  10673. this.inverse = etmerc.inverse;
  10674. }
  10675. var names$5 = ["Universal Transverse Mercator System", "utm"];
  10676. var utm = {
  10677. init: init$4,
  10678. names: names$5,
  10679. dependsOn: dependsOn
  10680. };
  10681. var srat = function(esinp, exp) {
  10682. return (Math.pow((1 - esinp) / (1 + esinp), exp));
  10683. };
  10684. var MAX_ITER$1 = 20;
  10685. function init$6() {
  10686. var sphi = Math.sin(this.lat0);
  10687. var cphi = Math.cos(this.lat0);
  10688. cphi *= cphi;
  10689. this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
  10690. this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
  10691. this.phic0 = Math.asin(sphi / this.C);
  10692. this.ratexp = 0.5 * this.C * this.e;
  10693. this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
  10694. }
  10695. function forward$5(p) {
  10696. var lon = p.x;
  10697. var lat = p.y;
  10698. p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
  10699. p.x = this.C * lon;
  10700. return p;
  10701. }
  10702. function inverse$5(p) {
  10703. var DEL_TOL = 1e-14;
  10704. var lon = p.x / this.C;
  10705. var lat = p.y;
  10706. var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
  10707. for (var i = MAX_ITER$1; i > 0; --i) {
  10708. lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
  10709. if (Math.abs(lat - p.y) < DEL_TOL) {
  10710. break;
  10711. }
  10712. p.y = lat;
  10713. }
  10714. /* convergence failed */
  10715. if (!i) {
  10716. return null;
  10717. }
  10718. p.x = lon;
  10719. p.y = lat;
  10720. return p;
  10721. }
  10722. var names$7 = ["gauss"];
  10723. var gauss = {
  10724. init: init$6,
  10725. forward: forward$5,
  10726. inverse: inverse$5,
  10727. names: names$7
  10728. };
  10729. function init$5() {
  10730. gauss.init.apply(this);
  10731. if (!this.rc) {
  10732. return;
  10733. }
  10734. this.sinc0 = Math.sin(this.phic0);
  10735. this.cosc0 = Math.cos(this.phic0);
  10736. this.R2 = 2 * this.rc;
  10737. if (!this.title) {
  10738. this.title = "Oblique Stereographic Alternative";
  10739. }
  10740. }
  10741. function forward$4(p) {
  10742. var sinc, cosc, cosl, k;
  10743. p.x = adjust_lon(p.x - this.long0);
  10744. gauss.forward.apply(this, [p]);
  10745. sinc = Math.sin(p.y);
  10746. cosc = Math.cos(p.y);
  10747. cosl = Math.cos(p.x);
  10748. k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
  10749. p.x = k * cosc * Math.sin(p.x);
  10750. p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
  10751. p.x = this.a * p.x + this.x0;
  10752. p.y = this.a * p.y + this.y0;
  10753. return p;
  10754. }
  10755. function inverse$4(p) {
  10756. var sinc, cosc, lon, lat, rho;
  10757. p.x = (p.x - this.x0) / this.a;
  10758. p.y = (p.y - this.y0) / this.a;
  10759. p.x /= this.k0;
  10760. p.y /= this.k0;
  10761. if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
  10762. var c = 2 * Math.atan2(rho, this.R2);
  10763. sinc = Math.sin(c);
  10764. cosc = Math.cos(c);
  10765. lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
  10766. lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
  10767. }
  10768. else {
  10769. lat = this.phic0;
  10770. lon = 0;
  10771. }
  10772. p.x = lon;
  10773. p.y = lat;
  10774. gauss.inverse.apply(this, [p]);
  10775. p.x = adjust_lon(p.x + this.long0);
  10776. return p;
  10777. }
  10778. var names$6 = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
  10779. var sterea = {
  10780. init: init$5,
  10781. forward: forward$4,
  10782. inverse: inverse$4,
  10783. names: names$6
  10784. };
  10785. function ssfn_(phit, sinphi, eccen) {
  10786. sinphi *= eccen;
  10787. return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
  10788. }
  10789. function init$7() {
  10790. this.coslat0 = Math.cos(this.lat0);
  10791. this.sinlat0 = Math.sin(this.lat0);
  10792. if (this.sphere) {
  10793. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  10794. this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
  10795. }
  10796. }
  10797. else {
  10798. if (Math.abs(this.coslat0) <= EPSLN) {
  10799. if (this.lat0 > 0) {
  10800. //North pole
  10801. //trace('stere:north pole');
  10802. this.con = 1;
  10803. }
  10804. else {
  10805. //South pole
  10806. //trace('stere:south pole');
  10807. this.con = -1;
  10808. }
  10809. }
  10810. this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
  10811. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  10812. this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
  10813. }
  10814. this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
  10815. this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
  10816. this.cosX0 = Math.cos(this.X0);
  10817. this.sinX0 = Math.sin(this.X0);
  10818. }
  10819. }
  10820. // Stereographic forward equations--mapping lat,long to x,y
  10821. function forward$6(p) {
  10822. var lon = p.x;
  10823. var lat = p.y;
  10824. var sinlat = Math.sin(lat);
  10825. var coslat = Math.cos(lat);
  10826. var A, X, sinX, cosX, ts, rh;
  10827. var dlon = adjust_lon(lon - this.long0);
  10828. if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
  10829. //case of the origine point
  10830. //trace('stere:this is the origin point');
  10831. p.x = NaN;
  10832. p.y = NaN;
  10833. return p;
  10834. }
  10835. if (this.sphere) {
  10836. //trace('stere:sphere case');
  10837. A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
  10838. p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
  10839. p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
  10840. return p;
  10841. }
  10842. else {
  10843. X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
  10844. cosX = Math.cos(X);
  10845. sinX = Math.sin(X);
  10846. if (Math.abs(this.coslat0) <= EPSLN) {
  10847. ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
  10848. rh = 2 * this.a * this.k0 * ts / this.cons;
  10849. p.x = this.x0 + rh * Math.sin(lon - this.long0);
  10850. p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
  10851. //trace(p.toString());
  10852. return p;
  10853. }
  10854. else if (Math.abs(this.sinlat0) < EPSLN) {
  10855. //Eq
  10856. //trace('stere:equateur');
  10857. A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
  10858. p.y = A * sinX;
  10859. }
  10860. else {
  10861. //other case
  10862. //trace('stere:normal case');
  10863. A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
  10864. p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
  10865. }
  10866. p.x = A * cosX * Math.sin(dlon) + this.x0;
  10867. }
  10868. //trace(p.toString());
  10869. return p;
  10870. }
  10871. //* Stereographic inverse equations--mapping x,y to lat/long
  10872. function inverse$6(p) {
  10873. p.x -= this.x0;
  10874. p.y -= this.y0;
  10875. var lon, lat, ts, ce, Chi;
  10876. var rh = Math.sqrt(p.x * p.x + p.y * p.y);
  10877. if (this.sphere) {
  10878. var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
  10879. lon = this.long0;
  10880. lat = this.lat0;
  10881. if (rh <= EPSLN) {
  10882. p.x = lon;
  10883. p.y = lat;
  10884. return p;
  10885. }
  10886. lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
  10887. if (Math.abs(this.coslat0) < EPSLN) {
  10888. if (this.lat0 > 0) {
  10889. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  10890. }
  10891. else {
  10892. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  10893. }
  10894. }
  10895. else {
  10896. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
  10897. }
  10898. p.x = lon;
  10899. p.y = lat;
  10900. return p;
  10901. }
  10902. else {
  10903. if (Math.abs(this.coslat0) <= EPSLN) {
  10904. if (rh <= EPSLN) {
  10905. lat = this.lat0;
  10906. lon = this.long0;
  10907. p.x = lon;
  10908. p.y = lat;
  10909. //trace(p.toString());
  10910. return p;
  10911. }
  10912. p.x *= this.con;
  10913. p.y *= this.con;
  10914. ts = rh * this.cons / (2 * this.a * this.k0);
  10915. lat = this.con * phi2z(this.e, ts);
  10916. lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
  10917. }
  10918. else {
  10919. ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
  10920. lon = this.long0;
  10921. if (rh <= EPSLN) {
  10922. Chi = this.X0;
  10923. }
  10924. else {
  10925. Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
  10926. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
  10927. }
  10928. lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
  10929. }
  10930. }
  10931. p.x = lon;
  10932. p.y = lat;
  10933. //trace(p.toString());
  10934. return p;
  10935. }
  10936. var names$8 = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
  10937. var stere = {
  10938. init: init$7,
  10939. forward: forward$6,
  10940. inverse: inverse$6,
  10941. names: names$8,
  10942. ssfn_: ssfn_
  10943. };
  10944. /*
  10945. references:
  10946. Formules et constantes pour le Calcul pour la
  10947. projection cylindrique conforme à axe oblique et pour la transformation entre
  10948. des systèmes de référence.
  10949. http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
  10950. */
  10951. function init$8() {
  10952. var phy0 = this.lat0;
  10953. this.lambda0 = this.long0;
  10954. var sinPhy0 = Math.sin(phy0);
  10955. var semiMajorAxis = this.a;
  10956. var invF = this.rf;
  10957. var flattening = 1 / invF;
  10958. var e2 = 2 * flattening - Math.pow(flattening, 2);
  10959. var e = this.e = Math.sqrt(e2);
  10960. this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
  10961. this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
  10962. this.b0 = Math.asin(sinPhy0 / this.alpha);
  10963. var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
  10964. var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
  10965. var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
  10966. this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
  10967. }
  10968. function forward$7(p) {
  10969. var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
  10970. var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
  10971. var S = -this.alpha * (Sa1 + Sa2) + this.K;
  10972. // spheric latitude
  10973. var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
  10974. // spheric longitude
  10975. var I = this.alpha * (p.x - this.lambda0);
  10976. // psoeudo equatorial rotation
  10977. var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
  10978. var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
  10979. p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
  10980. p.x = this.R * rotI + this.x0;
  10981. return p;
  10982. }
  10983. function inverse$7(p) {
  10984. var Y = p.x - this.x0;
  10985. var X = p.y - this.y0;
  10986. var rotI = Y / this.R;
  10987. var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
  10988. var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
  10989. var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
  10990. var lambda = this.lambda0 + I / this.alpha;
  10991. var S = 0;
  10992. var phy = b;
  10993. var prevPhy = -1000;
  10994. var iteration = 0;
  10995. while (Math.abs(phy - prevPhy) > 0.0000001) {
  10996. if (++iteration > 20) {
  10997. //...reportError("omercFwdInfinity");
  10998. return;
  10999. }
  11000. //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
  11001. S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
  11002. prevPhy = phy;
  11003. phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
  11004. }
  11005. p.x = lambda;
  11006. p.y = phy;
  11007. return p;
  11008. }
  11009. var names$9 = ["somerc"];
  11010. var somerc = {
  11011. init: init$8,
  11012. forward: forward$7,
  11013. inverse: inverse$7,
  11014. names: names$9
  11015. };
  11016. var TOL = 1e-7;
  11017. function isTypeA(P) {
  11018. var typeAProjections = ['Hotine_Oblique_Mercator','Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];
  11019. var projectionName = typeof P.PROJECTION === "object" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;
  11020. return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1;
  11021. }
  11022. /* Initialize the Oblique Mercator projection
  11023. ------------------------------------------*/
  11024. function init$9() {
  11025. var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,
  11026. gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;
  11027. // only Type A uses the no_off or no_uoff property
  11028. // https://github.com/OSGeo/proj.4/issues/104
  11029. this.no_off = isTypeA(this);
  11030. this.no_rot = 'no_rot' in this;
  11031. var alp = false;
  11032. if ("alpha" in this) {
  11033. alp = true;
  11034. }
  11035. var gam = false;
  11036. if ("rectified_grid_angle" in this) {
  11037. gam = true;
  11038. }
  11039. if (alp) {
  11040. alpha_c = this.alpha;
  11041. }
  11042. if (gam) {
  11043. gamma = (this.rectified_grid_angle * D2R);
  11044. }
  11045. if (alp || gam) {
  11046. lamc = this.longc;
  11047. } else {
  11048. lam1 = this.long1;
  11049. phi1 = this.lat1;
  11050. lam2 = this.long2;
  11051. phi2 = this.lat2;
  11052. if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL ||
  11053. Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL ||
  11054. Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {
  11055. throw new Error();
  11056. }
  11057. }
  11058. var one_es = 1.0 - this.es;
  11059. com = Math.sqrt(one_es);
  11060. if (Math.abs(this.lat0) > EPSLN) {
  11061. sinph0 = Math.sin(this.lat0);
  11062. cosph0 = Math.cos(this.lat0);
  11063. con = 1 - this.es * sinph0 * sinph0;
  11064. this.B = cosph0 * cosph0;
  11065. this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);
  11066. this.A = this.B * this.k0 * com / con;
  11067. D = this.B * com / (cosph0 * Math.sqrt(con));
  11068. F = D * D -1;
  11069. if (F <= 0) {
  11070. F = 0;
  11071. } else {
  11072. F = Math.sqrt(F);
  11073. if (this.lat0 < 0) {
  11074. F = -F;
  11075. }
  11076. }
  11077. this.E = F += D;
  11078. this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);
  11079. } else {
  11080. this.B = 1 / com;
  11081. this.A = this.k0;
  11082. this.E = D = F = 1;
  11083. }
  11084. if (alp || gam) {
  11085. if (alp) {
  11086. gamma0 = Math.asin(Math.sin(alpha_c) / D);
  11087. if (!gam) {
  11088. gamma = alpha_c;
  11089. }
  11090. } else {
  11091. gamma0 = gamma;
  11092. alpha_c = Math.asin(D * Math.sin(gamma0));
  11093. }
  11094. this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;
  11095. } else {
  11096. H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);
  11097. L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);
  11098. F = this.E / H;
  11099. p = (L - H) / (L + H);
  11100. J = this.E * this.E;
  11101. J = (J - L * H) / (J + L * H);
  11102. con = lam1 - lam2;
  11103. if (con < -Math.pi) {
  11104. lam2 -=TWO_PI;
  11105. } else if (con > Math.pi) {
  11106. lam2 += TWO_PI;
  11107. }
  11108. this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);
  11109. gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));
  11110. gamma = alpha_c = Math.asin(D * Math.sin(gamma0));
  11111. }
  11112. this.singam = Math.sin(gamma0);
  11113. this.cosgam = Math.cos(gamma0);
  11114. this.sinrot = Math.sin(gamma);
  11115. this.cosrot = Math.cos(gamma);
  11116. this.rB = 1 / this.B;
  11117. this.ArB = this.A * this.rB;
  11118. this.BrA = 1 / this.ArB;
  11119. if (this.no_off) {
  11120. this.u_0 = 0;
  11121. } else {
  11122. this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));
  11123. if (this.lat0 < 0) {
  11124. this.u_0 = - this.u_0;
  11125. }
  11126. }
  11127. F = 0.5 * gamma0;
  11128. this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));
  11129. this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));
  11130. }
  11131. /* Oblique Mercator forward equations--mapping lat,long to x,y
  11132. ----------------------------------------------------------*/
  11133. function forward$8(p) {
  11134. var coords = {};
  11135. var S, T, U, V, W, temp, u, v;
  11136. p.x = p.x - this.lam0;
  11137. if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {
  11138. W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);
  11139. temp = 1 / W;
  11140. S = 0.5 * (W - temp);
  11141. T = 0.5 * (W + temp);
  11142. V = Math.sin(this.B * p.x);
  11143. U = (S * this.singam - V * this.cosgam) / T;
  11144. if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {
  11145. throw new Error();
  11146. }
  11147. v = 0.5 * this.ArB * Math.log((1 - U)/(1 + U));
  11148. temp = Math.cos(this.B * p.x);
  11149. if (Math.abs(temp) < TOL) {
  11150. u = this.A * p.x;
  11151. } else {
  11152. u = this.ArB * Math.atan2((S * this.cosgam + V * this.singam), temp);
  11153. }
  11154. } else {
  11155. v = p.y > 0 ? this.v_pole_n : this.v_pole_s;
  11156. u = this.ArB * p.y;
  11157. }
  11158. if (this.no_rot) {
  11159. coords.x = u;
  11160. coords.y = v;
  11161. } else {
  11162. u -= this.u_0;
  11163. coords.x = v * this.cosrot + u * this.sinrot;
  11164. coords.y = u * this.cosrot - v * this.sinrot;
  11165. }
  11166. coords.x = (this.a * coords.x + this.x0);
  11167. coords.y = (this.a * coords.y + this.y0);
  11168. return coords;
  11169. }
  11170. function inverse$8(p) {
  11171. var u, v, Qp, Sp, Tp, Vp, Up;
  11172. var coords = {};
  11173. p.x = (p.x - this.x0) * (1.0 / this.a);
  11174. p.y = (p.y - this.y0) * (1.0 / this.a);
  11175. if (this.no_rot) {
  11176. v = p.y;
  11177. u = p.x;
  11178. } else {
  11179. v = p.x * this.cosrot - p.y * this.sinrot;
  11180. u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;
  11181. }
  11182. Qp = Math.exp(-this.BrA * v);
  11183. Sp = 0.5 * (Qp - 1 / Qp);
  11184. Tp = 0.5 * (Qp + 1 / Qp);
  11185. Vp = Math.sin(this.BrA * u);
  11186. Up = (Vp * this.cosgam + Sp * this.singam) / Tp;
  11187. if (Math.abs(Math.abs(Up) - 1) < EPSLN) {
  11188. coords.x = 0;
  11189. coords.y = Up < 0 ? -HALF_PI : HALF_PI;
  11190. } else {
  11191. coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));
  11192. coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));
  11193. if (coords.y === Infinity) {
  11194. throw new Error();
  11195. }
  11196. coords.x = -this.rB * Math.atan2((Sp * this.cosgam - Vp * this.singam), Math.cos(this.BrA * u));
  11197. }
  11198. coords.x += this.lam0;
  11199. return coords;
  11200. }
  11201. var names$10 = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"];
  11202. var omerc = {
  11203. init: init$9,
  11204. forward: forward$8,
  11205. inverse: inverse$8,
  11206. names: names$10
  11207. };
  11208. function init$10() {
  11209. //double lat0; /* the reference latitude */
  11210. //double long0; /* the reference longitude */
  11211. //double lat1; /* first standard parallel */
  11212. //double lat2; /* second standard parallel */
  11213. //double r_maj; /* major axis */
  11214. //double r_min; /* minor axis */
  11215. //double false_east; /* x offset in meters */
  11216. //double false_north; /* y offset in meters */
  11217. //the above value can be set with proj4.defs
  11218. //example: proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
  11219. if (!this.lat2) {
  11220. this.lat2 = this.lat1;
  11221. } //if lat2 is not defined
  11222. if (!this.k0) {
  11223. this.k0 = 1;
  11224. }
  11225. this.x0 = this.x0 || 0;
  11226. this.y0 = this.y0 || 0;
  11227. // Standard Parallels cannot be equal and on opposite sides of the equator
  11228. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  11229. return;
  11230. }
  11231. var temp = this.b / this.a;
  11232. this.e = Math.sqrt(1 - temp * temp);
  11233. var sin1 = Math.sin(this.lat1);
  11234. var cos1 = Math.cos(this.lat1);
  11235. var ms1 = msfnz(this.e, sin1, cos1);
  11236. var ts1 = tsfnz(this.e, this.lat1, sin1);
  11237. var sin2 = Math.sin(this.lat2);
  11238. var cos2 = Math.cos(this.lat2);
  11239. var ms2 = msfnz(this.e, sin2, cos2);
  11240. var ts2 = tsfnz(this.e, this.lat2, sin2);
  11241. var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
  11242. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  11243. this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
  11244. }
  11245. else {
  11246. this.ns = sin1;
  11247. }
  11248. if (isNaN(this.ns)) {
  11249. this.ns = sin1;
  11250. }
  11251. this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
  11252. this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
  11253. if (!this.title) {
  11254. this.title = "Lambert Conformal Conic";
  11255. }
  11256. }
  11257. // Lambert Conformal conic forward equations--mapping lat,long to x,y
  11258. // -----------------------------------------------------------------
  11259. function forward$9(p) {
  11260. var lon = p.x;
  11261. var lat = p.y;
  11262. // singular cases :
  11263. if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
  11264. lat = sign(lat) * (HALF_PI - 2 * EPSLN);
  11265. }
  11266. var con = Math.abs(Math.abs(lat) - HALF_PI);
  11267. var ts, rh1;
  11268. if (con > EPSLN) {
  11269. ts = tsfnz(this.e, lat, Math.sin(lat));
  11270. rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
  11271. }
  11272. else {
  11273. con = lat * this.ns;
  11274. if (con <= 0) {
  11275. return null;
  11276. }
  11277. rh1 = 0;
  11278. }
  11279. var theta = this.ns * adjust_lon(lon - this.long0);
  11280. p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
  11281. p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
  11282. return p;
  11283. }
  11284. // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
  11285. // -----------------------------------------------------------------
  11286. function inverse$9(p) {
  11287. var rh1, con, ts;
  11288. var lat, lon;
  11289. var x = (p.x - this.x0) / this.k0;
  11290. var y = (this.rh - (p.y - this.y0) / this.k0);
  11291. if (this.ns > 0) {
  11292. rh1 = Math.sqrt(x * x + y * y);
  11293. con = 1;
  11294. }
  11295. else {
  11296. rh1 = -Math.sqrt(x * x + y * y);
  11297. con = -1;
  11298. }
  11299. var theta = 0;
  11300. if (rh1 !== 0) {
  11301. theta = Math.atan2((con * x), (con * y));
  11302. }
  11303. if ((rh1 !== 0) || (this.ns > 0)) {
  11304. con = 1 / this.ns;
  11305. ts = Math.pow((rh1 / (this.a * this.f0)), con);
  11306. lat = phi2z(this.e, ts);
  11307. if (lat === -9999) {
  11308. return null;
  11309. }
  11310. }
  11311. else {
  11312. lat = -HALF_PI;
  11313. }
  11314. lon = adjust_lon(theta / this.ns + this.long0);
  11315. p.x = lon;
  11316. p.y = lat;
  11317. return p;
  11318. }
  11319. var names$11 = [
  11320. "Lambert Tangential Conformal Conic Projection",
  11321. "Lambert_Conformal_Conic",
  11322. "Lambert_Conformal_Conic_1SP",
  11323. "Lambert_Conformal_Conic_2SP",
  11324. "lcc",
  11325. "Lambert Conic Conformal (1SP)",
  11326. "Lambert Conic Conformal (2SP)"
  11327. ];
  11328. var lcc = {
  11329. init: init$10,
  11330. forward: forward$9,
  11331. inverse: inverse$9,
  11332. names: names$11
  11333. };
  11334. function init$11() {
  11335. this.a = 6377397.155;
  11336. this.es = 0.006674372230614;
  11337. this.e = Math.sqrt(this.es);
  11338. if (!this.lat0) {
  11339. this.lat0 = 0.863937979737193;
  11340. }
  11341. if (!this.long0) {
  11342. this.long0 = 0.7417649320975901 - 0.308341501185665;
  11343. }
  11344. /* if scale not set default to 0.9999 */
  11345. if (!this.k0) {
  11346. this.k0 = 0.9999;
  11347. }
  11348. this.s45 = 0.785398163397448; /* 45 */
  11349. this.s90 = 2 * this.s45;
  11350. this.fi0 = this.lat0;
  11351. this.e2 = this.es;
  11352. this.e = Math.sqrt(this.e2);
  11353. this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
  11354. this.uq = 1.04216856380474;
  11355. this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
  11356. this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
  11357. this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
  11358. this.k1 = this.k0;
  11359. this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
  11360. this.s0 = 1.37008346281555;
  11361. this.n = Math.sin(this.s0);
  11362. this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
  11363. this.ad = this.s90 - this.uq;
  11364. }
  11365. /* ellipsoid */
  11366. /* calculate xy from lat/lon */
  11367. /* Constants, identical to inverse transform function */
  11368. function forward$10(p) {
  11369. var gfi, u, deltav, s, d, eps, ro;
  11370. var lon = p.x;
  11371. var lat = p.y;
  11372. var delta_lon = adjust_lon(lon - this.long0);
  11373. /* Transformation */
  11374. gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
  11375. u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
  11376. deltav = -delta_lon * this.alfa;
  11377. s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
  11378. d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
  11379. eps = this.n * d;
  11380. ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
  11381. p.y = ro * Math.cos(eps) / 1;
  11382. p.x = ro * Math.sin(eps) / 1;
  11383. if (!this.czech) {
  11384. p.y *= -1;
  11385. p.x *= -1;
  11386. }
  11387. return (p);
  11388. }
  11389. /* calculate lat/lon from xy */
  11390. function inverse$10(p) {
  11391. var u, deltav, s, d, eps, ro, fi1;
  11392. var ok;
  11393. /* Transformation */
  11394. /* revert y, x*/
  11395. var tmp = p.x;
  11396. p.x = p.y;
  11397. p.y = tmp;
  11398. if (!this.czech) {
  11399. p.y *= -1;
  11400. p.x *= -1;
  11401. }
  11402. ro = Math.sqrt(p.x * p.x + p.y * p.y);
  11403. eps = Math.atan2(p.y, p.x);
  11404. d = eps / Math.sin(this.s0);
  11405. s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
  11406. u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
  11407. deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
  11408. p.x = this.long0 - deltav / this.alfa;
  11409. fi1 = u;
  11410. ok = 0;
  11411. var iter = 0;
  11412. do {
  11413. p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
  11414. if (Math.abs(fi1 - p.y) < 0.0000000001) {
  11415. ok = 1;
  11416. }
  11417. fi1 = p.y;
  11418. iter += 1;
  11419. } while (ok === 0 && iter < 15);
  11420. if (iter >= 15) {
  11421. return null;
  11422. }
  11423. return (p);
  11424. }
  11425. var names$12 = ["Krovak", "krovak"];
  11426. var krovak = {
  11427. init: init$11,
  11428. forward: forward$10,
  11429. inverse: inverse$10,
  11430. names: names$12
  11431. };
  11432. var mlfn = function(e0, e1, e2, e3, phi) {
  11433. return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
  11434. };
  11435. var e0fn = function(x) {
  11436. return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
  11437. };
  11438. var e1fn = function(x) {
  11439. return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
  11440. };
  11441. var e2fn = function(x) {
  11442. return (0.05859375 * x * x * (1 + 0.75 * x));
  11443. };
  11444. var e3fn = function(x) {
  11445. return (x * x * x * (35 / 3072));
  11446. };
  11447. var gN = function(a, e, sinphi) {
  11448. var temp = e * sinphi;
  11449. return a / Math.sqrt(1 - temp * temp);
  11450. };
  11451. var adjust_lat = function(x) {
  11452. return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
  11453. };
  11454. var imlfn = function(ml, e0, e1, e2, e3) {
  11455. var phi;
  11456. var dphi;
  11457. phi = ml / e0;
  11458. for (var i = 0; i < 15; i++) {
  11459. dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
  11460. phi += dphi;
  11461. if (Math.abs(dphi) <= 0.0000000001) {
  11462. return phi;
  11463. }
  11464. }
  11465. //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
  11466. return NaN;
  11467. };
  11468. function init$12() {
  11469. if (!this.sphere) {
  11470. this.e0 = e0fn(this.es);
  11471. this.e1 = e1fn(this.es);
  11472. this.e2 = e2fn(this.es);
  11473. this.e3 = e3fn(this.es);
  11474. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  11475. }
  11476. }
  11477. /* Cassini forward equations--mapping lat,long to x,y
  11478. -----------------------------------------------------------------------*/
  11479. function forward$11(p) {
  11480. /* Forward equations
  11481. -----------------*/
  11482. var x, y;
  11483. var lam = p.x;
  11484. var phi = p.y;
  11485. lam = adjust_lon(lam - this.long0);
  11486. if (this.sphere) {
  11487. x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
  11488. y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
  11489. }
  11490. else {
  11491. //ellipsoid
  11492. var sinphi = Math.sin(phi);
  11493. var cosphi = Math.cos(phi);
  11494. var nl = gN(this.a, this.e, sinphi);
  11495. var tl = Math.tan(phi) * Math.tan(phi);
  11496. var al = lam * Math.cos(phi);
  11497. var asq = al * al;
  11498. var cl = this.es * cosphi * cosphi / (1 - this.es);
  11499. var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  11500. x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
  11501. y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
  11502. }
  11503. p.x = x + this.x0;
  11504. p.y = y + this.y0;
  11505. return p;
  11506. }
  11507. /* Inverse equations
  11508. -----------------*/
  11509. function inverse$11(p) {
  11510. p.x -= this.x0;
  11511. p.y -= this.y0;
  11512. var x = p.x / this.a;
  11513. var y = p.y / this.a;
  11514. var phi, lam;
  11515. if (this.sphere) {
  11516. var dd = y + this.lat0;
  11517. phi = Math.asin(Math.sin(dd) * Math.cos(x));
  11518. lam = Math.atan2(Math.tan(x), Math.cos(dd));
  11519. }
  11520. else {
  11521. /* ellipsoid */
  11522. var ml1 = this.ml0 / this.a + y;
  11523. var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
  11524. if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
  11525. p.x = this.long0;
  11526. p.y = HALF_PI;
  11527. if (y < 0) {
  11528. p.y *= -1;
  11529. }
  11530. return p;
  11531. }
  11532. var nl1 = gN(this.a, this.e, Math.sin(phi1));
  11533. var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
  11534. var tl1 = Math.pow(Math.tan(phi1), 2);
  11535. var dl = x * this.a / nl1;
  11536. var dsq = dl * dl;
  11537. phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
  11538. lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
  11539. }
  11540. p.x = adjust_lon(lam + this.long0);
  11541. p.y = adjust_lat(phi);
  11542. return p;
  11543. }
  11544. var names$13 = ["Cassini", "Cassini_Soldner", "cass"];
  11545. var cass = {
  11546. init: init$12,
  11547. forward: forward$11,
  11548. inverse: inverse$11,
  11549. names: names$13
  11550. };
  11551. var qsfnz = function(eccent, sinphi) {
  11552. var con;
  11553. if (eccent > 1.0e-7) {
  11554. con = eccent * sinphi;
  11555. return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
  11556. }
  11557. else {
  11558. return (2 * sinphi);
  11559. }
  11560. };
  11561. /*
  11562. reference
  11563. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  11564. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  11565. */
  11566. var S_POLE = 1;
  11567. var N_POLE = 2;
  11568. var EQUIT = 3;
  11569. var OBLIQ = 4;
  11570. /* Initialize the Lambert Azimuthal Equal Area projection
  11571. ------------------------------------------------------*/
  11572. function init$13() {
  11573. var t = Math.abs(this.lat0);
  11574. if (Math.abs(t - HALF_PI) < EPSLN) {
  11575. this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
  11576. }
  11577. else if (Math.abs(t) < EPSLN) {
  11578. this.mode = this.EQUIT;
  11579. }
  11580. else {
  11581. this.mode = this.OBLIQ;
  11582. }
  11583. if (this.es > 0) {
  11584. var sinphi;
  11585. this.qp = qsfnz(this.e, 1);
  11586. this.mmf = 0.5 / (1 - this.es);
  11587. this.apa = authset(this.es);
  11588. switch (this.mode) {
  11589. case this.N_POLE:
  11590. this.dd = 1;
  11591. break;
  11592. case this.S_POLE:
  11593. this.dd = 1;
  11594. break;
  11595. case this.EQUIT:
  11596. this.rq = Math.sqrt(0.5 * this.qp);
  11597. this.dd = 1 / this.rq;
  11598. this.xmf = 1;
  11599. this.ymf = 0.5 * this.qp;
  11600. break;
  11601. case this.OBLIQ:
  11602. this.rq = Math.sqrt(0.5 * this.qp);
  11603. sinphi = Math.sin(this.lat0);
  11604. this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
  11605. this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
  11606. this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
  11607. this.ymf = (this.xmf = this.rq) / this.dd;
  11608. this.xmf *= this.dd;
  11609. break;
  11610. }
  11611. }
  11612. else {
  11613. if (this.mode === this.OBLIQ) {
  11614. this.sinph0 = Math.sin(this.lat0);
  11615. this.cosph0 = Math.cos(this.lat0);
  11616. }
  11617. }
  11618. }
  11619. /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  11620. -----------------------------------------------------------------------*/
  11621. function forward$12(p) {
  11622. /* Forward equations
  11623. -----------------*/
  11624. var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
  11625. var lam = p.x;
  11626. var phi = p.y;
  11627. lam = adjust_lon(lam - this.long0);
  11628. if (this.sphere) {
  11629. sinphi = Math.sin(phi);
  11630. cosphi = Math.cos(phi);
  11631. coslam = Math.cos(lam);
  11632. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  11633. y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  11634. if (y <= EPSLN) {
  11635. return null;
  11636. }
  11637. y = Math.sqrt(2 / y);
  11638. x = y * cosphi * Math.sin(lam);
  11639. y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  11640. }
  11641. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  11642. if (this.mode === this.N_POLE) {
  11643. coslam = -coslam;
  11644. }
  11645. if (Math.abs(phi + this.lat0) < EPSLN) {
  11646. return null;
  11647. }
  11648. y = FORTPI - phi * 0.5;
  11649. y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
  11650. x = y * Math.sin(lam);
  11651. y *= coslam;
  11652. }
  11653. }
  11654. else {
  11655. sinb = 0;
  11656. cosb = 0;
  11657. b = 0;
  11658. coslam = Math.cos(lam);
  11659. sinlam = Math.sin(lam);
  11660. sinphi = Math.sin(phi);
  11661. q = qsfnz(this.e, sinphi);
  11662. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  11663. sinb = q / this.qp;
  11664. cosb = Math.sqrt(1 - sinb * sinb);
  11665. }
  11666. switch (this.mode) {
  11667. case this.OBLIQ:
  11668. b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
  11669. break;
  11670. case this.EQUIT:
  11671. b = 1 + cosb * coslam;
  11672. break;
  11673. case this.N_POLE:
  11674. b = HALF_PI + phi;
  11675. q = this.qp - q;
  11676. break;
  11677. case this.S_POLE:
  11678. b = phi - HALF_PI;
  11679. q = this.qp + q;
  11680. break;
  11681. }
  11682. if (Math.abs(b) < EPSLN) {
  11683. return null;
  11684. }
  11685. switch (this.mode) {
  11686. case this.OBLIQ:
  11687. case this.EQUIT:
  11688. b = Math.sqrt(2 / b);
  11689. if (this.mode === this.OBLIQ) {
  11690. y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
  11691. }
  11692. else {
  11693. y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
  11694. }
  11695. x = this.xmf * b * cosb * sinlam;
  11696. break;
  11697. case this.N_POLE:
  11698. case this.S_POLE:
  11699. if (q >= 0) {
  11700. x = (b = Math.sqrt(q)) * sinlam;
  11701. y = coslam * ((this.mode === this.S_POLE) ? b : -b);
  11702. }
  11703. else {
  11704. x = y = 0;
  11705. }
  11706. break;
  11707. }
  11708. }
  11709. p.x = this.a * x + this.x0;
  11710. p.y = this.a * y + this.y0;
  11711. return p;
  11712. }
  11713. /* Inverse equations
  11714. -----------------*/
  11715. function inverse$12(p) {
  11716. p.x -= this.x0;
  11717. p.y -= this.y0;
  11718. var x = p.x / this.a;
  11719. var y = p.y / this.a;
  11720. var lam, phi, cCe, sCe, q, rho, ab;
  11721. if (this.sphere) {
  11722. var cosz = 0,
  11723. rh, sinz = 0;
  11724. rh = Math.sqrt(x * x + y * y);
  11725. phi = rh * 0.5;
  11726. if (phi > 1) {
  11727. return null;
  11728. }
  11729. phi = 2 * Math.asin(phi);
  11730. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  11731. sinz = Math.sin(phi);
  11732. cosz = Math.cos(phi);
  11733. }
  11734. switch (this.mode) {
  11735. case this.EQUIT:
  11736. phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
  11737. x *= sinz;
  11738. y = cosz * rh;
  11739. break;
  11740. case this.OBLIQ:
  11741. phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
  11742. x *= sinz * this.cosph0;
  11743. y = (cosz - Math.sin(phi) * this.sinph0) * rh;
  11744. break;
  11745. case this.N_POLE:
  11746. y = -y;
  11747. phi = HALF_PI - phi;
  11748. break;
  11749. case this.S_POLE:
  11750. phi -= HALF_PI;
  11751. break;
  11752. }
  11753. lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
  11754. }
  11755. else {
  11756. ab = 0;
  11757. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  11758. x /= this.dd;
  11759. y *= this.dd;
  11760. rho = Math.sqrt(x * x + y * y);
  11761. if (rho < EPSLN) {
  11762. p.x = this.long0;
  11763. p.y = this.lat0;
  11764. return p;
  11765. }
  11766. sCe = 2 * Math.asin(0.5 * rho / this.rq);
  11767. cCe = Math.cos(sCe);
  11768. x *= (sCe = Math.sin(sCe));
  11769. if (this.mode === this.OBLIQ) {
  11770. ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
  11771. q = this.qp * ab;
  11772. y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
  11773. }
  11774. else {
  11775. ab = y * sCe / rho;
  11776. q = this.qp * ab;
  11777. y = rho * cCe;
  11778. }
  11779. }
  11780. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  11781. if (this.mode === this.N_POLE) {
  11782. y = -y;
  11783. }
  11784. q = (x * x + y * y);
  11785. if (!q) {
  11786. p.x = this.long0;
  11787. p.y = this.lat0;
  11788. return p;
  11789. }
  11790. ab = 1 - q / this.qp;
  11791. if (this.mode === this.S_POLE) {
  11792. ab = -ab;
  11793. }
  11794. }
  11795. lam = Math.atan2(x, y);
  11796. phi = authlat(Math.asin(ab), this.apa);
  11797. }
  11798. p.x = adjust_lon(this.long0 + lam);
  11799. p.y = phi;
  11800. return p;
  11801. }
  11802. /* determine latitude from authalic latitude */
  11803. var P00 = 0.33333333333333333333;
  11804. var P01 = 0.17222222222222222222;
  11805. var P02 = 0.10257936507936507936;
  11806. var P10 = 0.06388888888888888888;
  11807. var P11 = 0.06640211640211640211;
  11808. var P20 = 0.01641501294219154443;
  11809. function authset(es) {
  11810. var t;
  11811. var APA = [];
  11812. APA[0] = es * P00;
  11813. t = es * es;
  11814. APA[0] += t * P01;
  11815. APA[1] = t * P10;
  11816. t *= es;
  11817. APA[0] += t * P02;
  11818. APA[1] += t * P11;
  11819. APA[2] = t * P20;
  11820. return APA;
  11821. }
  11822. function authlat(beta, APA) {
  11823. var t = beta + beta;
  11824. return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
  11825. }
  11826. var names$14 = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
  11827. var laea = {
  11828. init: init$13,
  11829. forward: forward$12,
  11830. inverse: inverse$12,
  11831. names: names$14,
  11832. S_POLE: S_POLE,
  11833. N_POLE: N_POLE,
  11834. EQUIT: EQUIT,
  11835. OBLIQ: OBLIQ
  11836. };
  11837. var asinz = function(x) {
  11838. if (Math.abs(x) > 1) {
  11839. x = (x > 1) ? 1 : -1;
  11840. }
  11841. return Math.asin(x);
  11842. };
  11843. function init$14() {
  11844. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  11845. return;
  11846. }
  11847. this.temp = this.b / this.a;
  11848. this.es = 1 - Math.pow(this.temp, 2);
  11849. this.e3 = Math.sqrt(this.es);
  11850. this.sin_po = Math.sin(this.lat1);
  11851. this.cos_po = Math.cos(this.lat1);
  11852. this.t1 = this.sin_po;
  11853. this.con = this.sin_po;
  11854. this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
  11855. this.qs1 = qsfnz(this.e3, this.sin_po);
  11856. this.sin_po = Math.sin(this.lat2);
  11857. this.cos_po = Math.cos(this.lat2);
  11858. this.t2 = this.sin_po;
  11859. this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
  11860. this.qs2 = qsfnz(this.e3, this.sin_po);
  11861. this.sin_po = Math.sin(this.lat0);
  11862. this.cos_po = Math.cos(this.lat0);
  11863. this.t3 = this.sin_po;
  11864. this.qs0 = qsfnz(this.e3, this.sin_po);
  11865. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  11866. this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
  11867. }
  11868. else {
  11869. this.ns0 = this.con;
  11870. }
  11871. this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
  11872. this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
  11873. }
  11874. /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
  11875. -------------------------------------------------------------------*/
  11876. function forward$13(p) {
  11877. var lon = p.x;
  11878. var lat = p.y;
  11879. this.sin_phi = Math.sin(lat);
  11880. this.cos_phi = Math.cos(lat);
  11881. var qs = qsfnz(this.e3, this.sin_phi);
  11882. var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
  11883. var theta = this.ns0 * adjust_lon(lon - this.long0);
  11884. var x = rh1 * Math.sin(theta) + this.x0;
  11885. var y = this.rh - rh1 * Math.cos(theta) + this.y0;
  11886. p.x = x;
  11887. p.y = y;
  11888. return p;
  11889. }
  11890. function inverse$13(p) {
  11891. var rh1, qs, con, theta, lon, lat;
  11892. p.x -= this.x0;
  11893. p.y = this.rh - p.y + this.y0;
  11894. if (this.ns0 >= 0) {
  11895. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  11896. con = 1;
  11897. }
  11898. else {
  11899. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  11900. con = -1;
  11901. }
  11902. theta = 0;
  11903. if (rh1 !== 0) {
  11904. theta = Math.atan2(con * p.x, con * p.y);
  11905. }
  11906. con = rh1 * this.ns0 / this.a;
  11907. if (this.sphere) {
  11908. lat = Math.asin((this.c - con * con) / (2 * this.ns0));
  11909. }
  11910. else {
  11911. qs = (this.c - con * con) / this.ns0;
  11912. lat = this.phi1z(this.e3, qs);
  11913. }
  11914. lon = adjust_lon(theta / this.ns0 + this.long0);
  11915. p.x = lon;
  11916. p.y = lat;
  11917. return p;
  11918. }
  11919. /* Function to compute phi1, the latitude for the inverse of the
  11920. Albers Conical Equal-Area projection.
  11921. -------------------------------------------*/
  11922. function phi1z(eccent, qs) {
  11923. var sinphi, cosphi, con, com, dphi;
  11924. var phi = asinz(0.5 * qs);
  11925. if (eccent < EPSLN) {
  11926. return phi;
  11927. }
  11928. var eccnts = eccent * eccent;
  11929. for (var i = 1; i <= 25; i++) {
  11930. sinphi = Math.sin(phi);
  11931. cosphi = Math.cos(phi);
  11932. con = eccent * sinphi;
  11933. com = 1 - con * con;
  11934. dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  11935. phi = phi + dphi;
  11936. if (Math.abs(dphi) <= 1e-7) {
  11937. return phi;
  11938. }
  11939. }
  11940. return null;
  11941. }
  11942. var names$15 = ["Albers_Conic_Equal_Area", "Albers", "aea"];
  11943. var aea = {
  11944. init: init$14,
  11945. forward: forward$13,
  11946. inverse: inverse$13,
  11947. names: names$15,
  11948. phi1z: phi1z
  11949. };
  11950. /*
  11951. reference:
  11952. Wolfram Mathworld "Gnomonic Projection"
  11953. http://mathworld.wolfram.com/GnomonicProjection.html
  11954. Accessed: 12th November 2009
  11955. */
  11956. function init$15() {
  11957. /* Place parameters in static storage for common use
  11958. -------------------------------------------------*/
  11959. this.sin_p14 = Math.sin(this.lat0);
  11960. this.cos_p14 = Math.cos(this.lat0);
  11961. // Approximation for projecting points to the horizon (infinity)
  11962. this.infinity_dist = 1000 * this.a;
  11963. this.rc = 1;
  11964. }
  11965. /* Gnomonic forward equations--mapping lat,long to x,y
  11966. ---------------------------------------------------*/
  11967. function forward$14(p) {
  11968. var sinphi, cosphi; /* sin and cos value */
  11969. var dlon; /* delta longitude value */
  11970. var coslon; /* cos of longitude */
  11971. var ksp; /* scale factor */
  11972. var g;
  11973. var x, y;
  11974. var lon = p.x;
  11975. var lat = p.y;
  11976. /* Forward equations
  11977. -----------------*/
  11978. dlon = adjust_lon(lon - this.long0);
  11979. sinphi = Math.sin(lat);
  11980. cosphi = Math.cos(lat);
  11981. coslon = Math.cos(dlon);
  11982. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  11983. ksp = 1;
  11984. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  11985. x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
  11986. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
  11987. }
  11988. else {
  11989. // Point is in the opposing hemisphere and is unprojectable
  11990. // We still need to return a reasonable point, so we project
  11991. // to infinity, on a bearing
  11992. // equivalent to the northern hemisphere equivalent
  11993. // This is a reasonable approximation for short shapes and lines that
  11994. // straddle the horizon.
  11995. x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
  11996. y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  11997. }
  11998. p.x = x;
  11999. p.y = y;
  12000. return p;
  12001. }
  12002. function inverse$14(p) {
  12003. var rh; /* Rho */
  12004. var sinc, cosc;
  12005. var c;
  12006. var lon, lat;
  12007. /* Inverse equations
  12008. -----------------*/
  12009. p.x = (p.x - this.x0) / this.a;
  12010. p.y = (p.y - this.y0) / this.a;
  12011. p.x /= this.k0;
  12012. p.y /= this.k0;
  12013. if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
  12014. c = Math.atan2(rh, this.rc);
  12015. sinc = Math.sin(c);
  12016. cosc = Math.cos(c);
  12017. lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
  12018. lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
  12019. lon = adjust_lon(this.long0 + lon);
  12020. }
  12021. else {
  12022. lat = this.phic0;
  12023. lon = 0;
  12024. }
  12025. p.x = lon;
  12026. p.y = lat;
  12027. return p;
  12028. }
  12029. var names$16 = ["gnom"];
  12030. var gnom = {
  12031. init: init$15,
  12032. forward: forward$14,
  12033. inverse: inverse$14,
  12034. names: names$16
  12035. };
  12036. var iqsfnz = function(eccent, q) {
  12037. var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
  12038. if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
  12039. if (q < 0) {
  12040. return (-1 * HALF_PI);
  12041. }
  12042. else {
  12043. return HALF_PI;
  12044. }
  12045. }
  12046. //var phi = 0.5* q/(1-eccent*eccent);
  12047. var phi = Math.asin(0.5 * q);
  12048. var dphi;
  12049. var sin_phi;
  12050. var cos_phi;
  12051. var con;
  12052. for (var i = 0; i < 30; i++) {
  12053. sin_phi = Math.sin(phi);
  12054. cos_phi = Math.cos(phi);
  12055. con = eccent * sin_phi;
  12056. dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  12057. phi += dphi;
  12058. if (Math.abs(dphi) <= 0.0000000001) {
  12059. return phi;
  12060. }
  12061. }
  12062. //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
  12063. return NaN;
  12064. };
  12065. /*
  12066. reference:
  12067. "Cartographic Projection Procedures for the UNIX Environment-
  12068. A User's Manual" by Gerald I. Evenden,
  12069. USGS Open File Report 90-284and Release 4 Interim Reports (2003)
  12070. */
  12071. function init$16() {
  12072. //no-op
  12073. if (!this.sphere) {
  12074. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  12075. }
  12076. }
  12077. /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
  12078. ------------------------------------------------------------*/
  12079. function forward$15(p) {
  12080. var lon = p.x;
  12081. var lat = p.y;
  12082. var x, y;
  12083. /* Forward equations
  12084. -----------------*/
  12085. var dlon = adjust_lon(lon - this.long0);
  12086. if (this.sphere) {
  12087. x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
  12088. y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
  12089. }
  12090. else {
  12091. var qs = qsfnz(this.e, Math.sin(lat));
  12092. x = this.x0 + this.a * this.k0 * dlon;
  12093. y = this.y0 + this.a * qs * 0.5 / this.k0;
  12094. }
  12095. p.x = x;
  12096. p.y = y;
  12097. return p;
  12098. }
  12099. /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
  12100. ------------------------------------------------------------*/
  12101. function inverse$15(p) {
  12102. p.x -= this.x0;
  12103. p.y -= this.y0;
  12104. var lon, lat;
  12105. if (this.sphere) {
  12106. lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
  12107. lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
  12108. }
  12109. else {
  12110. lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
  12111. lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
  12112. }
  12113. p.x = lon;
  12114. p.y = lat;
  12115. return p;
  12116. }
  12117. var names$17 = ["cea"];
  12118. var cea = {
  12119. init: init$16,
  12120. forward: forward$15,
  12121. inverse: inverse$15,
  12122. names: names$17
  12123. };
  12124. function init$17() {
  12125. this.x0 = this.x0 || 0;
  12126. this.y0 = this.y0 || 0;
  12127. this.lat0 = this.lat0 || 0;
  12128. this.long0 = this.long0 || 0;
  12129. this.lat_ts = this.lat_ts || 0;
  12130. this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
  12131. this.rc = Math.cos(this.lat_ts);
  12132. }
  12133. // forward equations--mapping lat,long to x,y
  12134. // -----------------------------------------------------------------
  12135. function forward$16(p) {
  12136. var lon = p.x;
  12137. var lat = p.y;
  12138. var dlon = adjust_lon(lon - this.long0);
  12139. var dlat = adjust_lat(lat - this.lat0);
  12140. p.x = this.x0 + (this.a * dlon * this.rc);
  12141. p.y = this.y0 + (this.a * dlat);
  12142. return p;
  12143. }
  12144. // inverse equations--mapping x,y to lat/long
  12145. // -----------------------------------------------------------------
  12146. function inverse$16(p) {
  12147. var x = p.x;
  12148. var y = p.y;
  12149. p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
  12150. p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
  12151. return p;
  12152. }
  12153. var names$18 = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
  12154. var eqc = {
  12155. init: init$17,
  12156. forward: forward$16,
  12157. inverse: inverse$16,
  12158. names: names$18
  12159. };
  12160. var MAX_ITER$2 = 20;
  12161. function init$18() {
  12162. /* Place parameters in static storage for common use
  12163. -------------------------------------------------*/
  12164. this.temp = this.b / this.a;
  12165. this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
  12166. this.e = Math.sqrt(this.es);
  12167. this.e0 = e0fn(this.es);
  12168. this.e1 = e1fn(this.es);
  12169. this.e2 = e2fn(this.es);
  12170. this.e3 = e3fn(this.es);
  12171. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
  12172. }
  12173. /* Polyconic forward equations--mapping lat,long to x,y
  12174. ---------------------------------------------------*/
  12175. function forward$17(p) {
  12176. var lon = p.x;
  12177. var lat = p.y;
  12178. var x, y, el;
  12179. var dlon = adjust_lon(lon - this.long0);
  12180. el = dlon * Math.sin(lat);
  12181. if (this.sphere) {
  12182. if (Math.abs(lat) <= EPSLN) {
  12183. x = this.a * dlon;
  12184. y = -1 * this.a * this.lat0;
  12185. }
  12186. else {
  12187. x = this.a * Math.sin(el) / Math.tan(lat);
  12188. y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
  12189. }
  12190. }
  12191. else {
  12192. if (Math.abs(lat) <= EPSLN) {
  12193. x = this.a * dlon;
  12194. y = -1 * this.ml0;
  12195. }
  12196. else {
  12197. var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
  12198. x = nl * Math.sin(el);
  12199. y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
  12200. }
  12201. }
  12202. p.x = x + this.x0;
  12203. p.y = y + this.y0;
  12204. return p;
  12205. }
  12206. /* Inverse equations
  12207. -----------------*/
  12208. function inverse$17(p) {
  12209. var lon, lat, x, y, i;
  12210. var al, bl;
  12211. var phi, dphi;
  12212. x = p.x - this.x0;
  12213. y = p.y - this.y0;
  12214. if (this.sphere) {
  12215. if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
  12216. lon = adjust_lon(x / this.a + this.long0);
  12217. lat = 0;
  12218. }
  12219. else {
  12220. al = this.lat0 + y / this.a;
  12221. bl = x * x / this.a / this.a + al * al;
  12222. phi = al;
  12223. var tanphi;
  12224. for (i = MAX_ITER$2; i; --i) {
  12225. tanphi = Math.tan(phi);
  12226. dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
  12227. phi += dphi;
  12228. if (Math.abs(dphi) <= EPSLN) {
  12229. lat = phi;
  12230. break;
  12231. }
  12232. }
  12233. lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
  12234. }
  12235. }
  12236. else {
  12237. if (Math.abs(y + this.ml0) <= EPSLN) {
  12238. lat = 0;
  12239. lon = adjust_lon(this.long0 + x / this.a);
  12240. }
  12241. else {
  12242. al = (this.ml0 + y) / this.a;
  12243. bl = x * x / this.a / this.a + al * al;
  12244. phi = al;
  12245. var cl, mln, mlnp, ma;
  12246. var con;
  12247. for (i = MAX_ITER$2; i; --i) {
  12248. con = this.e * Math.sin(phi);
  12249. cl = Math.sqrt(1 - con * con) * Math.tan(phi);
  12250. mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  12251. mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
  12252. ma = mln / this.a;
  12253. dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
  12254. phi -= dphi;
  12255. if (Math.abs(dphi) <= EPSLN) {
  12256. lat = phi;
  12257. break;
  12258. }
  12259. }
  12260. //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
  12261. cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
  12262. lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
  12263. }
  12264. }
  12265. p.x = lon;
  12266. p.y = lat;
  12267. return p;
  12268. }
  12269. var names$19 = ["Polyconic", "poly"];
  12270. var poly = {
  12271. init: init$18,
  12272. forward: forward$17,
  12273. inverse: inverse$17,
  12274. names: names$19
  12275. };
  12276. /*
  12277. reference
  12278. Department of Land and Survey Technical Circular 1973/32
  12279. http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
  12280. OSG Technical Report 4.1
  12281. http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
  12282. */
  12283. /**
  12284. * iterations: Number of iterations to refine inverse transform.
  12285. * 0 -> km accuracy
  12286. * 1 -> m accuracy -- suitable for most mapping applications
  12287. * 2 -> mm accuracy
  12288. */
  12289. function init$19() {
  12290. this.A = [];
  12291. this.A[1] = 0.6399175073;
  12292. this.A[2] = -0.1358797613;
  12293. this.A[3] = 0.063294409;
  12294. this.A[4] = -0.02526853;
  12295. this.A[5] = 0.0117879;
  12296. this.A[6] = -0.0055161;
  12297. this.A[7] = 0.0026906;
  12298. this.A[8] = -0.001333;
  12299. this.A[9] = 0.00067;
  12300. this.A[10] = -0.00034;
  12301. this.B_re = [];
  12302. this.B_im = [];
  12303. this.B_re[1] = 0.7557853228;
  12304. this.B_im[1] = 0;
  12305. this.B_re[2] = 0.249204646;
  12306. this.B_im[2] = 0.003371507;
  12307. this.B_re[3] = -0.001541739;
  12308. this.B_im[3] = 0.041058560;
  12309. this.B_re[4] = -0.10162907;
  12310. this.B_im[4] = 0.01727609;
  12311. this.B_re[5] = -0.26623489;
  12312. this.B_im[5] = -0.36249218;
  12313. this.B_re[6] = -0.6870983;
  12314. this.B_im[6] = -1.1651967;
  12315. this.C_re = [];
  12316. this.C_im = [];
  12317. this.C_re[1] = 1.3231270439;
  12318. this.C_im[1] = 0;
  12319. this.C_re[2] = -0.577245789;
  12320. this.C_im[2] = -0.007809598;
  12321. this.C_re[3] = 0.508307513;
  12322. this.C_im[3] = -0.112208952;
  12323. this.C_re[4] = -0.15094762;
  12324. this.C_im[4] = 0.18200602;
  12325. this.C_re[5] = 1.01418179;
  12326. this.C_im[5] = 1.64497696;
  12327. this.C_re[6] = 1.9660549;
  12328. this.C_im[6] = 2.5127645;
  12329. this.D = [];
  12330. this.D[1] = 1.5627014243;
  12331. this.D[2] = 0.5185406398;
  12332. this.D[3] = -0.03333098;
  12333. this.D[4] = -0.1052906;
  12334. this.D[5] = -0.0368594;
  12335. this.D[6] = 0.007317;
  12336. this.D[7] = 0.01220;
  12337. this.D[8] = 0.00394;
  12338. this.D[9] = -0.0013;
  12339. }
  12340. /**
  12341. New Zealand Map Grid Forward - long/lat to x/y
  12342. long/lat in radians
  12343. */
  12344. function forward$18(p) {
  12345. var n;
  12346. var lon = p.x;
  12347. var lat = p.y;
  12348. var delta_lat = lat - this.lat0;
  12349. var delta_lon = lon - this.long0;
  12350. // 1. Calculate d_phi and d_psi ... // and d_lambda
  12351. // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
  12352. var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
  12353. var d_lambda = delta_lon;
  12354. var d_phi_n = 1; // d_phi^0
  12355. var d_psi = 0;
  12356. for (n = 1; n <= 10; n++) {
  12357. d_phi_n = d_phi_n * d_phi;
  12358. d_psi = d_psi + this.A[n] * d_phi_n;
  12359. }
  12360. // 2. Calculate theta
  12361. var th_re = d_psi;
  12362. var th_im = d_lambda;
  12363. // 3. Calculate z
  12364. var th_n_re = 1;
  12365. var th_n_im = 0; // theta^0
  12366. var th_n_re1;
  12367. var th_n_im1;
  12368. var z_re = 0;
  12369. var z_im = 0;
  12370. for (n = 1; n <= 6; n++) {
  12371. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  12372. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  12373. th_n_re = th_n_re1;
  12374. th_n_im = th_n_im1;
  12375. z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
  12376. z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
  12377. }
  12378. // 4. Calculate easting and northing
  12379. p.x = (z_im * this.a) + this.x0;
  12380. p.y = (z_re * this.a) + this.y0;
  12381. return p;
  12382. }
  12383. /**
  12384. New Zealand Map Grid Inverse - x/y to long/lat
  12385. */
  12386. function inverse$18(p) {
  12387. var n;
  12388. var x = p.x;
  12389. var y = p.y;
  12390. var delta_x = x - this.x0;
  12391. var delta_y = y - this.y0;
  12392. // 1. Calculate z
  12393. var z_re = delta_y / this.a;
  12394. var z_im = delta_x / this.a;
  12395. // 2a. Calculate theta - first approximation gives km accuracy
  12396. var z_n_re = 1;
  12397. var z_n_im = 0; // z^0
  12398. var z_n_re1;
  12399. var z_n_im1;
  12400. var th_re = 0;
  12401. var th_im = 0;
  12402. for (n = 1; n <= 6; n++) {
  12403. z_n_re1 = z_n_re * z_re - z_n_im * z_im;
  12404. z_n_im1 = z_n_im * z_re + z_n_re * z_im;
  12405. z_n_re = z_n_re1;
  12406. z_n_im = z_n_im1;
  12407. th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
  12408. th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
  12409. }
  12410. // 2b. Iterate to refine the accuracy of the calculation
  12411. // 0 iterations gives km accuracy
  12412. // 1 iteration gives m accuracy -- good enough for most mapping applications
  12413. // 2 iterations bives mm accuracy
  12414. for (var i = 0; i < this.iterations; i++) {
  12415. var th_n_re = th_re;
  12416. var th_n_im = th_im;
  12417. var th_n_re1;
  12418. var th_n_im1;
  12419. var num_re = z_re;
  12420. var num_im = z_im;
  12421. for (n = 2; n <= 6; n++) {
  12422. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  12423. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  12424. th_n_re = th_n_re1;
  12425. th_n_im = th_n_im1;
  12426. num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  12427. num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  12428. }
  12429. th_n_re = 1;
  12430. th_n_im = 0;
  12431. var den_re = this.B_re[1];
  12432. var den_im = this.B_im[1];
  12433. for (n = 2; n <= 6; n++) {
  12434. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  12435. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  12436. th_n_re = th_n_re1;
  12437. th_n_im = th_n_im1;
  12438. den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  12439. den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  12440. }
  12441. // Complex division
  12442. var den2 = den_re * den_re + den_im * den_im;
  12443. th_re = (num_re * den_re + num_im * den_im) / den2;
  12444. th_im = (num_im * den_re - num_re * den_im) / den2;
  12445. }
  12446. // 3. Calculate d_phi ... // and d_lambda
  12447. var d_psi = th_re;
  12448. var d_lambda = th_im;
  12449. var d_psi_n = 1; // d_psi^0
  12450. var d_phi = 0;
  12451. for (n = 1; n <= 9; n++) {
  12452. d_psi_n = d_psi_n * d_psi;
  12453. d_phi = d_phi + this.D[n] * d_psi_n;
  12454. }
  12455. // 4. Calculate latitude and longitude
  12456. // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
  12457. var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
  12458. var lon = this.long0 + d_lambda;
  12459. p.x = lon;
  12460. p.y = lat;
  12461. return p;
  12462. }
  12463. var names$20 = ["New_Zealand_Map_Grid", "nzmg"];
  12464. var nzmg = {
  12465. init: init$19,
  12466. forward: forward$18,
  12467. inverse: inverse$18,
  12468. names: names$20
  12469. };
  12470. /*
  12471. reference
  12472. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  12473. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  12474. */
  12475. /* Initialize the Miller Cylindrical projection
  12476. -------------------------------------------*/
  12477. function init$20() {
  12478. //no-op
  12479. }
  12480. /* Miller Cylindrical forward equations--mapping lat,long to x,y
  12481. ------------------------------------------------------------*/
  12482. function forward$19(p) {
  12483. var lon = p.x;
  12484. var lat = p.y;
  12485. /* Forward equations
  12486. -----------------*/
  12487. var dlon = adjust_lon(lon - this.long0);
  12488. var x = this.x0 + this.a * dlon;
  12489. var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
  12490. p.x = x;
  12491. p.y = y;
  12492. return p;
  12493. }
  12494. /* Miller Cylindrical inverse equations--mapping x,y to lat/long
  12495. ------------------------------------------------------------*/
  12496. function inverse$19(p) {
  12497. p.x -= this.x0;
  12498. p.y -= this.y0;
  12499. var lon = adjust_lon(this.long0 + p.x / this.a);
  12500. var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
  12501. p.x = lon;
  12502. p.y = lat;
  12503. return p;
  12504. }
  12505. var names$21 = ["Miller_Cylindrical", "mill"];
  12506. var mill = {
  12507. init: init$20,
  12508. forward: forward$19,
  12509. inverse: inverse$19,
  12510. names: names$21
  12511. };
  12512. var MAX_ITER$3 = 20;
  12513. function init$21() {
  12514. /* Place parameters in static storage for common use
  12515. -------------------------------------------------*/
  12516. if (!this.sphere) {
  12517. this.en = pj_enfn(this.es);
  12518. }
  12519. else {
  12520. this.n = 1;
  12521. this.m = 0;
  12522. this.es = 0;
  12523. this.C_y = Math.sqrt((this.m + 1) / this.n);
  12524. this.C_x = this.C_y / (this.m + 1);
  12525. }
  12526. }
  12527. /* Sinusoidal forward equations--mapping lat,long to x,y
  12528. -----------------------------------------------------*/
  12529. function forward$20(p) {
  12530. var x, y;
  12531. var lon = p.x;
  12532. var lat = p.y;
  12533. /* Forward equations
  12534. -----------------*/
  12535. lon = adjust_lon(lon - this.long0);
  12536. if (this.sphere) {
  12537. if (!this.m) {
  12538. lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
  12539. }
  12540. else {
  12541. var k = this.n * Math.sin(lat);
  12542. for (var i = MAX_ITER$3; i; --i) {
  12543. var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
  12544. lat -= V;
  12545. if (Math.abs(V) < EPSLN) {
  12546. break;
  12547. }
  12548. }
  12549. }
  12550. x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
  12551. y = this.a * this.C_y * lat;
  12552. }
  12553. else {
  12554. var s = Math.sin(lat);
  12555. var c = Math.cos(lat);
  12556. y = this.a * pj_mlfn(lat, s, c, this.en);
  12557. x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
  12558. }
  12559. p.x = x;
  12560. p.y = y;
  12561. return p;
  12562. }
  12563. function inverse$20(p) {
  12564. var lat, temp, lon, s;
  12565. p.x -= this.x0;
  12566. lon = p.x / this.a;
  12567. p.y -= this.y0;
  12568. lat = p.y / this.a;
  12569. if (this.sphere) {
  12570. lat /= this.C_y;
  12571. lon = lon / (this.C_x * (this.m + Math.cos(lat)));
  12572. if (this.m) {
  12573. lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
  12574. }
  12575. else if (this.n !== 1) {
  12576. lat = asinz(Math.sin(lat) / this.n);
  12577. }
  12578. lon = adjust_lon(lon + this.long0);
  12579. lat = adjust_lat(lat);
  12580. }
  12581. else {
  12582. lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
  12583. s = Math.abs(lat);
  12584. if (s < HALF_PI) {
  12585. s = Math.sin(lat);
  12586. temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
  12587. //temp = this.long0 + p.x / (this.a * Math.cos(lat));
  12588. lon = adjust_lon(temp);
  12589. }
  12590. else if ((s - EPSLN) < HALF_PI) {
  12591. lon = this.long0;
  12592. }
  12593. }
  12594. p.x = lon;
  12595. p.y = lat;
  12596. return p;
  12597. }
  12598. var names$22 = ["Sinusoidal", "sinu"];
  12599. var sinu = {
  12600. init: init$21,
  12601. forward: forward$20,
  12602. inverse: inverse$20,
  12603. names: names$22
  12604. };
  12605. function init$22() {}
  12606. /* Mollweide forward equations--mapping lat,long to x,y
  12607. ----------------------------------------------------*/
  12608. function forward$21(p) {
  12609. /* Forward equations
  12610. -----------------*/
  12611. var lon = p.x;
  12612. var lat = p.y;
  12613. var delta_lon = adjust_lon(lon - this.long0);
  12614. var theta = lat;
  12615. var con = Math.PI * Math.sin(lat);
  12616. /* Iterate using the Newton-Raphson method to find theta
  12617. -----------------------------------------------------*/
  12618. while (true) {
  12619. var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
  12620. theta += delta_theta;
  12621. if (Math.abs(delta_theta) < EPSLN) {
  12622. break;
  12623. }
  12624. }
  12625. theta /= 2;
  12626. /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
  12627. this is done here because of precision problems with "cos(theta)"
  12628. --------------------------------------------------------------------------*/
  12629. if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
  12630. delta_lon = 0;
  12631. }
  12632. var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
  12633. var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
  12634. p.x = x;
  12635. p.y = y;
  12636. return p;
  12637. }
  12638. function inverse$21(p) {
  12639. var theta;
  12640. var arg;
  12641. /* Inverse equations
  12642. -----------------*/
  12643. p.x -= this.x0;
  12644. p.y -= this.y0;
  12645. arg = p.y / (1.4142135623731 * this.a);
  12646. /* Because of division by zero problems, 'arg' can not be 1. Therefore
  12647. a number very close to one is used instead.
  12648. -------------------------------------------------------------------*/
  12649. if (Math.abs(arg) > 0.999999999999) {
  12650. arg = 0.999999999999;
  12651. }
  12652. theta = Math.asin(arg);
  12653. var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
  12654. if (lon < (-Math.PI)) {
  12655. lon = -Math.PI;
  12656. }
  12657. if (lon > Math.PI) {
  12658. lon = Math.PI;
  12659. }
  12660. arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
  12661. if (Math.abs(arg) > 1) {
  12662. arg = 1;
  12663. }
  12664. var lat = Math.asin(arg);
  12665. p.x = lon;
  12666. p.y = lat;
  12667. return p;
  12668. }
  12669. var names$23 = ["Mollweide", "moll"];
  12670. var moll = {
  12671. init: init$22,
  12672. forward: forward$21,
  12673. inverse: inverse$21,
  12674. names: names$23
  12675. };
  12676. function init$23() {
  12677. /* Place parameters in static storage for common use
  12678. -------------------------------------------------*/
  12679. // Standard Parallels cannot be equal and on opposite sides of the equator
  12680. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  12681. return;
  12682. }
  12683. this.lat2 = this.lat2 || this.lat1;
  12684. this.temp = this.b / this.a;
  12685. this.es = 1 - Math.pow(this.temp, 2);
  12686. this.e = Math.sqrt(this.es);
  12687. this.e0 = e0fn(this.es);
  12688. this.e1 = e1fn(this.es);
  12689. this.e2 = e2fn(this.es);
  12690. this.e3 = e3fn(this.es);
  12691. this.sinphi = Math.sin(this.lat1);
  12692. this.cosphi = Math.cos(this.lat1);
  12693. this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
  12694. this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
  12695. if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
  12696. this.ns = this.sinphi;
  12697. }
  12698. else {
  12699. this.sinphi = Math.sin(this.lat2);
  12700. this.cosphi = Math.cos(this.lat2);
  12701. this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
  12702. this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
  12703. this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
  12704. }
  12705. this.g = this.ml1 + this.ms1 / this.ns;
  12706. this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  12707. this.rh = this.a * (this.g - this.ml0);
  12708. }
  12709. /* Equidistant Conic forward equations--mapping lat,long to x,y
  12710. -----------------------------------------------------------*/
  12711. function forward$22(p) {
  12712. var lon = p.x;
  12713. var lat = p.y;
  12714. var rh1;
  12715. /* Forward equations
  12716. -----------------*/
  12717. if (this.sphere) {
  12718. rh1 = this.a * (this.g - lat);
  12719. }
  12720. else {
  12721. var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
  12722. rh1 = this.a * (this.g - ml);
  12723. }
  12724. var theta = this.ns * adjust_lon(lon - this.long0);
  12725. var x = this.x0 + rh1 * Math.sin(theta);
  12726. var y = this.y0 + this.rh - rh1 * Math.cos(theta);
  12727. p.x = x;
  12728. p.y = y;
  12729. return p;
  12730. }
  12731. /* Inverse equations
  12732. -----------------*/
  12733. function inverse$22(p) {
  12734. p.x -= this.x0;
  12735. p.y = this.rh - p.y + this.y0;
  12736. var con, rh1, lat, lon;
  12737. if (this.ns >= 0) {
  12738. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  12739. con = 1;
  12740. }
  12741. else {
  12742. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  12743. con = -1;
  12744. }
  12745. var theta = 0;
  12746. if (rh1 !== 0) {
  12747. theta = Math.atan2(con * p.x, con * p.y);
  12748. }
  12749. if (this.sphere) {
  12750. lon = adjust_lon(this.long0 + theta / this.ns);
  12751. lat = adjust_lat(this.g - rh1 / this.a);
  12752. p.x = lon;
  12753. p.y = lat;
  12754. return p;
  12755. }
  12756. else {
  12757. var ml = this.g - rh1 / this.a;
  12758. lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
  12759. lon = adjust_lon(this.long0 + theta / this.ns);
  12760. p.x = lon;
  12761. p.y = lat;
  12762. return p;
  12763. }
  12764. }
  12765. var names$24 = ["Equidistant_Conic", "eqdc"];
  12766. var eqdc = {
  12767. init: init$23,
  12768. forward: forward$22,
  12769. inverse: inverse$22,
  12770. names: names$24
  12771. };
  12772. /* Initialize the Van Der Grinten projection
  12773. ----------------------------------------*/
  12774. function init$24() {
  12775. //this.R = 6370997; //Radius of earth
  12776. this.R = this.a;
  12777. }
  12778. function forward$23(p) {
  12779. var lon = p.x;
  12780. var lat = p.y;
  12781. /* Forward equations
  12782. -----------------*/
  12783. var dlon = adjust_lon(lon - this.long0);
  12784. var x, y;
  12785. if (Math.abs(lat) <= EPSLN) {
  12786. x = this.x0 + this.R * dlon;
  12787. y = this.y0;
  12788. }
  12789. var theta = asinz(2 * Math.abs(lat / Math.PI));
  12790. if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
  12791. x = this.x0;
  12792. if (lat >= 0) {
  12793. y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
  12794. }
  12795. else {
  12796. y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
  12797. }
  12798. // return(OK);
  12799. }
  12800. var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
  12801. var asq = al * al;
  12802. var sinth = Math.sin(theta);
  12803. var costh = Math.cos(theta);
  12804. var g = costh / (sinth + costh - 1);
  12805. var gsq = g * g;
  12806. var m = g * (2 / sinth - 1);
  12807. var msq = m * m;
  12808. var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
  12809. if (dlon < 0) {
  12810. con = -con;
  12811. }
  12812. x = this.x0 + con;
  12813. //con = Math.abs(con / (Math.PI * this.R));
  12814. var q = asq + g;
  12815. con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
  12816. if (lat >= 0) {
  12817. //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  12818. y = this.y0 + con;
  12819. }
  12820. else {
  12821. //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  12822. y = this.y0 - con;
  12823. }
  12824. p.x = x;
  12825. p.y = y;
  12826. return p;
  12827. }
  12828. /* Van Der Grinten inverse equations--mapping x,y to lat/long
  12829. ---------------------------------------------------------*/
  12830. function inverse$23(p) {
  12831. var lon, lat;
  12832. var xx, yy, xys, c1, c2, c3;
  12833. var a1;
  12834. var m1;
  12835. var con;
  12836. var th1;
  12837. var d;
  12838. /* inverse equations
  12839. -----------------*/
  12840. p.x -= this.x0;
  12841. p.y -= this.y0;
  12842. con = Math.PI * this.R;
  12843. xx = p.x / con;
  12844. yy = p.y / con;
  12845. xys = xx * xx + yy * yy;
  12846. c1 = -Math.abs(yy) * (1 + xys);
  12847. c2 = c1 - 2 * yy * yy + xx * xx;
  12848. c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
  12849. d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
  12850. a1 = (c1 - c2 * c2 / 3 / c3) / c3;
  12851. m1 = 2 * Math.sqrt(-a1 / 3);
  12852. con = ((3 * d) / a1) / m1;
  12853. if (Math.abs(con) > 1) {
  12854. if (con >= 0) {
  12855. con = 1;
  12856. }
  12857. else {
  12858. con = -1;
  12859. }
  12860. }
  12861. th1 = Math.acos(con) / 3;
  12862. if (p.y >= 0) {
  12863. lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  12864. }
  12865. else {
  12866. lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  12867. }
  12868. if (Math.abs(xx) < EPSLN) {
  12869. lon = this.long0;
  12870. }
  12871. else {
  12872. lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
  12873. }
  12874. p.x = lon;
  12875. p.y = lat;
  12876. return p;
  12877. }
  12878. var names$25 = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
  12879. var vandg = {
  12880. init: init$24,
  12881. forward: forward$23,
  12882. inverse: inverse$23,
  12883. names: names$25
  12884. };
  12885. function init$25() {
  12886. this.sin_p12 = Math.sin(this.lat0);
  12887. this.cos_p12 = Math.cos(this.lat0);
  12888. }
  12889. function forward$24(p) {
  12890. var lon = p.x;
  12891. var lat = p.y;
  12892. var sinphi = Math.sin(p.y);
  12893. var cosphi = Math.cos(p.y);
  12894. var dlon = adjust_lon(lon - this.long0);
  12895. var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
  12896. if (this.sphere) {
  12897. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  12898. //North Pole case
  12899. p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
  12900. p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
  12901. return p;
  12902. }
  12903. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  12904. //South Pole case
  12905. p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
  12906. p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
  12907. return p;
  12908. }
  12909. else {
  12910. //default case
  12911. cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
  12912. c = Math.acos(cos_c);
  12913. kp = c ? c / Math.sin(c) : 1;
  12914. p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
  12915. p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
  12916. return p;
  12917. }
  12918. }
  12919. else {
  12920. e0 = e0fn(this.es);
  12921. e1 = e1fn(this.es);
  12922. e2 = e2fn(this.es);
  12923. e3 = e3fn(this.es);
  12924. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  12925. //North Pole case
  12926. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  12927. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  12928. p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
  12929. p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
  12930. return p;
  12931. }
  12932. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  12933. //South Pole case
  12934. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  12935. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  12936. p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
  12937. p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
  12938. return p;
  12939. }
  12940. else {
  12941. //Default case
  12942. tanphi = sinphi / cosphi;
  12943. Nl1 = gN(this.a, this.e, this.sin_p12);
  12944. Nl = gN(this.a, this.e, sinphi);
  12945. psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
  12946. Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
  12947. if (Az === 0) {
  12948. s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  12949. }
  12950. else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
  12951. s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  12952. }
  12953. else {
  12954. s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
  12955. }
  12956. G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
  12957. H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
  12958. GH = G * H;
  12959. Hs = H * H;
  12960. s2 = s * s;
  12961. s3 = s2 * s;
  12962. s4 = s3 * s;
  12963. s5 = s4 * s;
  12964. c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
  12965. p.x = this.x0 + c * Math.sin(Az);
  12966. p.y = this.y0 + c * Math.cos(Az);
  12967. return p;
  12968. }
  12969. }
  12970. }
  12971. function inverse$24(p) {
  12972. p.x -= this.x0;
  12973. p.y -= this.y0;
  12974. var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
  12975. if (this.sphere) {
  12976. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  12977. if (rh > (2 * HALF_PI * this.a)) {
  12978. return;
  12979. }
  12980. z = rh / this.a;
  12981. sinz = Math.sin(z);
  12982. cosz = Math.cos(z);
  12983. lon = this.long0;
  12984. if (Math.abs(rh) <= EPSLN) {
  12985. lat = this.lat0;
  12986. }
  12987. else {
  12988. lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
  12989. con = Math.abs(this.lat0) - HALF_PI;
  12990. if (Math.abs(con) <= EPSLN) {
  12991. if (this.lat0 >= 0) {
  12992. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  12993. }
  12994. else {
  12995. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  12996. }
  12997. }
  12998. else {
  12999. /*con = cosz - this.sin_p12 * Math.sin(lat);
  13000. if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
  13001. //no-op, just keep the lon value as is
  13002. } else {
  13003. var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
  13004. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
  13005. }*/
  13006. lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
  13007. }
  13008. }
  13009. p.x = lon;
  13010. p.y = lat;
  13011. return p;
  13012. }
  13013. else {
  13014. e0 = e0fn(this.es);
  13015. e1 = e1fn(this.es);
  13016. e2 = e2fn(this.es);
  13017. e3 = e3fn(this.es);
  13018. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  13019. //North pole case
  13020. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  13021. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  13022. M = Mlp - rh;
  13023. lat = imlfn(M / this.a, e0, e1, e2, e3);
  13024. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  13025. p.x = lon;
  13026. p.y = lat;
  13027. return p;
  13028. }
  13029. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  13030. //South pole case
  13031. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  13032. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  13033. M = rh - Mlp;
  13034. lat = imlfn(M / this.a, e0, e1, e2, e3);
  13035. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  13036. p.x = lon;
  13037. p.y = lat;
  13038. return p;
  13039. }
  13040. else {
  13041. //default case
  13042. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  13043. Az = Math.atan2(p.x, p.y);
  13044. N1 = gN(this.a, this.e, this.sin_p12);
  13045. cosAz = Math.cos(Az);
  13046. tmp = this.e * this.cos_p12 * cosAz;
  13047. A = -tmp * tmp / (1 - this.es);
  13048. B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
  13049. D = rh / N1;
  13050. Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
  13051. F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
  13052. psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
  13053. lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
  13054. sinpsi = Math.sin(psi);
  13055. lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
  13056. p.x = lon;
  13057. p.y = lat;
  13058. return p;
  13059. }
  13060. }
  13061. }
  13062. var names$26 = ["Azimuthal_Equidistant", "aeqd"];
  13063. var aeqd = {
  13064. init: init$25,
  13065. forward: forward$24,
  13066. inverse: inverse$24,
  13067. names: names$26
  13068. };
  13069. function init$26() {
  13070. //double temp; /* temporary variable */
  13071. /* Place parameters in static storage for common use
  13072. -------------------------------------------------*/
  13073. this.sin_p14 = Math.sin(this.lat0);
  13074. this.cos_p14 = Math.cos(this.lat0);
  13075. }
  13076. /* Orthographic forward equations--mapping lat,long to x,y
  13077. ---------------------------------------------------*/
  13078. function forward$25(p) {
  13079. var sinphi, cosphi; /* sin and cos value */
  13080. var dlon; /* delta longitude value */
  13081. var coslon; /* cos of longitude */
  13082. var ksp; /* scale factor */
  13083. var g, x, y;
  13084. var lon = p.x;
  13085. var lat = p.y;
  13086. /* Forward equations
  13087. -----------------*/
  13088. dlon = adjust_lon(lon - this.long0);
  13089. sinphi = Math.sin(lat);
  13090. cosphi = Math.cos(lat);
  13091. coslon = Math.cos(dlon);
  13092. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  13093. ksp = 1;
  13094. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  13095. x = this.a * ksp * cosphi * Math.sin(dlon);
  13096. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  13097. }
  13098. p.x = x;
  13099. p.y = y;
  13100. return p;
  13101. }
  13102. function inverse$25(p) {
  13103. var rh; /* height above ellipsoid */
  13104. var z; /* angle */
  13105. var sinz, cosz; /* sin of z and cos of z */
  13106. var con;
  13107. var lon, lat;
  13108. /* Inverse equations
  13109. -----------------*/
  13110. p.x -= this.x0;
  13111. p.y -= this.y0;
  13112. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  13113. z = asinz(rh / this.a);
  13114. sinz = Math.sin(z);
  13115. cosz = Math.cos(z);
  13116. lon = this.long0;
  13117. if (Math.abs(rh) <= EPSLN) {
  13118. lat = this.lat0;
  13119. p.x = lon;
  13120. p.y = lat;
  13121. return p;
  13122. }
  13123. lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
  13124. con = Math.abs(this.lat0) - HALF_PI;
  13125. if (Math.abs(con) <= EPSLN) {
  13126. if (this.lat0 >= 0) {
  13127. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  13128. }
  13129. else {
  13130. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  13131. }
  13132. p.x = lon;
  13133. p.y = lat;
  13134. return p;
  13135. }
  13136. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
  13137. p.x = lon;
  13138. p.y = lat;
  13139. return p;
  13140. }
  13141. var names$27 = ["ortho"];
  13142. var ortho = {
  13143. init: init$26,
  13144. forward: forward$25,
  13145. inverse: inverse$25,
  13146. names: names$27
  13147. };
  13148. // QSC projection rewritten from the original PROJ4
  13149. // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
  13150. /* constants */
  13151. var FACE_ENUM = {
  13152. FRONT: 1,
  13153. RIGHT: 2,
  13154. BACK: 3,
  13155. LEFT: 4,
  13156. TOP: 5,
  13157. BOTTOM: 6
  13158. };
  13159. var AREA_ENUM = {
  13160. AREA_0: 1,
  13161. AREA_1: 2,
  13162. AREA_2: 3,
  13163. AREA_3: 4
  13164. };
  13165. function init$27() {
  13166. this.x0 = this.x0 || 0;
  13167. this.y0 = this.y0 || 0;
  13168. this.lat0 = this.lat0 || 0;
  13169. this.long0 = this.long0 || 0;
  13170. this.lat_ts = this.lat_ts || 0;
  13171. this.title = this.title || "Quadrilateralized Spherical Cube";
  13172. /* Determine the cube face from the center of projection. */
  13173. if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
  13174. this.face = FACE_ENUM.TOP;
  13175. } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
  13176. this.face = FACE_ENUM.BOTTOM;
  13177. } else if (Math.abs(this.long0) <= FORTPI) {
  13178. this.face = FACE_ENUM.FRONT;
  13179. } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
  13180. this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
  13181. } else {
  13182. this.face = FACE_ENUM.BACK;
  13183. }
  13184. /* Fill in useful values for the ellipsoid <-> sphere shift
  13185. * described in [LK12]. */
  13186. if (this.es !== 0) {
  13187. this.one_minus_f = 1 - (this.a - this.b) / this.a;
  13188. this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
  13189. }
  13190. }
  13191. // QSC forward equations--mapping lat,long to x,y
  13192. // -----------------------------------------------------------------
  13193. function forward$26(p) {
  13194. var xy = {x: 0, y: 0};
  13195. var lat, lon;
  13196. var theta, phi;
  13197. var t, mu;
  13198. /* nu; */
  13199. var area = {value: 0};
  13200. // move lon according to projection's lon
  13201. p.x -= this.long0;
  13202. /* Convert the geodetic latitude to a geocentric latitude.
  13203. * This corresponds to the shift from the ellipsoid to the sphere
  13204. * described in [LK12]. */
  13205. if (this.es !== 0) {//if (P->es != 0) {
  13206. lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
  13207. } else {
  13208. lat = p.y;
  13209. }
  13210. /* Convert the input lat, lon into theta, phi as used by QSC.
  13211. * This depends on the cube face and the area on it.
  13212. * For the top and bottom face, we can compute theta and phi
  13213. * directly from phi, lam. For the other faces, we must use
  13214. * unit sphere cartesian coordinates as an intermediate step. */
  13215. lon = p.x; //lon = lp.lam;
  13216. if (this.face === FACE_ENUM.TOP) {
  13217. phi = HALF_PI - lat;
  13218. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  13219. area.value = AREA_ENUM.AREA_0;
  13220. theta = lon - HALF_PI;
  13221. } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
  13222. area.value = AREA_ENUM.AREA_1;
  13223. theta = (lon > 0.0 ? lon - SPI : lon + SPI);
  13224. } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
  13225. area.value = AREA_ENUM.AREA_2;
  13226. theta = lon + HALF_PI;
  13227. } else {
  13228. area.value = AREA_ENUM.AREA_3;
  13229. theta = lon;
  13230. }
  13231. } else if (this.face === FACE_ENUM.BOTTOM) {
  13232. phi = HALF_PI + lat;
  13233. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  13234. area.value = AREA_ENUM.AREA_0;
  13235. theta = -lon + HALF_PI;
  13236. } else if (lon < FORTPI && lon >= -FORTPI) {
  13237. area.value = AREA_ENUM.AREA_1;
  13238. theta = -lon;
  13239. } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
  13240. area.value = AREA_ENUM.AREA_2;
  13241. theta = -lon - HALF_PI;
  13242. } else {
  13243. area.value = AREA_ENUM.AREA_3;
  13244. theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
  13245. }
  13246. } else {
  13247. var q, r, s;
  13248. var sinlat, coslat;
  13249. var sinlon, coslon;
  13250. if (this.face === FACE_ENUM.RIGHT) {
  13251. lon = qsc_shift_lon_origin(lon, +HALF_PI);
  13252. } else if (this.face === FACE_ENUM.BACK) {
  13253. lon = qsc_shift_lon_origin(lon, +SPI);
  13254. } else if (this.face === FACE_ENUM.LEFT) {
  13255. lon = qsc_shift_lon_origin(lon, -HALF_PI);
  13256. }
  13257. sinlat = Math.sin(lat);
  13258. coslat = Math.cos(lat);
  13259. sinlon = Math.sin(lon);
  13260. coslon = Math.cos(lon);
  13261. q = coslat * coslon;
  13262. r = coslat * sinlon;
  13263. s = sinlat;
  13264. if (this.face === FACE_ENUM.FRONT) {
  13265. phi = Math.acos(q);
  13266. theta = qsc_fwd_equat_face_theta(phi, s, r, area);
  13267. } else if (this.face === FACE_ENUM.RIGHT) {
  13268. phi = Math.acos(r);
  13269. theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
  13270. } else if (this.face === FACE_ENUM.BACK) {
  13271. phi = Math.acos(-q);
  13272. theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
  13273. } else if (this.face === FACE_ENUM.LEFT) {
  13274. phi = Math.acos(-r);
  13275. theta = qsc_fwd_equat_face_theta(phi, s, q, area);
  13276. } else {
  13277. /* Impossible */
  13278. phi = theta = 0;
  13279. area.value = AREA_ENUM.AREA_0;
  13280. }
  13281. }
  13282. /* Compute mu and nu for the area of definition.
  13283. * For mu, see Eq. (3-21) in [OL76], but note the typos:
  13284. * compare with Eq. (3-14). For nu, see Eq. (3-38). */
  13285. mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
  13286. t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
  13287. /* Apply the result to the real area. */
  13288. if (area.value === AREA_ENUM.AREA_1) {
  13289. mu += HALF_PI;
  13290. } else if (area.value === AREA_ENUM.AREA_2) {
  13291. mu += SPI;
  13292. } else if (area.value === AREA_ENUM.AREA_3) {
  13293. mu += 1.5 * SPI;
  13294. }
  13295. /* Now compute x, y from mu and nu */
  13296. xy.x = t * Math.cos(mu);
  13297. xy.y = t * Math.sin(mu);
  13298. xy.x = xy.x * this.a + this.x0;
  13299. xy.y = xy.y * this.a + this.y0;
  13300. p.x = xy.x;
  13301. p.y = xy.y;
  13302. return p;
  13303. }
  13304. // QSC inverse equations--mapping x,y to lat/long
  13305. // -----------------------------------------------------------------
  13306. function inverse$26(p) {
  13307. var lp = {lam: 0, phi: 0};
  13308. var mu, nu, cosmu, tannu;
  13309. var tantheta, theta, cosphi, phi;
  13310. var t;
  13311. var area = {value: 0};
  13312. /* de-offset */
  13313. p.x = (p.x - this.x0) / this.a;
  13314. p.y = (p.y - this.y0) / this.a;
  13315. /* Convert the input x, y to the mu and nu angles as used by QSC.
  13316. * This depends on the area of the cube face. */
  13317. nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
  13318. mu = Math.atan2(p.y, p.x);
  13319. if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
  13320. area.value = AREA_ENUM.AREA_0;
  13321. } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
  13322. area.value = AREA_ENUM.AREA_1;
  13323. mu -= HALF_PI;
  13324. } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
  13325. area.value = AREA_ENUM.AREA_2;
  13326. mu = (mu < 0.0 ? mu + SPI : mu - SPI);
  13327. } else {
  13328. area.value = AREA_ENUM.AREA_3;
  13329. mu += HALF_PI;
  13330. }
  13331. /* Compute phi and theta for the area of definition.
  13332. * The inverse projection is not described in the original paper, but some
  13333. * good hints can be found here (as of 2011-12-14):
  13334. * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
  13335. * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
  13336. t = (SPI / 12) * Math.tan(mu);
  13337. tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
  13338. theta = Math.atan(tantheta);
  13339. cosmu = Math.cos(mu);
  13340. tannu = Math.tan(nu);
  13341. cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
  13342. if (cosphi < -1) {
  13343. cosphi = -1;
  13344. } else if (cosphi > +1) {
  13345. cosphi = +1;
  13346. }
  13347. /* Apply the result to the real area on the cube face.
  13348. * For the top and bottom face, we can compute phi and lam directly.
  13349. * For the other faces, we must use unit sphere cartesian coordinates
  13350. * as an intermediate step. */
  13351. if (this.face === FACE_ENUM.TOP) {
  13352. phi = Math.acos(cosphi);
  13353. lp.phi = HALF_PI - phi;
  13354. if (area.value === AREA_ENUM.AREA_0) {
  13355. lp.lam = theta + HALF_PI;
  13356. } else if (area.value === AREA_ENUM.AREA_1) {
  13357. lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
  13358. } else if (area.value === AREA_ENUM.AREA_2) {
  13359. lp.lam = theta - HALF_PI;
  13360. } else /* area.value == AREA_ENUM.AREA_3 */ {
  13361. lp.lam = theta;
  13362. }
  13363. } else if (this.face === FACE_ENUM.BOTTOM) {
  13364. phi = Math.acos(cosphi);
  13365. lp.phi = phi - HALF_PI;
  13366. if (area.value === AREA_ENUM.AREA_0) {
  13367. lp.lam = -theta + HALF_PI;
  13368. } else if (area.value === AREA_ENUM.AREA_1) {
  13369. lp.lam = -theta;
  13370. } else if (area.value === AREA_ENUM.AREA_2) {
  13371. lp.lam = -theta - HALF_PI;
  13372. } else /* area.value == AREA_ENUM.AREA_3 */ {
  13373. lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
  13374. }
  13375. } else {
  13376. /* Compute phi and lam via cartesian unit sphere coordinates. */
  13377. var q, r, s;
  13378. q = cosphi;
  13379. t = q * q;
  13380. if (t >= 1) {
  13381. s = 0;
  13382. } else {
  13383. s = Math.sqrt(1 - t) * Math.sin(theta);
  13384. }
  13385. t += s * s;
  13386. if (t >= 1) {
  13387. r = 0;
  13388. } else {
  13389. r = Math.sqrt(1 - t);
  13390. }
  13391. /* Rotate q,r,s into the correct area. */
  13392. if (area.value === AREA_ENUM.AREA_1) {
  13393. t = r;
  13394. r = -s;
  13395. s = t;
  13396. } else if (area.value === AREA_ENUM.AREA_2) {
  13397. r = -r;
  13398. s = -s;
  13399. } else if (area.value === AREA_ENUM.AREA_3) {
  13400. t = r;
  13401. r = s;
  13402. s = -t;
  13403. }
  13404. /* Rotate q,r,s into the correct cube face. */
  13405. if (this.face === FACE_ENUM.RIGHT) {
  13406. t = q;
  13407. q = -r;
  13408. r = t;
  13409. } else if (this.face === FACE_ENUM.BACK) {
  13410. q = -q;
  13411. r = -r;
  13412. } else if (this.face === FACE_ENUM.LEFT) {
  13413. t = q;
  13414. q = r;
  13415. r = -t;
  13416. }
  13417. /* Now compute phi and lam from the unit sphere coordinates. */
  13418. lp.phi = Math.acos(-s) - HALF_PI;
  13419. lp.lam = Math.atan2(r, q);
  13420. if (this.face === FACE_ENUM.RIGHT) {
  13421. lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
  13422. } else if (this.face === FACE_ENUM.BACK) {
  13423. lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
  13424. } else if (this.face === FACE_ENUM.LEFT) {
  13425. lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
  13426. }
  13427. }
  13428. /* Apply the shift from the sphere to the ellipsoid as described
  13429. * in [LK12]. */
  13430. if (this.es !== 0) {
  13431. var invert_sign;
  13432. var tanphi, xa;
  13433. invert_sign = (lp.phi < 0 ? 1 : 0);
  13434. tanphi = Math.tan(lp.phi);
  13435. xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
  13436. lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
  13437. if (invert_sign) {
  13438. lp.phi = -lp.phi;
  13439. }
  13440. }
  13441. lp.lam += this.long0;
  13442. p.x = lp.lam;
  13443. p.y = lp.phi;
  13444. return p;
  13445. }
  13446. /* Helper function for forward projection: compute the theta angle
  13447. * and determine the area number. */
  13448. function qsc_fwd_equat_face_theta(phi, y, x, area) {
  13449. var theta;
  13450. if (phi < EPSLN) {
  13451. area.value = AREA_ENUM.AREA_0;
  13452. theta = 0.0;
  13453. } else {
  13454. theta = Math.atan2(y, x);
  13455. if (Math.abs(theta) <= FORTPI) {
  13456. area.value = AREA_ENUM.AREA_0;
  13457. } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
  13458. area.value = AREA_ENUM.AREA_1;
  13459. theta -= HALF_PI;
  13460. } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
  13461. area.value = AREA_ENUM.AREA_2;
  13462. theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
  13463. } else {
  13464. area.value = AREA_ENUM.AREA_3;
  13465. theta += HALF_PI;
  13466. }
  13467. }
  13468. return theta;
  13469. }
  13470. /* Helper function: shift the longitude. */
  13471. function qsc_shift_lon_origin(lon, offset) {
  13472. var slon = lon + offset;
  13473. if (slon < -SPI) {
  13474. slon += TWO_PI;
  13475. } else if (slon > +SPI) {
  13476. slon -= TWO_PI;
  13477. }
  13478. return slon;
  13479. }
  13480. var names$28 = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
  13481. var qsc = {
  13482. init: init$27,
  13483. forward: forward$26,
  13484. inverse: inverse$26,
  13485. names: names$28
  13486. };
  13487. // Robinson projection
  13488. // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
  13489. // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
  13490. var COEFS_X = [
  13491. [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
  13492. [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
  13493. [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
  13494. [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
  13495. [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
  13496. [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
  13497. [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
  13498. [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
  13499. [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
  13500. [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
  13501. [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
  13502. [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
  13503. [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
  13504. [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
  13505. [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
  13506. [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
  13507. [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
  13508. [0.5722, -0.00906601, 0.000182, 6.24051e-06],
  13509. [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
  13510. ];
  13511. var COEFS_Y = [
  13512. [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
  13513. [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
  13514. [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
  13515. [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
  13516. [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
  13517. [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
  13518. [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
  13519. [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
  13520. [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
  13521. [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
  13522. [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
  13523. [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
  13524. [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
  13525. [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
  13526. [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
  13527. [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
  13528. [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
  13529. [0.9761, 0.00616527, -0.000256, -4.2106e-06],
  13530. [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
  13531. ];
  13532. var FXC = 0.8487;
  13533. var FYC = 1.3523;
  13534. var C1 = R2D/5; // rad to 5-degree interval
  13535. var RC1 = 1/C1;
  13536. var NODES = 18;
  13537. var poly3_val = function(coefs, x) {
  13538. return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
  13539. };
  13540. var poly3_der = function(coefs, x) {
  13541. return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
  13542. };
  13543. function newton_rapshon(f_df, start, max_err, iters) {
  13544. var x = start;
  13545. for (; iters; --iters) {
  13546. var upd = f_df(x);
  13547. x -= upd;
  13548. if (Math.abs(upd) < max_err) {
  13549. break;
  13550. }
  13551. }
  13552. return x;
  13553. }
  13554. function init$28() {
  13555. this.x0 = this.x0 || 0;
  13556. this.y0 = this.y0 || 0;
  13557. this.long0 = this.long0 || 0;
  13558. this.es = 0;
  13559. this.title = this.title || "Robinson";
  13560. }
  13561. function forward$27(ll) {
  13562. var lon = adjust_lon(ll.x - this.long0);
  13563. var dphi = Math.abs(ll.y);
  13564. var i = Math.floor(dphi * C1);
  13565. if (i < 0) {
  13566. i = 0;
  13567. } else if (i >= NODES) {
  13568. i = NODES - 1;
  13569. }
  13570. dphi = R2D * (dphi - RC1 * i);
  13571. var xy = {
  13572. x: poly3_val(COEFS_X[i], dphi) * lon,
  13573. y: poly3_val(COEFS_Y[i], dphi)
  13574. };
  13575. if (ll.y < 0) {
  13576. xy.y = -xy.y;
  13577. }
  13578. xy.x = xy.x * this.a * FXC + this.x0;
  13579. xy.y = xy.y * this.a * FYC + this.y0;
  13580. return xy;
  13581. }
  13582. function inverse$27(xy) {
  13583. var ll = {
  13584. x: (xy.x - this.x0) / (this.a * FXC),
  13585. y: Math.abs(xy.y - this.y0) / (this.a * FYC)
  13586. };
  13587. if (ll.y >= 1) { // pathologic case
  13588. ll.x /= COEFS_X[NODES][0];
  13589. ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
  13590. } else {
  13591. // find table interval
  13592. var i = Math.floor(ll.y * NODES);
  13593. if (i < 0) {
  13594. i = 0;
  13595. } else if (i >= NODES) {
  13596. i = NODES - 1;
  13597. }
  13598. for (;;) {
  13599. if (COEFS_Y[i][0] > ll.y) {
  13600. --i;
  13601. } else if (COEFS_Y[i+1][0] <= ll.y) {
  13602. ++i;
  13603. } else {
  13604. break;
  13605. }
  13606. }
  13607. // linear interpolation in 5 degree interval
  13608. var coefs = COEFS_Y[i];
  13609. var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
  13610. // find t so that poly3_val(coefs, t) = ll.y
  13611. t = newton_rapshon(function(x) {
  13612. return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
  13613. }, t, EPSLN, 100);
  13614. ll.x /= poly3_val(COEFS_X[i], t);
  13615. ll.y = (5 * i + t) * D2R;
  13616. if (xy.y < 0) {
  13617. ll.y = -ll.y;
  13618. }
  13619. }
  13620. ll.x = adjust_lon(ll.x + this.long0);
  13621. return ll;
  13622. }
  13623. var names$29 = ["Robinson", "robin"];
  13624. var robin = {
  13625. init: init$28,
  13626. forward: forward$27,
  13627. inverse: inverse$27,
  13628. names: names$29
  13629. };
  13630. function init$29() {
  13631. this.name = 'geocent';
  13632. }
  13633. function forward$28(p) {
  13634. var point = geodeticToGeocentric(p, this.es, this.a);
  13635. return point;
  13636. }
  13637. function inverse$28(p) {
  13638. var point = geocentricToGeodetic(p, this.es, this.a, this.b);
  13639. return point;
  13640. }
  13641. var names$30 = ["Geocentric", 'geocentric', "geocent", "Geocent"];
  13642. var geocent = {
  13643. init: init$29,
  13644. forward: forward$28,
  13645. inverse: inverse$28,
  13646. names: names$30
  13647. };
  13648. var mode = {
  13649. N_POLE: 0,
  13650. S_POLE: 1,
  13651. EQUIT: 2,
  13652. OBLIQ: 3
  13653. };
  13654. var params = {
  13655. h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7
  13656. azi: { def: 0, num: true, degrees: true }, // default is North
  13657. tilt: { def: 0, num: true, degrees: true }, // default is Nadir
  13658. long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic
  13659. lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic
  13660. };
  13661. function init$30() {
  13662. Object.keys(params).forEach(function (p) {
  13663. if (typeof this[p] === "undefined") {
  13664. this[p] = params[p].def;
  13665. } else if (params[p].num && isNaN(this[p])) {
  13666. throw new Error("Invalid parameter value, must be numeric " + p + " = " + this[p]);
  13667. } else if (params[p].num) {
  13668. this[p] = parseFloat(this[p]);
  13669. }
  13670. if (params[p].degrees) {
  13671. this[p] = this[p] * D2R;
  13672. }
  13673. }.bind(this));
  13674. if (Math.abs((Math.abs(this.lat0) - HALF_PI)) < EPSLN) {
  13675. this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;
  13676. } else if (Math.abs(this.lat0) < EPSLN) {
  13677. this.mode = mode.EQUIT;
  13678. } else {
  13679. this.mode = mode.OBLIQ;
  13680. this.sinph0 = Math.sin(this.lat0);
  13681. this.cosph0 = Math.cos(this.lat0);
  13682. }
  13683. this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius
  13684. if (this.pn1 <= 0 || this.pn1 > 1e10) {
  13685. throw new Error("Invalid height");
  13686. }
  13687. this.p = 1 + this.pn1;
  13688. this.rp = 1 / this.p;
  13689. this.h1 = 1 / this.pn1;
  13690. this.pfact = (this.p + 1) * this.h1;
  13691. this.es = 0;
  13692. var omega = this.tilt;
  13693. var gamma = this.azi;
  13694. this.cg = Math.cos(gamma);
  13695. this.sg = Math.sin(gamma);
  13696. this.cw = Math.cos(omega);
  13697. this.sw = Math.sin(omega);
  13698. }
  13699. function forward$29(p) {
  13700. p.x -= this.long0;
  13701. var sinphi = Math.sin(p.y);
  13702. var cosphi = Math.cos(p.y);
  13703. var coslam = Math.cos(p.x);
  13704. var x, y;
  13705. switch (this.mode) {
  13706. case mode.OBLIQ:
  13707. y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  13708. break;
  13709. case mode.EQUIT:
  13710. y = cosphi * coslam;
  13711. break;
  13712. case mode.S_POLE:
  13713. y = -sinphi;
  13714. break;
  13715. case mode.N_POLE:
  13716. y = sinphi;
  13717. break;
  13718. }
  13719. y = this.pn1 / (this.p - y);
  13720. x = y * cosphi * Math.sin(p.x);
  13721. switch (this.mode) {
  13722. case mode.OBLIQ:
  13723. y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  13724. break;
  13725. case mode.EQUIT:
  13726. y *= sinphi;
  13727. break;
  13728. case mode.N_POLE:
  13729. y *= -(cosphi * coslam);
  13730. break;
  13731. case mode.S_POLE:
  13732. y *= cosphi * coslam;
  13733. break;
  13734. }
  13735. // Tilt
  13736. var yt, ba;
  13737. yt = y * this.cg + x * this.sg;
  13738. ba = 1 / (yt * this.sw * this.h1 + this.cw);
  13739. x = (x * this.cg - y * this.sg) * this.cw * ba;
  13740. y = yt * ba;
  13741. p.x = x * this.a;
  13742. p.y = y * this.a;
  13743. return p;
  13744. }
  13745. function inverse$29(p) {
  13746. p.x /= this.a;
  13747. p.y /= this.a;
  13748. var r = { x: p.x, y: p.y };
  13749. // Un-Tilt
  13750. var bm, bq, yt;
  13751. yt = 1 / (this.pn1 - p.y * this.sw);
  13752. bm = this.pn1 * p.x * yt;
  13753. bq = this.pn1 * p.y * this.cw * yt;
  13754. p.x = bm * this.cg + bq * this.sg;
  13755. p.y = bq * this.cg - bm * this.sg;
  13756. var rh = hypot(p.x, p.y);
  13757. if (Math.abs(rh) < EPSLN) {
  13758. r.x = 0;
  13759. r.y = p.y;
  13760. } else {
  13761. var cosz, sinz;
  13762. sinz = 1 - rh * rh * this.pfact;
  13763. sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);
  13764. cosz = Math.sqrt(1 - sinz * sinz);
  13765. switch (this.mode) {
  13766. case mode.OBLIQ:
  13767. r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);
  13768. p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;
  13769. p.x *= sinz * this.cosph0;
  13770. break;
  13771. case mode.EQUIT:
  13772. r.y = Math.asin(p.y * sinz / rh);
  13773. p.y = cosz * rh;
  13774. p.x *= sinz;
  13775. break;
  13776. case mode.N_POLE:
  13777. r.y = Math.asin(cosz);
  13778. p.y = -p.y;
  13779. break;
  13780. case mode.S_POLE:
  13781. r.y = -Math.asin(cosz);
  13782. break;
  13783. }
  13784. r.x = Math.atan2(p.x, p.y);
  13785. }
  13786. p.x = r.x + this.long0;
  13787. p.y = r.y;
  13788. return p;
  13789. }
  13790. var names$31 = ["Tilted_Perspective", "tpers"];
  13791. var tpers = {
  13792. init: init$30,
  13793. forward: forward$29,
  13794. inverse: inverse$29,
  13795. names: names$31
  13796. };
  13797. function init$31() {
  13798. this.flip_axis = (this.sweep === 'x' ? 1 : 0);
  13799. this.h = Number(this.h);
  13800. this.radius_g_1 = this.h / this.a;
  13801. if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {
  13802. throw new Error();
  13803. }
  13804. this.radius_g = 1.0 + this.radius_g_1;
  13805. this.C = this.radius_g * this.radius_g - 1.0;
  13806. if (this.es !== 0.0) {
  13807. var one_es = 1.0 - this.es;
  13808. var rone_es = 1 / one_es;
  13809. this.radius_p = Math.sqrt(one_es);
  13810. this.radius_p2 = one_es;
  13811. this.radius_p_inv2 = rone_es;
  13812. this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.
  13813. } else {
  13814. this.radius_p = 1.0;
  13815. this.radius_p2 = 1.0;
  13816. this.radius_p_inv2 = 1.0;
  13817. this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.
  13818. }
  13819. if (!this.title) {
  13820. this.title = "Geostationary Satellite View";
  13821. }
  13822. }
  13823. function forward$30(p) {
  13824. var lon = p.x;
  13825. var lat = p.y;
  13826. var tmp, v_x, v_y, v_z;
  13827. lon = lon - this.long0;
  13828. if (this.shape === 'ellipse') {
  13829. lat = Math.atan(this.radius_p2 * Math.tan(lat));
  13830. var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));
  13831. v_x = r * Math.cos(lon) * Math.cos(lat);
  13832. v_y = r * Math.sin(lon) * Math.cos(lat);
  13833. v_z = r * Math.sin(lat);
  13834. if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {
  13835. p.x = Number.NaN;
  13836. p.y = Number.NaN;
  13837. return p;
  13838. }
  13839. tmp = this.radius_g - v_x;
  13840. if (this.flip_axis) {
  13841. p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
  13842. p.y = this.radius_g_1 * Math.atan(v_z / tmp);
  13843. } else {
  13844. p.x = this.radius_g_1 * Math.atan(v_y / tmp);
  13845. p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
  13846. }
  13847. } else if (this.shape === 'sphere') {
  13848. tmp = Math.cos(lat);
  13849. v_x = Math.cos(lon) * tmp;
  13850. v_y = Math.sin(lon) * tmp;
  13851. v_z = Math.sin(lat);
  13852. tmp = this.radius_g - v_x;
  13853. if (this.flip_axis) {
  13854. p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
  13855. p.y = this.radius_g_1 * Math.atan(v_z / tmp);
  13856. } else {
  13857. p.x = this.radius_g_1 * Math.atan(v_y / tmp);
  13858. p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
  13859. }
  13860. }
  13861. p.x = p.x * this.a;
  13862. p.y = p.y * this.a;
  13863. return p;
  13864. }
  13865. function inverse$30(p) {
  13866. var v_x = -1.0;
  13867. var v_y = 0.0;
  13868. var v_z = 0.0;
  13869. var a, b, det, k;
  13870. p.x = p.x / this.a;
  13871. p.y = p.y / this.a;
  13872. if (this.shape === 'ellipse') {
  13873. if (this.flip_axis) {
  13874. v_z = Math.tan(p.y / this.radius_g_1);
  13875. v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);
  13876. } else {
  13877. v_y = Math.tan(p.x / this.radius_g_1);
  13878. v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);
  13879. }
  13880. var v_zp = v_z / this.radius_p;
  13881. a = v_y * v_y + v_zp * v_zp + v_x * v_x;
  13882. b = 2 * this.radius_g * v_x;
  13883. det = (b * b) - 4 * a * this.C;
  13884. if (det < 0.0) {
  13885. p.x = Number.NaN;
  13886. p.y = Number.NaN;
  13887. return p;
  13888. }
  13889. k = (-b - Math.sqrt(det)) / (2.0 * a);
  13890. v_x = this.radius_g + k * v_x;
  13891. v_y *= k;
  13892. v_z *= k;
  13893. p.x = Math.atan2(v_y, v_x);
  13894. p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
  13895. p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
  13896. } else if (this.shape === 'sphere') {
  13897. if (this.flip_axis) {
  13898. v_z = Math.tan(p.y / this.radius_g_1);
  13899. v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);
  13900. } else {
  13901. v_y = Math.tan(p.x / this.radius_g_1);
  13902. v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);
  13903. }
  13904. a = v_y * v_y + v_z * v_z + v_x * v_x;
  13905. b = 2 * this.radius_g * v_x;
  13906. det = (b * b) - 4 * a * this.C;
  13907. if (det < 0.0) {
  13908. p.x = Number.NaN;
  13909. p.y = Number.NaN;
  13910. return p;
  13911. }
  13912. k = (-b - Math.sqrt(det)) / (2.0 * a);
  13913. v_x = this.radius_g + k * v_x;
  13914. v_y *= k;
  13915. v_z *= k;
  13916. p.x = Math.atan2(v_y, v_x);
  13917. p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
  13918. }
  13919. p.x = p.x + this.long0;
  13920. return p;
  13921. }
  13922. var names$32 = ["Geostationary Satellite View", "Geostationary_Satellite", "geos"];
  13923. var geos = {
  13924. init: init$31,
  13925. forward: forward$30,
  13926. inverse: inverse$30,
  13927. names: names$32,
  13928. };
  13929. var includedProjections = function(proj4){
  13930. proj4.Proj.projections.add(tmerc);
  13931. proj4.Proj.projections.add(etmerc);
  13932. proj4.Proj.projections.add(utm);
  13933. proj4.Proj.projections.add(sterea);
  13934. proj4.Proj.projections.add(stere);
  13935. proj4.Proj.projections.add(somerc);
  13936. proj4.Proj.projections.add(omerc);
  13937. proj4.Proj.projections.add(lcc);
  13938. proj4.Proj.projections.add(krovak);
  13939. proj4.Proj.projections.add(cass);
  13940. proj4.Proj.projections.add(laea);
  13941. proj4.Proj.projections.add(aea);
  13942. proj4.Proj.projections.add(gnom);
  13943. proj4.Proj.projections.add(cea);
  13944. proj4.Proj.projections.add(eqc);
  13945. proj4.Proj.projections.add(poly);
  13946. proj4.Proj.projections.add(nzmg);
  13947. proj4.Proj.projections.add(mill);
  13948. proj4.Proj.projections.add(sinu);
  13949. proj4.Proj.projections.add(moll);
  13950. proj4.Proj.projections.add(eqdc);
  13951. proj4.Proj.projections.add(vandg);
  13952. proj4.Proj.projections.add(aeqd);
  13953. proj4.Proj.projections.add(ortho);
  13954. proj4.Proj.projections.add(qsc);
  13955. proj4.Proj.projections.add(robin);
  13956. proj4.Proj.projections.add(geocent);
  13957. proj4.Proj.projections.add(tpers);
  13958. proj4.Proj.projections.add(geos);
  13959. };
  13960. proj4$1.defaultDatum = 'WGS84'; //default datum
  13961. proj4$1.Proj = Projection;
  13962. proj4$1.WGS84 = new proj4$1.Proj('WGS84');
  13963. proj4$1.Point = Point;
  13964. proj4$1.toPoint = toPoint;
  13965. proj4$1.defs = defs;
  13966. proj4$1.nadgrid = nadgrid;
  13967. proj4$1.transform = transform;
  13968. proj4$1.mgrs = mgrs;
  13969. proj4$1.version = '2.9.0';
  13970. includedProjections(proj4$1);
  13971. return proj4$1;
  13972. })));
  13973. /***/ }),
  13974. /***/ 107:
  13975. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  13976. (function (global, factory) {
  13977. true ? factory() :
  13978. 0;
  13979. }(this, (function () { 'use strict';
  13980. /**
  13981. * @this {Promise}
  13982. */
  13983. function finallyConstructor(callback) {
  13984. var constructor = this.constructor;
  13985. return this.then(
  13986. function(value) {
  13987. // @ts-ignore
  13988. return constructor.resolve(callback()).then(function() {
  13989. return value;
  13990. });
  13991. },
  13992. function(reason) {
  13993. // @ts-ignore
  13994. return constructor.resolve(callback()).then(function() {
  13995. // @ts-ignore
  13996. return constructor.reject(reason);
  13997. });
  13998. }
  13999. );
  14000. }
  14001. function allSettled(arr) {
  14002. var P = this;
  14003. return new P(function(resolve, reject) {
  14004. if (!(arr && typeof arr.length !== 'undefined')) {
  14005. return reject(
  14006. new TypeError(
  14007. typeof arr +
  14008. ' ' +
  14009. arr +
  14010. ' is not iterable(cannot read property Symbol(Symbol.iterator))'
  14011. )
  14012. );
  14013. }
  14014. var args = Array.prototype.slice.call(arr);
  14015. if (args.length === 0) return resolve([]);
  14016. var remaining = args.length;
  14017. function res(i, val) {
  14018. if (val && (typeof val === 'object' || typeof val === 'function')) {
  14019. var then = val.then;
  14020. if (typeof then === 'function') {
  14021. then.call(
  14022. val,
  14023. function(val) {
  14024. res(i, val);
  14025. },
  14026. function(e) {
  14027. args[i] = { status: 'rejected', reason: e };
  14028. if (--remaining === 0) {
  14029. resolve(args);
  14030. }
  14031. }
  14032. );
  14033. return;
  14034. }
  14035. }
  14036. args[i] = { status: 'fulfilled', value: val };
  14037. if (--remaining === 0) {
  14038. resolve(args);
  14039. }
  14040. }
  14041. for (var i = 0; i < args.length; i++) {
  14042. res(i, args[i]);
  14043. }
  14044. });
  14045. }
  14046. // Store setTimeout reference so promise-polyfill will be unaffected by
  14047. // other code modifying setTimeout (like sinon.useFakeTimers())
  14048. var setTimeoutFunc = setTimeout;
  14049. function isArray(x) {
  14050. return Boolean(x && typeof x.length !== 'undefined');
  14051. }
  14052. function noop() {}
  14053. // Polyfill for Function.prototype.bind
  14054. function bind(fn, thisArg) {
  14055. return function() {
  14056. fn.apply(thisArg, arguments);
  14057. };
  14058. }
  14059. /**
  14060. * @constructor
  14061. * @param {Function} fn
  14062. */
  14063. function Promise(fn) {
  14064. if (!(this instanceof Promise))
  14065. throw new TypeError('Promises must be constructed via new');
  14066. if (typeof fn !== 'function') throw new TypeError('not a function');
  14067. /** @type {!number} */
  14068. this._state = 0;
  14069. /** @type {!boolean} */
  14070. this._handled = false;
  14071. /** @type {Promise|undefined} */
  14072. this._value = undefined;
  14073. /** @type {!Array<!Function>} */
  14074. this._deferreds = [];
  14075. doResolve(fn, this);
  14076. }
  14077. function handle(self, deferred) {
  14078. while (self._state === 3) {
  14079. self = self._value;
  14080. }
  14081. if (self._state === 0) {
  14082. self._deferreds.push(deferred);
  14083. return;
  14084. }
  14085. self._handled = true;
  14086. Promise._immediateFn(function() {
  14087. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  14088. if (cb === null) {
  14089. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  14090. return;
  14091. }
  14092. var ret;
  14093. try {
  14094. ret = cb(self._value);
  14095. } catch (e) {
  14096. reject(deferred.promise, e);
  14097. return;
  14098. }
  14099. resolve(deferred.promise, ret);
  14100. });
  14101. }
  14102. function resolve(self, newValue) {
  14103. try {
  14104. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  14105. if (newValue === self)
  14106. throw new TypeError('A promise cannot be resolved with itself.');
  14107. if (
  14108. newValue &&
  14109. (typeof newValue === 'object' || typeof newValue === 'function')
  14110. ) {
  14111. var then = newValue.then;
  14112. if (newValue instanceof Promise) {
  14113. self._state = 3;
  14114. self._value = newValue;
  14115. finale(self);
  14116. return;
  14117. } else if (typeof then === 'function') {
  14118. doResolve(bind(then, newValue), self);
  14119. return;
  14120. }
  14121. }
  14122. self._state = 1;
  14123. self._value = newValue;
  14124. finale(self);
  14125. } catch (e) {
  14126. reject(self, e);
  14127. }
  14128. }
  14129. function reject(self, newValue) {
  14130. self._state = 2;
  14131. self._value = newValue;
  14132. finale(self);
  14133. }
  14134. function finale(self) {
  14135. if (self._state === 2 && self._deferreds.length === 0) {
  14136. Promise._immediateFn(function() {
  14137. if (!self._handled) {
  14138. Promise._unhandledRejectionFn(self._value);
  14139. }
  14140. });
  14141. }
  14142. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  14143. handle(self, self._deferreds[i]);
  14144. }
  14145. self._deferreds = null;
  14146. }
  14147. /**
  14148. * @constructor
  14149. */
  14150. function Handler(onFulfilled, onRejected, promise) {
  14151. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  14152. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  14153. this.promise = promise;
  14154. }
  14155. /**
  14156. * Take a potentially misbehaving resolver function and make sure
  14157. * onFulfilled and onRejected are only called once.
  14158. *
  14159. * Makes no guarantees about asynchrony.
  14160. */
  14161. function doResolve(fn, self) {
  14162. var done = false;
  14163. try {
  14164. fn(
  14165. function(value) {
  14166. if (done) return;
  14167. done = true;
  14168. resolve(self, value);
  14169. },
  14170. function(reason) {
  14171. if (done) return;
  14172. done = true;
  14173. reject(self, reason);
  14174. }
  14175. );
  14176. } catch (ex) {
  14177. if (done) return;
  14178. done = true;
  14179. reject(self, ex);
  14180. }
  14181. }
  14182. Promise.prototype['catch'] = function(onRejected) {
  14183. return this.then(null, onRejected);
  14184. };
  14185. Promise.prototype.then = function(onFulfilled, onRejected) {
  14186. // @ts-ignore
  14187. var prom = new this.constructor(noop);
  14188. handle(this, new Handler(onFulfilled, onRejected, prom));
  14189. return prom;
  14190. };
  14191. Promise.prototype['finally'] = finallyConstructor;
  14192. Promise.all = function(arr) {
  14193. return new Promise(function(resolve, reject) {
  14194. if (!isArray(arr)) {
  14195. return reject(new TypeError('Promise.all accepts an array'));
  14196. }
  14197. var args = Array.prototype.slice.call(arr);
  14198. if (args.length === 0) return resolve([]);
  14199. var remaining = args.length;
  14200. function res(i, val) {
  14201. try {
  14202. if (val && (typeof val === 'object' || typeof val === 'function')) {
  14203. var then = val.then;
  14204. if (typeof then === 'function') {
  14205. then.call(
  14206. val,
  14207. function(val) {
  14208. res(i, val);
  14209. },
  14210. reject
  14211. );
  14212. return;
  14213. }
  14214. }
  14215. args[i] = val;
  14216. if (--remaining === 0) {
  14217. resolve(args);
  14218. }
  14219. } catch (ex) {
  14220. reject(ex);
  14221. }
  14222. }
  14223. for (var i = 0; i < args.length; i++) {
  14224. res(i, args[i]);
  14225. }
  14226. });
  14227. };
  14228. Promise.allSettled = allSettled;
  14229. Promise.resolve = function(value) {
  14230. if (value && typeof value === 'object' && value.constructor === Promise) {
  14231. return value;
  14232. }
  14233. return new Promise(function(resolve) {
  14234. resolve(value);
  14235. });
  14236. };
  14237. Promise.reject = function(value) {
  14238. return new Promise(function(resolve, reject) {
  14239. reject(value);
  14240. });
  14241. };
  14242. Promise.race = function(arr) {
  14243. return new Promise(function(resolve, reject) {
  14244. if (!isArray(arr)) {
  14245. return reject(new TypeError('Promise.race accepts an array'));
  14246. }
  14247. for (var i = 0, len = arr.length; i < len; i++) {
  14248. Promise.resolve(arr[i]).then(resolve, reject);
  14249. }
  14250. });
  14251. };
  14252. // Use polyfill for setImmediate for performance gains
  14253. Promise._immediateFn =
  14254. // @ts-ignore
  14255. (typeof setImmediate === 'function' &&
  14256. function(fn) {
  14257. // @ts-ignore
  14258. setImmediate(fn);
  14259. }) ||
  14260. function(fn) {
  14261. setTimeoutFunc(fn, 0);
  14262. };
  14263. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  14264. if (typeof console !== 'undefined' && console) {
  14265. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  14266. }
  14267. };
  14268. /** @suppress {undefinedVars} */
  14269. var globalNS = (function() {
  14270. // the only reliable means to get the global object is
  14271. // `Function('return this')()`
  14272. // However, this causes CSP violations in Chrome apps.
  14273. if (typeof self !== 'undefined') {
  14274. return self;
  14275. }
  14276. if (typeof window !== 'undefined') {
  14277. return window;
  14278. }
  14279. if (typeof __webpack_require__.g !== 'undefined') {
  14280. return __webpack_require__.g;
  14281. }
  14282. throw new Error('unable to locate global object');
  14283. })();
  14284. // Expose the polyfill if Promise is undefined or set to a
  14285. // non-function value. The latter can be due to a named HTMLElement
  14286. // being exposed by browsers for legacy reasons.
  14287. // https://github.com/taylorhakes/promise-polyfill/issues/114
  14288. if (typeof globalNS['Promise'] !== 'function') {
  14289. globalNS['Promise'] = Promise;
  14290. } else {
  14291. if (!globalNS.Promise.prototype['finally']) {
  14292. globalNS.Promise.prototype['finally'] = finallyConstructor;
  14293. }
  14294. if (!globalNS.Promise.allSettled) {
  14295. globalNS.Promise.allSettled = allSettled;
  14296. }
  14297. }
  14298. })));
  14299. /***/ }),
  14300. /***/ 166:
  14301. /***/ (function(module) {
  14302. (function (global, factory) {
  14303. true ? module.exports = factory() :
  14304. 0;
  14305. }(this, (function () { 'use strict';
  14306. function quickselect(arr, k, left, right, compare) {
  14307. quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
  14308. }
  14309. function quickselectStep(arr, k, left, right, compare) {
  14310. while (right > left) {
  14311. if (right - left > 600) {
  14312. var n = right - left + 1;
  14313. var m = k - left + 1;
  14314. var z = Math.log(n);
  14315. var s = 0.5 * Math.exp(2 * z / 3);
  14316. var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
  14317. var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
  14318. var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
  14319. quickselectStep(arr, k, newLeft, newRight, compare);
  14320. }
  14321. var t = arr[k];
  14322. var i = left;
  14323. var j = right;
  14324. swap(arr, left, k);
  14325. if (compare(arr[right], t) > 0) swap(arr, left, right);
  14326. while (i < j) {
  14327. swap(arr, i, j);
  14328. i++;
  14329. j--;
  14330. while (compare(arr[i], t) < 0) i++;
  14331. while (compare(arr[j], t) > 0) j--;
  14332. }
  14333. if (compare(arr[left], t) === 0) swap(arr, left, j);
  14334. else {
  14335. j++;
  14336. swap(arr, j, right);
  14337. }
  14338. if (j <= k) left = j + 1;
  14339. if (k <= j) right = j - 1;
  14340. }
  14341. }
  14342. function swap(arr, i, j) {
  14343. var tmp = arr[i];
  14344. arr[i] = arr[j];
  14345. arr[j] = tmp;
  14346. }
  14347. function defaultCompare(a, b) {
  14348. return a < b ? -1 : a > b ? 1 : 0;
  14349. }
  14350. return quickselect;
  14351. })));
  14352. /***/ }),
  14353. /***/ 510:
  14354. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14355. "use strict";
  14356. module.exports = rbush;
  14357. module.exports["default"] = rbush;
  14358. var quickselect = __webpack_require__(166);
  14359. function rbush(maxEntries, format) {
  14360. if (!(this instanceof rbush)) return new rbush(maxEntries, format);
  14361. // max entries in a node is 9 by default; min node fill is 40% for best performance
  14362. this._maxEntries = Math.max(4, maxEntries || 9);
  14363. this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
  14364. if (format) {
  14365. this._initFormat(format);
  14366. }
  14367. this.clear();
  14368. }
  14369. rbush.prototype = {
  14370. all: function () {
  14371. return this._all(this.data, []);
  14372. },
  14373. search: function (bbox) {
  14374. var node = this.data,
  14375. result = [],
  14376. toBBox = this.toBBox;
  14377. if (!intersects(bbox, node)) return result;
  14378. var nodesToSearch = [],
  14379. i, len, child, childBBox;
  14380. while (node) {
  14381. for (i = 0, len = node.children.length; i < len; i++) {
  14382. child = node.children[i];
  14383. childBBox = node.leaf ? toBBox(child) : child;
  14384. if (intersects(bbox, childBBox)) {
  14385. if (node.leaf) result.push(child);
  14386. else if (contains(bbox, childBBox)) this._all(child, result);
  14387. else nodesToSearch.push(child);
  14388. }
  14389. }
  14390. node = nodesToSearch.pop();
  14391. }
  14392. return result;
  14393. },
  14394. collides: function (bbox) {
  14395. var node = this.data,
  14396. toBBox = this.toBBox;
  14397. if (!intersects(bbox, node)) return false;
  14398. var nodesToSearch = [],
  14399. i, len, child, childBBox;
  14400. while (node) {
  14401. for (i = 0, len = node.children.length; i < len; i++) {
  14402. child = node.children[i];
  14403. childBBox = node.leaf ? toBBox(child) : child;
  14404. if (intersects(bbox, childBBox)) {
  14405. if (node.leaf || contains(bbox, childBBox)) return true;
  14406. nodesToSearch.push(child);
  14407. }
  14408. }
  14409. node = nodesToSearch.pop();
  14410. }
  14411. return false;
  14412. },
  14413. load: function (data) {
  14414. if (!(data && data.length)) return this;
  14415. if (data.length < this._minEntries) {
  14416. for (var i = 0, len = data.length; i < len; i++) {
  14417. this.insert(data[i]);
  14418. }
  14419. return this;
  14420. }
  14421. // recursively build the tree with the given data from scratch using OMT algorithm
  14422. var node = this._build(data.slice(), 0, data.length - 1, 0);
  14423. if (!this.data.children.length) {
  14424. // save as is if tree is empty
  14425. this.data = node;
  14426. } else if (this.data.height === node.height) {
  14427. // split root if trees have the same height
  14428. this._splitRoot(this.data, node);
  14429. } else {
  14430. if (this.data.height < node.height) {
  14431. // swap trees if inserted one is bigger
  14432. var tmpNode = this.data;
  14433. this.data = node;
  14434. node = tmpNode;
  14435. }
  14436. // insert the small tree into the large tree at appropriate level
  14437. this._insert(node, this.data.height - node.height - 1, true);
  14438. }
  14439. return this;
  14440. },
  14441. insert: function (item) {
  14442. if (item) this._insert(item, this.data.height - 1);
  14443. return this;
  14444. },
  14445. clear: function () {
  14446. this.data = createNode([]);
  14447. return this;
  14448. },
  14449. remove: function (item, equalsFn) {
  14450. if (!item) return this;
  14451. var node = this.data,
  14452. bbox = this.toBBox(item),
  14453. path = [],
  14454. indexes = [],
  14455. i, parent, index, goingUp;
  14456. // depth-first iterative tree traversal
  14457. while (node || path.length) {
  14458. if (!node) { // go up
  14459. node = path.pop();
  14460. parent = path[path.length - 1];
  14461. i = indexes.pop();
  14462. goingUp = true;
  14463. }
  14464. if (node.leaf) { // check current node
  14465. index = findItem(item, node.children, equalsFn);
  14466. if (index !== -1) {
  14467. // item found, remove the item and condense tree upwards
  14468. node.children.splice(index, 1);
  14469. path.push(node);
  14470. this._condense(path);
  14471. return this;
  14472. }
  14473. }
  14474. if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
  14475. path.push(node);
  14476. indexes.push(i);
  14477. i = 0;
  14478. parent = node;
  14479. node = node.children[0];
  14480. } else if (parent) { // go right
  14481. i++;
  14482. node = parent.children[i];
  14483. goingUp = false;
  14484. } else node = null; // nothing found
  14485. }
  14486. return this;
  14487. },
  14488. toBBox: function (item) { return item; },
  14489. compareMinX: compareNodeMinX,
  14490. compareMinY: compareNodeMinY,
  14491. toJSON: function () { return this.data; },
  14492. fromJSON: function (data) {
  14493. this.data = data;
  14494. return this;
  14495. },
  14496. _all: function (node, result) {
  14497. var nodesToSearch = [];
  14498. while (node) {
  14499. if (node.leaf) result.push.apply(result, node.children);
  14500. else nodesToSearch.push.apply(nodesToSearch, node.children);
  14501. node = nodesToSearch.pop();
  14502. }
  14503. return result;
  14504. },
  14505. _build: function (items, left, right, height) {
  14506. var N = right - left + 1,
  14507. M = this._maxEntries,
  14508. node;
  14509. if (N <= M) {
  14510. // reached leaf level; return leaf
  14511. node = createNode(items.slice(left, right + 1));
  14512. calcBBox(node, this.toBBox);
  14513. return node;
  14514. }
  14515. if (!height) {
  14516. // target height of the bulk-loaded tree
  14517. height = Math.ceil(Math.log(N) / Math.log(M));
  14518. // target number of root entries to maximize storage utilization
  14519. M = Math.ceil(N / Math.pow(M, height - 1));
  14520. }
  14521. node = createNode([]);
  14522. node.leaf = false;
  14523. node.height = height;
  14524. // split the items into M mostly square tiles
  14525. var N2 = Math.ceil(N / M),
  14526. N1 = N2 * Math.ceil(Math.sqrt(M)),
  14527. i, j, right2, right3;
  14528. multiSelect(items, left, right, N1, this.compareMinX);
  14529. for (i = left; i <= right; i += N1) {
  14530. right2 = Math.min(i + N1 - 1, right);
  14531. multiSelect(items, i, right2, N2, this.compareMinY);
  14532. for (j = i; j <= right2; j += N2) {
  14533. right3 = Math.min(j + N2 - 1, right2);
  14534. // pack each entry recursively
  14535. node.children.push(this._build(items, j, right3, height - 1));
  14536. }
  14537. }
  14538. calcBBox(node, this.toBBox);
  14539. return node;
  14540. },
  14541. _chooseSubtree: function (bbox, node, level, path) {
  14542. var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
  14543. while (true) {
  14544. path.push(node);
  14545. if (node.leaf || path.length - 1 === level) break;
  14546. minArea = minEnlargement = Infinity;
  14547. for (i = 0, len = node.children.length; i < len; i++) {
  14548. child = node.children[i];
  14549. area = bboxArea(child);
  14550. enlargement = enlargedArea(bbox, child) - area;
  14551. // choose entry with the least area enlargement
  14552. if (enlargement < minEnlargement) {
  14553. minEnlargement = enlargement;
  14554. minArea = area < minArea ? area : minArea;
  14555. targetNode = child;
  14556. } else if (enlargement === minEnlargement) {
  14557. // otherwise choose one with the smallest area
  14558. if (area < minArea) {
  14559. minArea = area;
  14560. targetNode = child;
  14561. }
  14562. }
  14563. }
  14564. node = targetNode || node.children[0];
  14565. }
  14566. return node;
  14567. },
  14568. _insert: function (item, level, isNode) {
  14569. var toBBox = this.toBBox,
  14570. bbox = isNode ? item : toBBox(item),
  14571. insertPath = [];
  14572. // find the best node for accommodating the item, saving all nodes along the path too
  14573. var node = this._chooseSubtree(bbox, this.data, level, insertPath);
  14574. // put the item into the node
  14575. node.children.push(item);
  14576. extend(node, bbox);
  14577. // split on node overflow; propagate upwards if necessary
  14578. while (level >= 0) {
  14579. if (insertPath[level].children.length > this._maxEntries) {
  14580. this._split(insertPath, level);
  14581. level--;
  14582. } else break;
  14583. }
  14584. // adjust bboxes along the insertion path
  14585. this._adjustParentBBoxes(bbox, insertPath, level);
  14586. },
  14587. // split overflowed node into two
  14588. _split: function (insertPath, level) {
  14589. var node = insertPath[level],
  14590. M = node.children.length,
  14591. m = this._minEntries;
  14592. this._chooseSplitAxis(node, m, M);
  14593. var splitIndex = this._chooseSplitIndex(node, m, M);
  14594. var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
  14595. newNode.height = node.height;
  14596. newNode.leaf = node.leaf;
  14597. calcBBox(node, this.toBBox);
  14598. calcBBox(newNode, this.toBBox);
  14599. if (level) insertPath[level - 1].children.push(newNode);
  14600. else this._splitRoot(node, newNode);
  14601. },
  14602. _splitRoot: function (node, newNode) {
  14603. // split root node
  14604. this.data = createNode([node, newNode]);
  14605. this.data.height = node.height + 1;
  14606. this.data.leaf = false;
  14607. calcBBox(this.data, this.toBBox);
  14608. },
  14609. _chooseSplitIndex: function (node, m, M) {
  14610. var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
  14611. minOverlap = minArea = Infinity;
  14612. for (i = m; i <= M - m; i++) {
  14613. bbox1 = distBBox(node, 0, i, this.toBBox);
  14614. bbox2 = distBBox(node, i, M, this.toBBox);
  14615. overlap = intersectionArea(bbox1, bbox2);
  14616. area = bboxArea(bbox1) + bboxArea(bbox2);
  14617. // choose distribution with minimum overlap
  14618. if (overlap < minOverlap) {
  14619. minOverlap = overlap;
  14620. index = i;
  14621. minArea = area < minArea ? area : minArea;
  14622. } else if (overlap === minOverlap) {
  14623. // otherwise choose distribution with minimum area
  14624. if (area < minArea) {
  14625. minArea = area;
  14626. index = i;
  14627. }
  14628. }
  14629. }
  14630. return index;
  14631. },
  14632. // sorts node children by the best axis for split
  14633. _chooseSplitAxis: function (node, m, M) {
  14634. var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,
  14635. compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,
  14636. xMargin = this._allDistMargin(node, m, M, compareMinX),
  14637. yMargin = this._allDistMargin(node, m, M, compareMinY);
  14638. // if total distributions margin value is minimal for x, sort by minX,
  14639. // otherwise it's already sorted by minY
  14640. if (xMargin < yMargin) node.children.sort(compareMinX);
  14641. },
  14642. // total margin of all possible split distributions where each node is at least m full
  14643. _allDistMargin: function (node, m, M, compare) {
  14644. node.children.sort(compare);
  14645. var toBBox = this.toBBox,
  14646. leftBBox = distBBox(node, 0, m, toBBox),
  14647. rightBBox = distBBox(node, M - m, M, toBBox),
  14648. margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
  14649. i, child;
  14650. for (i = m; i < M - m; i++) {
  14651. child = node.children[i];
  14652. extend(leftBBox, node.leaf ? toBBox(child) : child);
  14653. margin += bboxMargin(leftBBox);
  14654. }
  14655. for (i = M - m - 1; i >= m; i--) {
  14656. child = node.children[i];
  14657. extend(rightBBox, node.leaf ? toBBox(child) : child);
  14658. margin += bboxMargin(rightBBox);
  14659. }
  14660. return margin;
  14661. },
  14662. _adjustParentBBoxes: function (bbox, path, level) {
  14663. // adjust bboxes along the given tree path
  14664. for (var i = level; i >= 0; i--) {
  14665. extend(path[i], bbox);
  14666. }
  14667. },
  14668. _condense: function (path) {
  14669. // go through the path, removing empty nodes and updating bboxes
  14670. for (var i = path.length - 1, siblings; i >= 0; i--) {
  14671. if (path[i].children.length === 0) {
  14672. if (i > 0) {
  14673. siblings = path[i - 1].children;
  14674. siblings.splice(siblings.indexOf(path[i]), 1);
  14675. } else this.clear();
  14676. } else calcBBox(path[i], this.toBBox);
  14677. }
  14678. },
  14679. _initFormat: function (format) {
  14680. // data format (minX, minY, maxX, maxY accessors)
  14681. // uses eval-type function compilation instead of just accepting a toBBox function
  14682. // because the algorithms are very sensitive to sorting functions performance,
  14683. // so they should be dead simple and without inner calls
  14684. var compareArr = ['return a', ' - b', ';'];
  14685. this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
  14686. this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
  14687. this.toBBox = new Function('a',
  14688. 'return {minX: a' + format[0] +
  14689. ', minY: a' + format[1] +
  14690. ', maxX: a' + format[2] +
  14691. ', maxY: a' + format[3] + '};');
  14692. }
  14693. };
  14694. function findItem(item, items, equalsFn) {
  14695. if (!equalsFn) return items.indexOf(item);
  14696. for (var i = 0; i < items.length; i++) {
  14697. if (equalsFn(item, items[i])) return i;
  14698. }
  14699. return -1;
  14700. }
  14701. // calculate node's bbox from bboxes of its children
  14702. function calcBBox(node, toBBox) {
  14703. distBBox(node, 0, node.children.length, toBBox, node);
  14704. }
  14705. // min bounding rectangle of node children from k to p-1
  14706. function distBBox(node, k, p, toBBox, destNode) {
  14707. if (!destNode) destNode = createNode(null);
  14708. destNode.minX = Infinity;
  14709. destNode.minY = Infinity;
  14710. destNode.maxX = -Infinity;
  14711. destNode.maxY = -Infinity;
  14712. for (var i = k, child; i < p; i++) {
  14713. child = node.children[i];
  14714. extend(destNode, node.leaf ? toBBox(child) : child);
  14715. }
  14716. return destNode;
  14717. }
  14718. function extend(a, b) {
  14719. a.minX = Math.min(a.minX, b.minX);
  14720. a.minY = Math.min(a.minY, b.minY);
  14721. a.maxX = Math.max(a.maxX, b.maxX);
  14722. a.maxY = Math.max(a.maxY, b.maxY);
  14723. return a;
  14724. }
  14725. function compareNodeMinX(a, b) { return a.minX - b.minX; }
  14726. function compareNodeMinY(a, b) { return a.minY - b.minY; }
  14727. function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
  14728. function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
  14729. function enlargedArea(a, b) {
  14730. return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
  14731. (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
  14732. }
  14733. function intersectionArea(a, b) {
  14734. var minX = Math.max(a.minX, b.minX),
  14735. minY = Math.max(a.minY, b.minY),
  14736. maxX = Math.min(a.maxX, b.maxX),
  14737. maxY = Math.min(a.maxY, b.maxY);
  14738. return Math.max(0, maxX - minX) *
  14739. Math.max(0, maxY - minY);
  14740. }
  14741. function contains(a, b) {
  14742. return a.minX <= b.minX &&
  14743. a.minY <= b.minY &&
  14744. b.maxX <= a.maxX &&
  14745. b.maxY <= a.maxY;
  14746. }
  14747. function intersects(a, b) {
  14748. return b.minX <= a.maxX &&
  14749. b.minY <= a.maxY &&
  14750. b.maxX >= a.minX &&
  14751. b.maxY >= a.minY;
  14752. }
  14753. function createNode(children) {
  14754. return {
  14755. children: children,
  14756. height: 1,
  14757. leaf: true,
  14758. minX: Infinity,
  14759. minY: Infinity,
  14760. maxX: -Infinity,
  14761. maxY: -Infinity
  14762. };
  14763. }
  14764. // sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
  14765. // combines selection algorithm with binary divide & conquer approach
  14766. function multiSelect(arr, left, right, n, compare) {
  14767. var stack = [left, right],
  14768. mid;
  14769. while (stack.length) {
  14770. right = stack.pop();
  14771. left = stack.pop();
  14772. if (right - left <= n) continue;
  14773. mid = left + Math.ceil((right - left) / n / 2) * n;
  14774. quickselect(arr, mid, left, right, compare);
  14775. stack.push(left, mid, mid, right);
  14776. }
  14777. }
  14778. /***/ }),
  14779. /***/ 901:
  14780. /***/ (function(module) {
  14781. // https://github.com/mbostock/slice-source Version 0.4.1. Copyright 2016 Mike Bostock.
  14782. (function (global, factory) {
  14783. true ? module.exports = factory() :
  14784. 0;
  14785. }(this, (function () { 'use strict';
  14786. var empty = new Uint8Array(0);
  14787. function slice_cancel() {
  14788. return this._source.cancel();
  14789. }
  14790. function concat(a, b) {
  14791. if (!a.length) return b;
  14792. if (!b.length) return a;
  14793. var c = new Uint8Array(a.length + b.length);
  14794. c.set(a);
  14795. c.set(b, a.length);
  14796. return c;
  14797. }
  14798. function slice_read() {
  14799. var that = this, array = that._array.subarray(that._index);
  14800. return that._source.read().then(function(result) {
  14801. that._array = empty;
  14802. that._index = 0;
  14803. return result.done ? (array.length > 0
  14804. ? {done: false, value: array}
  14805. : {done: true, value: undefined})
  14806. : {done: false, value: concat(array, result.value)};
  14807. });
  14808. }
  14809. function slice_slice(length) {
  14810. if ((length |= 0) < 0) throw new Error("invalid length");
  14811. var that = this, index = this._array.length - this._index;
  14812. // If the request fits within the remaining buffer, resolve it immediately.
  14813. if (this._index + length <= this._array.length) {
  14814. return Promise.resolve(this._array.subarray(this._index, this._index += length));
  14815. }
  14816. // Otherwise, read chunks repeatedly until the request is fulfilled.
  14817. var array = new Uint8Array(length);
  14818. array.set(this._array.subarray(this._index));
  14819. return (function read() {
  14820. return that._source.read().then(function(result) {
  14821. // When done, it’s possible the request wasn’t fully fullfilled!
  14822. // If so, the pre-allocated array is too big and needs slicing.
  14823. if (result.done) {
  14824. that._array = empty;
  14825. that._index = 0;
  14826. return index > 0 ? array.subarray(0, index) : null;
  14827. }
  14828. // If this chunk fulfills the request, return the resulting array.
  14829. if (index + result.value.length >= length) {
  14830. that._array = result.value;
  14831. that._index = length - index;
  14832. array.set(result.value.subarray(0, length - index), index);
  14833. return array;
  14834. }
  14835. // Otherwise copy this chunk into the array, then read the next chunk.
  14836. array.set(result.value, index);
  14837. index += result.value.length;
  14838. return read();
  14839. });
  14840. })();
  14841. }
  14842. function slice(source) {
  14843. return typeof source.slice === "function" ? source :
  14844. new SliceSource(typeof source.read === "function" ? source
  14845. : source.getReader());
  14846. }
  14847. function SliceSource(source) {
  14848. this._source = source;
  14849. this._array = empty;
  14850. this._index = 0;
  14851. }
  14852. SliceSource.prototype.read = slice_read;
  14853. SliceSource.prototype.slice = slice_slice;
  14854. SliceSource.prototype.cancel = slice_cancel;
  14855. return slice;
  14856. })));
  14857. /***/ }),
  14858. /***/ 982:
  14859. /***/ ((__unused_webpack_module, exports) => {
  14860. "use strict";
  14861. var __webpack_unused_export__;
  14862. __webpack_unused_export__ = ({ value: true });
  14863. /*! *****************************************************************************
  14864. Copyright (c) Microsoft Corporation.
  14865. Permission to use, copy, modify, and/or distribute this software for any
  14866. purpose with or without fee is hereby granted.
  14867. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14868. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14869. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14870. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14871. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14872. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14873. PERFORMANCE OF THIS SOFTWARE.
  14874. ***************************************************************************** */
  14875. /* global Reflect, Promise */
  14876. var extendStatics = function(d, b) {
  14877. extendStatics = Object.setPrototypeOf ||
  14878. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14879. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14880. return extendStatics(d, b);
  14881. };
  14882. function __extends(d, b) {
  14883. extendStatics(d, b);
  14884. function __() { this.constructor = d; }
  14885. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14886. }
  14887. function __awaiter(thisArg, _arguments, P, generator) {
  14888. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  14889. return new (P || (P = Promise))(function (resolve, reject) {
  14890. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  14891. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  14892. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  14893. step((generator = generator.apply(thisArg, _arguments || [])).next());
  14894. });
  14895. }
  14896. function __generator(thisArg, body) {
  14897. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  14898. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  14899. function verb(n) { return function (v) { return step([n, v]); }; }
  14900. function step(op) {
  14901. if (f) throw new TypeError("Generator is already executing.");
  14902. while (_) try {
  14903. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  14904. if (y = 0, t) op = [op[0] & 2, t.value];
  14905. switch (op[0]) {
  14906. case 0: case 1: t = op; break;
  14907. case 4: _.label++; return { value: op[1], done: false };
  14908. case 5: _.label++; y = op[1]; op = [0]; continue;
  14909. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  14910. default:
  14911. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  14912. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  14913. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  14914. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  14915. if (t[2]) _.ops.pop();
  14916. _.trys.pop(); continue;
  14917. }
  14918. op = body.call(thisArg, _);
  14919. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  14920. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  14921. }
  14922. }
  14923. function __values(o) {
  14924. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  14925. if (m) return m.call(o);
  14926. if (o && typeof o.length === "number") return {
  14927. next: function () {
  14928. if (o && i >= o.length) o = void 0;
  14929. return { value: o && o[i++], done: !o };
  14930. }
  14931. };
  14932. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  14933. }
  14934. function __await(v) {
  14935. return this instanceof __await ? (this.v = v, this) : new __await(v);
  14936. }
  14937. function __asyncGenerator(thisArg, _arguments, generator) {
  14938. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  14939. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  14940. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  14941. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  14942. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  14943. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  14944. function fulfill(value) { resume("next", value); }
  14945. function reject(value) { resume("throw", value); }
  14946. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  14947. }
  14948. /** An error subclass which is thrown when there are too many pending push or next operations on a single repeater. */
  14949. var RepeaterOverflowError = /** @class */ (function (_super) {
  14950. __extends(RepeaterOverflowError, _super);
  14951. function RepeaterOverflowError(message) {
  14952. var _this = _super.call(this, message) || this;
  14953. Object.defineProperty(_this, "name", {
  14954. value: "RepeaterOverflowError",
  14955. enumerable: false,
  14956. });
  14957. if (typeof Object.setPrototypeOf === "function") {
  14958. Object.setPrototypeOf(_this, _this.constructor.prototype);
  14959. }
  14960. else {
  14961. _this.__proto__ = _this.constructor.prototype;
  14962. }
  14963. if (typeof Error.captureStackTrace === "function") {
  14964. Error.captureStackTrace(_this, _this.constructor);
  14965. }
  14966. return _this;
  14967. }
  14968. return RepeaterOverflowError;
  14969. }(Error));
  14970. /** A buffer which allows you to push a set amount of values to the repeater without pushes waiting or throwing errors. */
  14971. var FixedBuffer = /** @class */ (function () {
  14972. function FixedBuffer(capacity) {
  14973. if (capacity < 0) {
  14974. throw new RangeError("Capacity may not be less than 0");
  14975. }
  14976. this._c = capacity;
  14977. this._q = [];
  14978. }
  14979. Object.defineProperty(FixedBuffer.prototype, "empty", {
  14980. get: function () {
  14981. return this._q.length === 0;
  14982. },
  14983. enumerable: false,
  14984. configurable: true
  14985. });
  14986. Object.defineProperty(FixedBuffer.prototype, "full", {
  14987. get: function () {
  14988. return this._q.length >= this._c;
  14989. },
  14990. enumerable: false,
  14991. configurable: true
  14992. });
  14993. FixedBuffer.prototype.add = function (value) {
  14994. if (this.full) {
  14995. throw new Error("Buffer full");
  14996. }
  14997. else {
  14998. this._q.push(value);
  14999. }
  15000. };
  15001. FixedBuffer.prototype.remove = function () {
  15002. if (this.empty) {
  15003. throw new Error("Buffer empty");
  15004. }
  15005. return this._q.shift();
  15006. };
  15007. return FixedBuffer;
  15008. }());
  15009. // TODO: Use a circular buffer here.
  15010. /** Sliding buffers allow you to push a set amount of values to the repeater without pushes waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the earliest values added. */
  15011. var SlidingBuffer = /** @class */ (function () {
  15012. function SlidingBuffer(capacity) {
  15013. if (capacity < 1) {
  15014. throw new RangeError("Capacity may not be less than 1");
  15015. }
  15016. this._c = capacity;
  15017. this._q = [];
  15018. }
  15019. Object.defineProperty(SlidingBuffer.prototype, "empty", {
  15020. get: function () {
  15021. return this._q.length === 0;
  15022. },
  15023. enumerable: false,
  15024. configurable: true
  15025. });
  15026. Object.defineProperty(SlidingBuffer.prototype, "full", {
  15027. get: function () {
  15028. return false;
  15029. },
  15030. enumerable: false,
  15031. configurable: true
  15032. });
  15033. SlidingBuffer.prototype.add = function (value) {
  15034. while (this._q.length >= this._c) {
  15035. this._q.shift();
  15036. }
  15037. this._q.push(value);
  15038. };
  15039. SlidingBuffer.prototype.remove = function () {
  15040. if (this.empty) {
  15041. throw new Error("Buffer empty");
  15042. }
  15043. return this._q.shift();
  15044. };
  15045. return SlidingBuffer;
  15046. }());
  15047. /** Dropping buffers allow you to push a set amount of values to the repeater without the push function waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the latest values added. */
  15048. var DroppingBuffer = /** @class */ (function () {
  15049. function DroppingBuffer(capacity) {
  15050. if (capacity < 1) {
  15051. throw new RangeError("Capacity may not be less than 1");
  15052. }
  15053. this._c = capacity;
  15054. this._q = [];
  15055. }
  15056. Object.defineProperty(DroppingBuffer.prototype, "empty", {
  15057. get: function () {
  15058. return this._q.length === 0;
  15059. },
  15060. enumerable: false,
  15061. configurable: true
  15062. });
  15063. Object.defineProperty(DroppingBuffer.prototype, "full", {
  15064. get: function () {
  15065. return false;
  15066. },
  15067. enumerable: false,
  15068. configurable: true
  15069. });
  15070. DroppingBuffer.prototype.add = function (value) {
  15071. if (this._q.length < this._c) {
  15072. this._q.push(value);
  15073. }
  15074. };
  15075. DroppingBuffer.prototype.remove = function () {
  15076. if (this.empty) {
  15077. throw new Error("Buffer empty");
  15078. }
  15079. return this._q.shift();
  15080. };
  15081. return DroppingBuffer;
  15082. }());
  15083. /** Makes sure promise-likes don’t cause unhandled rejections. */
  15084. function swallow(value) {
  15085. if (value != null && typeof value.then === "function") {
  15086. value.then(NOOP, NOOP);
  15087. }
  15088. }
  15089. /*** REPEATER STATES ***/
  15090. /** The following is an enumeration of all possible repeater states. These states are ordered, and a repeater may only advance to higher states. */
  15091. /** The initial state of the repeater. */
  15092. var Initial = 0;
  15093. /** Repeaters advance to this state the first time the next method is called on the repeater. */
  15094. var Started = 1;
  15095. /** Repeaters advance to this state when the stop function is called. */
  15096. var Stopped = 2;
  15097. /** Repeaters advance to this state when there are no values left to be pulled from the repeater. */
  15098. var Done = 3;
  15099. /** Repeaters advance to this state if an error is thrown into the repeater. */
  15100. var Rejected = 4;
  15101. /** The maximum number of push or next operations which may exist on a single repeater. */
  15102. var MAX_QUEUE_LENGTH = 1024;
  15103. var NOOP = function () { };
  15104. /** A helper function used to mimic the behavior of async generators where the final iteration is consumed. */
  15105. function consumeExecution(r) {
  15106. var err = r.err;
  15107. var execution = Promise.resolve(r.execution).then(function (value) {
  15108. if (err != null) {
  15109. throw err;
  15110. }
  15111. return value;
  15112. });
  15113. r.err = undefined;
  15114. r.execution = execution.then(function () { return undefined; }, function () { return undefined; });
  15115. return r.pending === undefined ? execution : r.pending.then(function () { return execution; });
  15116. }
  15117. /** A helper function for building iterations from values. Promises are unwrapped, so that iterations never have their value property set to a promise. */
  15118. function createIteration(r, value) {
  15119. var done = r.state >= Done;
  15120. return Promise.resolve(value).then(function (value) {
  15121. if (!done && r.state >= Rejected) {
  15122. return consumeExecution(r).then(function (value) { return ({
  15123. value: value,
  15124. done: true,
  15125. }); });
  15126. }
  15127. return { value: value, done: done };
  15128. });
  15129. }
  15130. /**
  15131. * This function is bound and passed to the executor as the stop argument.
  15132. *
  15133. * Advances state to Stopped.
  15134. */
  15135. function stop(r, err) {
  15136. var e_1, _a;
  15137. if (r.state >= Stopped) {
  15138. return;
  15139. }
  15140. r.state = Stopped;
  15141. r.onnext();
  15142. r.onstop();
  15143. if (r.err == null) {
  15144. r.err = err;
  15145. }
  15146. if (r.pushes.length === 0 &&
  15147. (typeof r.buffer === "undefined" || r.buffer.empty)) {
  15148. finish(r);
  15149. }
  15150. else {
  15151. try {
  15152. for (var _b = __values(r.pushes), _d = _b.next(); !_d.done; _d = _b.next()) {
  15153. var push_1 = _d.value;
  15154. push_1.resolve();
  15155. }
  15156. }
  15157. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  15158. finally {
  15159. try {
  15160. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  15161. }
  15162. finally { if (e_1) throw e_1.error; }
  15163. }
  15164. }
  15165. }
  15166. /**
  15167. * The difference between stopping a repeater vs finishing a repeater is that stopping a repeater allows next to continue to drain values from the push queue and buffer, while finishing a repeater will clear all pending values and end iteration immediately. Once, a repeater is finished, all iterations will have the done property set to true.
  15168. *
  15169. * Advances state to Done.
  15170. */
  15171. function finish(r) {
  15172. var e_2, _a;
  15173. if (r.state >= Done) {
  15174. return;
  15175. }
  15176. if (r.state < Stopped) {
  15177. stop(r);
  15178. }
  15179. r.state = Done;
  15180. r.buffer = undefined;
  15181. try {
  15182. for (var _b = __values(r.nexts), _d = _b.next(); !_d.done; _d = _b.next()) {
  15183. var next = _d.value;
  15184. var execution = r.pending === undefined
  15185. ? consumeExecution(r)
  15186. : r.pending.then(function () { return consumeExecution(r); });
  15187. next.resolve(createIteration(r, execution));
  15188. }
  15189. }
  15190. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  15191. finally {
  15192. try {
  15193. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  15194. }
  15195. finally { if (e_2) throw e_2.error; }
  15196. }
  15197. r.pushes = [];
  15198. r.nexts = [];
  15199. }
  15200. /**
  15201. * Called when a promise passed to push rejects, or when a push call is unhandled.
  15202. *
  15203. * Advances state to Rejected.
  15204. */
  15205. function reject(r) {
  15206. if (r.state >= Rejected) {
  15207. return;
  15208. }
  15209. if (r.state < Done) {
  15210. finish(r);
  15211. }
  15212. r.state = Rejected;
  15213. }
  15214. /** This function is bound and passed to the executor as the push argument. */
  15215. function push(r, value) {
  15216. swallow(value);
  15217. if (r.pushes.length >= MAX_QUEUE_LENGTH) {
  15218. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to push are allowed on a single repeater.");
  15219. }
  15220. else if (r.state >= Stopped) {
  15221. return Promise.resolve(undefined);
  15222. }
  15223. var valueP = r.pending === undefined
  15224. ? Promise.resolve(value)
  15225. : r.pending.then(function () { return value; });
  15226. valueP = valueP.catch(function (err) {
  15227. if (r.state < Stopped) {
  15228. r.err = err;
  15229. }
  15230. reject(r);
  15231. return undefined; // void :(
  15232. });
  15233. var nextP;
  15234. if (r.nexts.length) {
  15235. var next_1 = r.nexts.shift();
  15236. next_1.resolve(createIteration(r, valueP));
  15237. if (r.nexts.length) {
  15238. nextP = Promise.resolve(r.nexts[0].value);
  15239. }
  15240. else {
  15241. nextP = new Promise(function (resolve) { return (r.onnext = resolve); });
  15242. }
  15243. }
  15244. else if (typeof r.buffer !== "undefined" && !r.buffer.full) {
  15245. r.buffer.add(valueP);
  15246. nextP = Promise.resolve(undefined);
  15247. }
  15248. else {
  15249. nextP = new Promise(function (resolve) { return r.pushes.push({ resolve: resolve, value: valueP }); });
  15250. }
  15251. // If an error is thrown into the repeater via the next or throw methods, we give the repeater a chance to handle this by rejecting the promise returned from push. If the push call is not immediately handled we throw the next iteration of the repeater.
  15252. // To check that the promise returned from push is floating, we modify the then and catch methods of the returned promise so that they flip the floating flag. The push function actually does not return a promise, because modern engines do not call the then and catch methods on native promises. By making next a plain old javascript object, we ensure that the then and catch methods will be called.
  15253. var floating = true;
  15254. var next = {};
  15255. var unhandled = nextP.catch(function (err) {
  15256. if (floating) {
  15257. throw err;
  15258. }
  15259. return undefined; // void :(
  15260. });
  15261. next.then = function (onfulfilled, onrejected) {
  15262. floating = false;
  15263. return Promise.prototype.then.call(nextP, onfulfilled, onrejected);
  15264. };
  15265. next.catch = function (onrejected) {
  15266. floating = false;
  15267. return Promise.prototype.catch.call(nextP, onrejected);
  15268. };
  15269. next.finally = nextP.finally.bind(nextP);
  15270. r.pending = valueP
  15271. .then(function () { return unhandled; })
  15272. .catch(function (err) {
  15273. r.err = err;
  15274. reject(r);
  15275. });
  15276. return next;
  15277. }
  15278. /**
  15279. * Creates the stop callable promise which is passed to the executor
  15280. */
  15281. function createStop(r) {
  15282. var stop1 = stop.bind(null, r);
  15283. var stopP = new Promise(function (resolve) { return (r.onstop = resolve); });
  15284. stop1.then = stopP.then.bind(stopP);
  15285. stop1.catch = stopP.catch.bind(stopP);
  15286. stop1.finally = stopP.finally.bind(stopP);
  15287. return stop1;
  15288. }
  15289. /**
  15290. * Calls the executor passed into the constructor. This function is called the first time the next method is called on the repeater.
  15291. *
  15292. * Advances state to Started.
  15293. */
  15294. function execute(r) {
  15295. if (r.state >= Started) {
  15296. return;
  15297. }
  15298. r.state = Started;
  15299. var push1 = push.bind(null, r);
  15300. var stop1 = createStop(r);
  15301. r.execution = new Promise(function (resolve) { return resolve(r.executor(push1, stop1)); });
  15302. // TODO: We should consider stopping all repeaters when the executor settles.
  15303. r.execution.catch(function () { return stop(r); });
  15304. }
  15305. var records = new WeakMap();
  15306. // NOTE: While repeaters implement and are assignable to the AsyncGenerator interface, and you can use the types interchangeably, we don’t use typescript’s implements syntax here because this would make supporting earlier versions of typescript trickier. This is because TypeScript version 3.6 changed the iterator types by adding the TReturn and TNext type parameters.
  15307. var Repeater = /** @class */ (function () {
  15308. function Repeater(executor, buffer) {
  15309. records.set(this, {
  15310. executor: executor,
  15311. buffer: buffer,
  15312. err: undefined,
  15313. state: Initial,
  15314. pushes: [],
  15315. nexts: [],
  15316. pending: undefined,
  15317. execution: undefined,
  15318. onnext: NOOP,
  15319. onstop: NOOP,
  15320. });
  15321. }
  15322. Repeater.prototype.next = function (value) {
  15323. swallow(value);
  15324. var r = records.get(this);
  15325. if (r === undefined) {
  15326. throw new Error("WeakMap error");
  15327. }
  15328. if (r.nexts.length >= MAX_QUEUE_LENGTH) {
  15329. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to next are allowed on a single repeater.");
  15330. }
  15331. if (r.state <= Initial) {
  15332. execute(r);
  15333. }
  15334. r.onnext(value);
  15335. if (typeof r.buffer !== "undefined" && !r.buffer.empty) {
  15336. var result = createIteration(r, r.buffer.remove());
  15337. if (r.pushes.length) {
  15338. var push_2 = r.pushes.shift();
  15339. r.buffer.add(push_2.value);
  15340. r.onnext = push_2.resolve;
  15341. }
  15342. return result;
  15343. }
  15344. else if (r.pushes.length) {
  15345. var push_3 = r.pushes.shift();
  15346. r.onnext = push_3.resolve;
  15347. return createIteration(r, push_3.value);
  15348. }
  15349. else if (r.state >= Stopped) {
  15350. finish(r);
  15351. return createIteration(r, consumeExecution(r));
  15352. }
  15353. return new Promise(function (resolve) { return r.nexts.push({ resolve: resolve, value: value }); });
  15354. };
  15355. Repeater.prototype.return = function (value) {
  15356. swallow(value);
  15357. var r = records.get(this);
  15358. if (r === undefined) {
  15359. throw new Error("WeakMap error");
  15360. }
  15361. finish(r);
  15362. // We override the execution because return should always return the value passed in.
  15363. r.execution = Promise.resolve(r.execution).then(function () { return value; });
  15364. return createIteration(r, consumeExecution(r));
  15365. };
  15366. Repeater.prototype.throw = function (err) {
  15367. var r = records.get(this);
  15368. if (r === undefined) {
  15369. throw new Error("WeakMap error");
  15370. }
  15371. if (r.state <= Initial ||
  15372. r.state >= Stopped ||
  15373. (typeof r.buffer !== "undefined" && !r.buffer.empty)) {
  15374. finish(r);
  15375. // If r.err is already set, that mean the repeater has already produced an error, so we throw that error rather than the error passed in, because doing so might be more informative for the caller.
  15376. if (r.err == null) {
  15377. r.err = err;
  15378. }
  15379. return createIteration(r, consumeExecution(r));
  15380. }
  15381. return this.next(Promise.reject(err));
  15382. };
  15383. Repeater.prototype[Symbol.asyncIterator] = function () {
  15384. return this;
  15385. };
  15386. // TODO: Remove these static methods from the class.
  15387. Repeater.race = race;
  15388. Repeater.merge = merge;
  15389. Repeater.zip = zip;
  15390. Repeater.latest = latest;
  15391. return Repeater;
  15392. }());
  15393. /*** COMBINATOR FUNCTIONS ***/
  15394. // TODO: move these combinators to their own file.
  15395. function getIterators(values, options) {
  15396. var e_3, _a;
  15397. var iters = [];
  15398. var _loop_1 = function (value) {
  15399. if (value != null && typeof value[Symbol.asyncIterator] === "function") {
  15400. iters.push(value[Symbol.asyncIterator]());
  15401. }
  15402. else if (value != null && typeof value[Symbol.iterator] === "function") {
  15403. iters.push(value[Symbol.iterator]());
  15404. }
  15405. else {
  15406. iters.push((function valueToAsyncIterator() {
  15407. return __asyncGenerator(this, arguments, function valueToAsyncIterator_1() {
  15408. return __generator(this, function (_a) {
  15409. switch (_a.label) {
  15410. case 0:
  15411. if (!options.yieldValues) return [3 /*break*/, 3];
  15412. return [4 /*yield*/, __await(value)];
  15413. case 1: return [4 /*yield*/, _a.sent()];
  15414. case 2:
  15415. _a.sent();
  15416. _a.label = 3;
  15417. case 3:
  15418. if (!options.returnValues) return [3 /*break*/, 5];
  15419. return [4 /*yield*/, __await(value)];
  15420. case 4: return [2 /*return*/, _a.sent()];
  15421. case 5: return [2 /*return*/];
  15422. }
  15423. });
  15424. });
  15425. })());
  15426. }
  15427. };
  15428. try {
  15429. for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  15430. var value = values_1_1.value;
  15431. _loop_1(value);
  15432. }
  15433. }
  15434. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  15435. finally {
  15436. try {
  15437. if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  15438. }
  15439. finally { if (e_3) throw e_3.error; }
  15440. }
  15441. return iters;
  15442. }
  15443. // NOTE: whenever you see any variables called `advance` or `advances`, know that it is a hack to get around the fact that `Promise.race` leaks memory. These variables are intended to be set to the resolve function of a promise which is constructed and awaited as an alternative to Promise.race. For more information, see this comment in the Node.js issue tracker: https://github.com/nodejs/node/issues/17469#issuecomment-685216777.
  15444. function race(contenders) {
  15445. var _this = this;
  15446. var iters = getIterators(contenders, { returnValues: true });
  15447. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  15448. var advance, stopped, finalIteration, iteration, i_1, _loop_2;
  15449. return __generator(this, function (_a) {
  15450. switch (_a.label) {
  15451. case 0:
  15452. if (!iters.length) {
  15453. stop();
  15454. return [2 /*return*/];
  15455. }
  15456. stopped = false;
  15457. stop.then(function () {
  15458. advance();
  15459. stopped = true;
  15460. });
  15461. _a.label = 1;
  15462. case 1:
  15463. _a.trys.push([1, , 5, 7]);
  15464. iteration = void 0;
  15465. i_1 = 0;
  15466. _loop_2 = function () {
  15467. var j, iters_1, iters_1_1, iter;
  15468. var e_4, _a;
  15469. return __generator(this, function (_b) {
  15470. switch (_b.label) {
  15471. case 0:
  15472. j = i_1;
  15473. try {
  15474. for (iters_1 = (e_4 = void 0, __values(iters)), iters_1_1 = iters_1.next(); !iters_1_1.done; iters_1_1 = iters_1.next()) {
  15475. iter = iters_1_1.value;
  15476. Promise.resolve(iter.next()).then(function (iteration) {
  15477. if (iteration.done) {
  15478. stop();
  15479. if (finalIteration === undefined) {
  15480. finalIteration = iteration;
  15481. }
  15482. }
  15483. else if (i_1 === j) {
  15484. // This iterator has won, advance i and resolve the promise.
  15485. i_1++;
  15486. advance(iteration);
  15487. }
  15488. }, function (err) { return stop(err); });
  15489. }
  15490. }
  15491. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  15492. finally {
  15493. try {
  15494. if (iters_1_1 && !iters_1_1.done && (_a = iters_1.return)) _a.call(iters_1);
  15495. }
  15496. finally { if (e_4) throw e_4.error; }
  15497. }
  15498. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  15499. case 1:
  15500. iteration = _b.sent();
  15501. if (!(iteration !== undefined)) return [3 /*break*/, 3];
  15502. return [4 /*yield*/, push(iteration.value)];
  15503. case 2:
  15504. _b.sent();
  15505. _b.label = 3;
  15506. case 3: return [2 /*return*/];
  15507. }
  15508. });
  15509. };
  15510. _a.label = 2;
  15511. case 2:
  15512. if (!!stopped) return [3 /*break*/, 4];
  15513. return [5 /*yield**/, _loop_2()];
  15514. case 3:
  15515. _a.sent();
  15516. return [3 /*break*/, 2];
  15517. case 4: return [2 /*return*/, finalIteration && finalIteration.value];
  15518. case 5:
  15519. stop();
  15520. return [4 /*yield*/, Promise.race(iters.map(function (iter) { return iter.return && iter.return(); }))];
  15521. case 6:
  15522. _a.sent();
  15523. return [7 /*endfinally*/];
  15524. case 7: return [2 /*return*/];
  15525. }
  15526. });
  15527. }); });
  15528. }
  15529. function merge(contenders) {
  15530. var _this = this;
  15531. var iters = getIterators(contenders, { yieldValues: true });
  15532. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  15533. var advances, stopped, finalIteration;
  15534. var _this = this;
  15535. return __generator(this, function (_a) {
  15536. switch (_a.label) {
  15537. case 0:
  15538. if (!iters.length) {
  15539. stop();
  15540. return [2 /*return*/];
  15541. }
  15542. advances = [];
  15543. stopped = false;
  15544. stop.then(function () {
  15545. var e_5, _a;
  15546. stopped = true;
  15547. try {
  15548. for (var advances_1 = __values(advances), advances_1_1 = advances_1.next(); !advances_1_1.done; advances_1_1 = advances_1.next()) {
  15549. var advance = advances_1_1.value;
  15550. advance();
  15551. }
  15552. }
  15553. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  15554. finally {
  15555. try {
  15556. if (advances_1_1 && !advances_1_1.done && (_a = advances_1.return)) _a.call(advances_1);
  15557. }
  15558. finally { if (e_5) throw e_5.error; }
  15559. }
  15560. });
  15561. _a.label = 1;
  15562. case 1:
  15563. _a.trys.push([1, , 3, 4]);
  15564. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  15565. var iteration, _a;
  15566. return __generator(this, function (_b) {
  15567. switch (_b.label) {
  15568. case 0:
  15569. _b.trys.push([0, , 6, 9]);
  15570. _b.label = 1;
  15571. case 1:
  15572. if (!!stopped) return [3 /*break*/, 5];
  15573. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  15574. return [4 /*yield*/, new Promise(function (resolve) {
  15575. advances[i] = resolve;
  15576. })];
  15577. case 2:
  15578. iteration = _b.sent();
  15579. if (!(iteration !== undefined)) return [3 /*break*/, 4];
  15580. if (iteration.done) {
  15581. finalIteration = iteration;
  15582. return [2 /*return*/];
  15583. }
  15584. return [4 /*yield*/, push(iteration.value)];
  15585. case 3:
  15586. _b.sent();
  15587. _b.label = 4;
  15588. case 4: return [3 /*break*/, 1];
  15589. case 5: return [3 /*break*/, 9];
  15590. case 6:
  15591. _a = iter.return;
  15592. if (!_a) return [3 /*break*/, 8];
  15593. return [4 /*yield*/, iter.return()];
  15594. case 7:
  15595. _a = (_b.sent());
  15596. _b.label = 8;
  15597. case 8:
  15598. return [7 /*endfinally*/];
  15599. case 9: return [2 /*return*/];
  15600. }
  15601. });
  15602. }); }))];
  15603. case 2:
  15604. _a.sent();
  15605. return [2 /*return*/, finalIteration && finalIteration.value];
  15606. case 3:
  15607. stop();
  15608. return [7 /*endfinally*/];
  15609. case 4: return [2 /*return*/];
  15610. }
  15611. });
  15612. }); });
  15613. }
  15614. function zip(contenders) {
  15615. var _this = this;
  15616. var iters = getIterators(contenders, { returnValues: true });
  15617. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  15618. var advance, stopped, iterations, values;
  15619. return __generator(this, function (_a) {
  15620. switch (_a.label) {
  15621. case 0:
  15622. if (!iters.length) {
  15623. stop();
  15624. return [2 /*return*/, []];
  15625. }
  15626. stopped = false;
  15627. stop.then(function () {
  15628. advance();
  15629. stopped = true;
  15630. });
  15631. _a.label = 1;
  15632. case 1:
  15633. _a.trys.push([1, , 6, 8]);
  15634. _a.label = 2;
  15635. case 2:
  15636. if (!!stopped) return [3 /*break*/, 5];
  15637. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  15638. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  15639. case 3:
  15640. iterations = _a.sent();
  15641. if (iterations === undefined) {
  15642. return [2 /*return*/];
  15643. }
  15644. values = iterations.map(function (iteration) { return iteration.value; });
  15645. if (iterations.some(function (iteration) { return iteration.done; })) {
  15646. return [2 /*return*/, values];
  15647. }
  15648. return [4 /*yield*/, push(values)];
  15649. case 4:
  15650. _a.sent();
  15651. return [3 /*break*/, 2];
  15652. case 5: return [3 /*break*/, 8];
  15653. case 6:
  15654. stop();
  15655. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  15656. case 7:
  15657. _a.sent();
  15658. return [7 /*endfinally*/];
  15659. case 8: return [2 /*return*/];
  15660. }
  15661. });
  15662. }); });
  15663. }
  15664. function latest(contenders) {
  15665. var _this = this;
  15666. var iters = getIterators(contenders, {
  15667. yieldValues: true,
  15668. returnValues: true,
  15669. });
  15670. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  15671. var advance, advances, stopped, iterations_1, values_2;
  15672. var _this = this;
  15673. return __generator(this, function (_a) {
  15674. switch (_a.label) {
  15675. case 0:
  15676. if (!iters.length) {
  15677. stop();
  15678. return [2 /*return*/, []];
  15679. }
  15680. advances = [];
  15681. stopped = false;
  15682. stop.then(function () {
  15683. var e_6, _a;
  15684. advance();
  15685. try {
  15686. for (var advances_2 = __values(advances), advances_2_1 = advances_2.next(); !advances_2_1.done; advances_2_1 = advances_2.next()) {
  15687. var advance1 = advances_2_1.value;
  15688. advance1();
  15689. }
  15690. }
  15691. catch (e_6_1) { e_6 = { error: e_6_1 }; }
  15692. finally {
  15693. try {
  15694. if (advances_2_1 && !advances_2_1.done && (_a = advances_2.return)) _a.call(advances_2);
  15695. }
  15696. finally { if (e_6) throw e_6.error; }
  15697. }
  15698. stopped = true;
  15699. });
  15700. _a.label = 1;
  15701. case 1:
  15702. _a.trys.push([1, , 5, 7]);
  15703. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  15704. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  15705. case 2:
  15706. iterations_1 = _a.sent();
  15707. if (iterations_1 === undefined) {
  15708. return [2 /*return*/];
  15709. }
  15710. values_2 = iterations_1.map(function (iteration) { return iteration.value; });
  15711. if (iterations_1.every(function (iteration) { return iteration.done; })) {
  15712. return [2 /*return*/, values_2];
  15713. }
  15714. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  15715. return [4 /*yield*/, push(values_2.slice())];
  15716. case 3:
  15717. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  15718. _a.sent();
  15719. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  15720. var iteration;
  15721. return __generator(this, function (_a) {
  15722. switch (_a.label) {
  15723. case 0:
  15724. if (iterations_1[i].done) {
  15725. return [2 /*return*/, iterations_1[i].value];
  15726. }
  15727. _a.label = 1;
  15728. case 1:
  15729. if (!!stopped) return [3 /*break*/, 4];
  15730. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  15731. return [4 /*yield*/, new Promise(function (resolve) { return (advances[i] = resolve); })];
  15732. case 2:
  15733. iteration = _a.sent();
  15734. if (iteration === undefined) {
  15735. return [2 /*return*/, iterations_1[i].value];
  15736. }
  15737. else if (iteration.done) {
  15738. return [2 /*return*/, iteration.value];
  15739. }
  15740. values_2[i] = iteration.value;
  15741. return [4 /*yield*/, push(values_2.slice())];
  15742. case 3:
  15743. _a.sent();
  15744. return [3 /*break*/, 1];
  15745. case 4: return [2 /*return*/];
  15746. }
  15747. });
  15748. }); }))];
  15749. case 4: return [2 /*return*/, _a.sent()];
  15750. case 5:
  15751. stop();
  15752. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  15753. case 6:
  15754. _a.sent();
  15755. return [7 /*endfinally*/];
  15756. case 7: return [2 /*return*/];
  15757. }
  15758. });
  15759. }); });
  15760. }
  15761. __webpack_unused_export__ = DroppingBuffer;
  15762. __webpack_unused_export__ = FixedBuffer;
  15763. __webpack_unused_export__ = MAX_QUEUE_LENGTH;
  15764. exports.ZN = Repeater;
  15765. __webpack_unused_export__ = RepeaterOverflowError;
  15766. __webpack_unused_export__ = SlidingBuffer;
  15767. //# sourceMappingURL=repeater.js.map
  15768. /***/ })
  15769. /******/ });
  15770. /************************************************************************/
  15771. /******/ // The module cache
  15772. /******/ var __webpack_module_cache__ = {};
  15773. /******/
  15774. /******/ // The require function
  15775. /******/ function __webpack_require__(moduleId) {
  15776. /******/ // Check if module is in cache
  15777. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  15778. /******/ if (cachedModule !== undefined) {
  15779. /******/ return cachedModule.exports;
  15780. /******/ }
  15781. /******/ // Create a new module (and put it into the cache)
  15782. /******/ var module = __webpack_module_cache__[moduleId] = {
  15783. /******/ id: moduleId,
  15784. /******/ loaded: false,
  15785. /******/ exports: {}
  15786. /******/ };
  15787. /******/
  15788. /******/ // Execute the module function
  15789. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  15790. /******/
  15791. /******/ // Flag the module as loaded
  15792. /******/ module.loaded = true;
  15793. /******/
  15794. /******/ // Return the exports of the module
  15795. /******/ return module.exports;
  15796. /******/ }
  15797. /******/
  15798. /************************************************************************/
  15799. /******/ /* webpack/runtime/compat get default export */
  15800. /******/ (() => {
  15801. /******/ // getDefaultExport function for compatibility with non-harmony modules
  15802. /******/ __webpack_require__.n = (module) => {
  15803. /******/ var getter = module && module.__esModule ?
  15804. /******/ () => (module['default']) :
  15805. /******/ () => (module);
  15806. /******/ __webpack_require__.d(getter, { a: getter });
  15807. /******/ return getter;
  15808. /******/ };
  15809. /******/ })();
  15810. /******/
  15811. /******/ /* webpack/runtime/define property getters */
  15812. /******/ (() => {
  15813. /******/ // define getter functions for harmony exports
  15814. /******/ __webpack_require__.d = (exports, definition) => {
  15815. /******/ for(var key in definition) {
  15816. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  15817. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  15818. /******/ }
  15819. /******/ }
  15820. /******/ };
  15821. /******/ })();
  15822. /******/
  15823. /******/ /* webpack/runtime/global */
  15824. /******/ (() => {
  15825. /******/ __webpack_require__.g = (function() {
  15826. /******/ if (typeof globalThis === 'object') return globalThis;
  15827. /******/ try {
  15828. /******/ return this || new Function('return this')();
  15829. /******/ } catch (e) {
  15830. /******/ if (typeof window === 'object') return window;
  15831. /******/ }
  15832. /******/ })();
  15833. /******/ })();
  15834. /******/
  15835. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  15836. /******/ (() => {
  15837. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  15838. /******/ })();
  15839. /******/
  15840. /******/ /* webpack/runtime/node module decorator */
  15841. /******/ (() => {
  15842. /******/ __webpack_require__.nmd = (module) => {
  15843. /******/ module.paths = [];
  15844. /******/ if (!module.children) module.children = [];
  15845. /******/ return module;
  15846. /******/ };
  15847. /******/ })();
  15848. /******/
  15849. /************************************************************************/
  15850. var __webpack_exports__ = {};
  15851. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  15852. (() => {
  15853. "use strict";
  15854. // UNUSED EXPORTS: AddressMatchService, AggregationParameter, AggregationTypes, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BaiduCRS, BaiduTileLayer, Bounds, Browser, BucketAggParameter, BucketAggType, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CRS, CartoCSS, ChangeTileVersion, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CircleStyle, CityTabsPage, ClientComputationLayer, ClientComputationView, ClientComputationViewModel, ClientType, ClipAnalystMode, ClipParameter, CloudTileLayer, CloverStyle, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonServiceBase, CommonTheme, CommonUtil, CommontypesConversion, ComponentsUtil, ComponentsViewBase, ComputeWeightMatrixParameters, CreateDatasetParameters, Credential, DataFlowLayer, DataFlowService, DataFlowView, DataFlowViewModel, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DataServiceQueryView, DataServiceQueryViewModel, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetService, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DatasourceService, DensityKernelAnalystParameters, DirectionType, DistributedAnalysisView, DistributedAnalysisViewModel, DropDownBox, EchartsLayer, EditFeaturesParameters, EditType, ElasticSearch, EngineType, EntityType, Event, Events, Exponent, FGBLayer, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, Feature, FeatureService, FeatureShapeFactory, FeatureTheme, FeatureThemeGraph, FeatureThemeRankSymbol, FeatureThemeVector, FeatureVector, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FieldsFilter, FileReaderUtil, FillGradientMode, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, Format, GenerateSpatialDataParameters, GeoCodingParameter, GeoDecodingParameter, GeoFeatureThemeLayer, GeoHashGridAggParameter, GeoJSONFormat, GeoJSONLayerWithName, GeoJsonLayerDataModel, GeoRelationAnalystParameters, Geometry, GeometryBufferAnalystParameters, GeometryCollection, GeometryCurve, GeometryGeoText, GeometryLineString, GeometryLinearRing, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryOverlayAnalystParameters, GeometryPoint, GeometryPolygon, GeometryRectangle, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GeoprocessingService, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetFeaturesParametersBase, GetFeaturesServiceBase, GetGridCellInfosParameters, GetResolutionFromScaleDpi, GraduatedMode, GraphAxesTextDisplayMode, GraphMap, GraphThemeLayer, Graphic, GraphicLayer, Grid, GridCellInfosService, GridType, HeatMapFeature, HeatMapLayer, HillshadeParameter, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, ImageCollectionService, ImageGFAspect, ImageGFHillShade, ImageGFOrtho, ImageGFSlope, ImageMapLayer, ImageRenderingRule, ImageSearchParameter, ImageService, ImageStretchOption, ImageStyle, ImageTileLayer, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationDensityAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JSONFormat, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, KnowledgeGraph, KnowledgeGraphService, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LabelThemeLayer, Lang, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, LonLat, MapService, MapVLayer, MapVRenderer, MappingParameters, MapvRenderer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, MetricsAggParameter, MetricsAggType, NDVIParameter, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NetworkAnalystServiceBase, NonEarthCRS, NormalRenderer, NormalizeScale, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OpenFileView, OpenFileViewModel, OrderBy, OrderType, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PermissionType, Pixel, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, ProcessingServiceBase, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, RangeMode, RangeThemeLayer, RankSymbolThemeLayer, RasterFunctionParameter, RasterFunctionType, ResourceType, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, SVGRenderer, SearchMode, SearchType, SearchView, SearchViewModel, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetDatasourceParameters, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, ShapeParameters, ShapeParametersCircle, ShapeParametersImage, ShapeParametersLabel, ShapeParametersLine, ShapeParametersPoint, ShapeParametersPolygon, ShapeParametersRectangle, ShapeParametersSector, SideType, SingleObjectQueryJobsParameter, Size, SmoothMethod, Sortby, SpatialAnalystBase, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TemplateBase, TerrainCurvatureCalculationParameters, TextAlignment, ThemeDotDensity, ThemeFeature, ThemeGraduatedSymbol, ThemeGraduatedSymbolStyle, ThemeGraph, ThemeGraphAxes, ThemeGraphItem, ThemeGraphSize, ThemeGraphText, ThemeGraphTextFormat, ThemeGraphType, ThemeGridRange, ThemeGridRangeItem, ThemeGridUnique, ThemeGridUniqueItem, ThemeLabel, ThemeLabelAlongLine, ThemeLabelBackground, ThemeLabelItem, ThemeLabelText, ThemeLabelUniqueItem, ThemeLayer, ThemeMemoryData, ThemeOffset, ThemeParameters, ThemeRange, ThemeRangeItem, ThemeService, ThemeStyle, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, TianDiTu_MercatorCRS, TianDiTu_WGS84CRS, TiandituTileLayer, TileVectorLayer, TiledMapLayer, TiledVectorLayer, TimeControlBase, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, Transform, TransportationAnalystParameter, TransportationAnalystResultSetting, TurfLayer, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, UnicodeMarker, UniqueThemeLayer, Unit, UpdateDatasetParameters, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, VariogramMode, Vector, VectorClipJobsParameter, VectorGrid, VectorTileFormat, WKTFormat, WMTSLayer, WebExportFormatType, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebScaleOrientationType, WebScaleType, WebScaleUnit, addressMatchService, baiduTileLayer, changeTileVersion, chartService, circleStyle, clientComputationLayer, clientComputationView, cloudTileLayer, cloverStyle, componentsViewBase, conversionDegree, crs, crsFromMapJSON, dataFlowLayer, dataFlowService, dataFlowView, dataFlowViewModel, dataServiceQueryView, dataServiceQueryViewModel, datasetService, datasourceService, distributedAnalysisView, echartsLayer, featureService, fgbLayer, fieldService, geoJSONLayerWithName, geoprocessingService, getMeterPerMapUnit, getResolutionFromScaleDpi, getWrapNum, graphThemeLayer, graphic, graphicLayer, gridCellInfosService, heatMapFeature, heatMapLayer, imageMapLayer, imageStyle, imageTileLayer, initMap, isCORS, labelThemeLayer, layerInfoService, logo, mapService, mapVLayer, measureService, networkAnalyst3DService, networkAnalystService, nonEarthCRS, normalizeScale, openFileView, openFileViewModel, processingService, queryService, rangeThemeLayer, rankSymbolThemeLayer, resolutionToScale, scaleToResolution, searchView, searchViewModel, setCORS, spatialAnalystService, themeFeature, themeService, tiandituTileLayer, tiledMapLayer, tiledVectorLayer, toGeoJSON, toSuperMapGeometry, trafficTransferAnalystService, transform, turfLayer, unicodeMarker, uniqueThemeLayer, webMap, webPrintingJobService, wmtsLayer
  15855. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  15856. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15857. * This program are made available under the terms of the Apache License, Version 2.0
  15858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15859. var SuperMap = window.SuperMap = window.SuperMap || {};
  15860. SuperMap.Components = window.SuperMap.Components || {};
  15861. ;// CONCATENATED MODULE: ./src/common/REST.js
  15862. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15863. * This program are made available under the terms of the Apache License, Version 2.0
  15864. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15865. /**
  15866. * @enum DataFormat
  15867. * @description 服务请求返回结果数据类型
  15868. * @category BaseTypes Constant
  15869. * @type {string}
  15870. * @usage
  15871. * ```
  15872. * // 浏览器
  15873. * <script type="text/javascript" src="{cdn}"></script>
  15874. * <script>
  15875. * const result = {namespace}.DataFormat.GEOJSON;
  15876. *
  15877. * </script>
  15878. * // ES6 Import
  15879. * import { DataFormat } from '{npm}';
  15880. *
  15881. * const result = DataFormat.GEOJSON;
  15882. * ```
  15883. */
  15884. var DataFormat = {
  15885. /** GEOJSON */
  15886. GEOJSON: "GEOJSON",
  15887. /** ISERVER */
  15888. ISERVER: "ISERVER",
  15889. /** FGB */
  15890. FGB: "FGB"
  15891. };
  15892. /**
  15893. * @enum ServerType
  15894. * @description 服务器类型
  15895. * @category BaseTypes Constant
  15896. * @type {string}
  15897. * @usage
  15898. * ```
  15899. * // 浏览器
  15900. * <script type="text/javascript" src="{cdn}"></script>
  15901. * <script>
  15902. * const result = {namespace}.ServerType.ISERVER;
  15903. *
  15904. * </script>
  15905. * // ES6 Import
  15906. * import { ServerType } from '{npm}';
  15907. *
  15908. * const result = ServerType.ISERVER;
  15909. * ```
  15910. */
  15911. var ServerType = {
  15912. /** ISERVER */
  15913. ISERVER: "ISERVER",
  15914. /** IPORTAL */
  15915. IPORTAL: "IPORTAL",
  15916. /** ONLINE */
  15917. ONLINE: "ONLINE"
  15918. };
  15919. /**
  15920. * @enum GeometryType
  15921. * @description 几何对象枚举,定义了一系列几何对象类型。
  15922. * @category BaseTypes Constant
  15923. * @type {string}
  15924. * @usage
  15925. * ```
  15926. * // 浏览器
  15927. * <script type="text/javascript" src="{cdn}"></script>
  15928. * <script>
  15929. * const result = {namespace}.GeometryType.LINE;
  15930. *
  15931. * </script>
  15932. * // ES6 Import
  15933. * import { GeometryType } from '{npm}';
  15934. *
  15935. * const result = GeometryType.LINE;
  15936. * ```
  15937. */
  15938. var REST_GeometryType = {
  15939. /** 线几何对象类型。 */
  15940. LINE: "LINE",
  15941. /** 路由对象。 */
  15942. LINEM: "LINEM",
  15943. /** 点几何对象类型。 */
  15944. POINT: "POINT",
  15945. /** 面几何对象类型。 */
  15946. REGION: "REGION",
  15947. /** EPS点几何对象。 */
  15948. POINTEPS: "POINTEPS",
  15949. /** EPS线几何对象。 */
  15950. LINEEPS: "LINEEPS",
  15951. /** EPS面几何对象。 */
  15952. REGIONEPS: "REGIONEPS",
  15953. /** 椭圆。 */
  15954. ELLIPSE: "ELLIPSE",
  15955. /** 圆。 */
  15956. CIRCLE: "CIRCLE",
  15957. /** 文本几何对象类型。 */
  15958. TEXT: "TEXT",
  15959. /** 矩形。 */
  15960. RECTANGLE: "RECTANGLE",
  15961. /** 未定义。 */
  15962. UNKNOWN: "UNKNOWN",
  15963. /** 复合几何对象类型。 */
  15964. GEOCOMPOUND:"GEOCOMPOUND"
  15965. };
  15966. /**
  15967. * @enum QueryOption
  15968. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  15969. * @category BaseTypes Constant
  15970. * @type {string}
  15971. * @usage
  15972. * ```
  15973. * // 浏览器
  15974. * <script type="text/javascript" src="{cdn}"></script>
  15975. * <script>
  15976. * const result = {namespace}.QueryOption.ATTRIBUTE;
  15977. *
  15978. * </script>
  15979. * // ES6 Import
  15980. * import { QueryOption } from '{npm}';
  15981. *
  15982. * const result = QueryOption.ATTRIBUTE;
  15983. * ```
  15984. */
  15985. var QueryOption = {
  15986. /** 属性。 */
  15987. ATTRIBUTE: "ATTRIBUTE",
  15988. /** 属性和几何对象。 */
  15989. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  15990. /** 几何对象。 */
  15991. GEOMETRY: "GEOMETRY"
  15992. };
  15993. /**
  15994. * @enum JoinType
  15995. * @description 关联查询时的关联类型常量。
  15996. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  15997. * @category BaseTypes Constant
  15998. * @type {string}
  15999. * @usage
  16000. * ```
  16001. * // 浏览器
  16002. * <script type="text/javascript" src="{cdn}"></script>
  16003. * <script>
  16004. * const result = {namespace}.JoinType.INNERJOIN;
  16005. *
  16006. * </script>
  16007. * // ES6 Import
  16008. * import { JoinType } from '{npm}';
  16009. *
  16010. * const result = JoinType.INNERJOIN;
  16011. * ```
  16012. */
  16013. var JoinType = {
  16014. /** 内连接。 */
  16015. INNERJOIN: "INNERJOIN",
  16016. /** 左连接。 */
  16017. LEFTJOIN: "LEFTJOIN"
  16018. };
  16019. /**
  16020. * @enum SpatialQueryMode
  16021. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  16022. * @category BaseTypes Constant
  16023. * @type {string}
  16024. * @usage
  16025. * ```
  16026. * // 浏览器
  16027. * <script type="text/javascript" src="{cdn}"></script>
  16028. * <script>
  16029. * const result = {namespace}.SpatialQueryMode.CONTAIN;
  16030. *
  16031. * </script>
  16032. * // ES6 Import
  16033. * import { SpatialQueryMode } from '{npm}';
  16034. *
  16035. * const result = SpatialQueryMode.CONTAIN;
  16036. * ```
  16037. */
  16038. var SpatialQueryMode = {
  16039. /** 包含空间查询模式。 */
  16040. CONTAIN: "CONTAIN",
  16041. /** 交叉空间查询模式。 */
  16042. CROSS: "CROSS",
  16043. /** 分离空间查询模式。 */
  16044. DISJOINT: "DISJOINT",
  16045. /** 重合空间查询模式。 */
  16046. IDENTITY: "IDENTITY",
  16047. /** 相交空间查询模式。 */
  16048. INTERSECT: "INTERSECT",
  16049. /** 无空间查询。 */
  16050. NONE: "NONE",
  16051. /** 叠加空间查询模式。 */
  16052. OVERLAP: "OVERLAP",
  16053. /** 邻接空间查询模式。 */
  16054. TOUCH: "TOUCH",
  16055. /** 被包含空间查询模式。 */
  16056. WITHIN: "WITHIN"
  16057. };
  16058. /**
  16059. * @enum SpatialRelationType
  16060. * @description 数据集对象间的空间关系枚举。
  16061. * 该类定义了数据集对象间的空间关系类型常量。
  16062. * @category BaseTypes Constant
  16063. * @type {string}
  16064. * @usage
  16065. * ```
  16066. * // 浏览器
  16067. * <script type="text/javascript" src="{cdn}"></script>
  16068. * <script>
  16069. * const result = {namespace}.SpatialRelationType.CONTAIN;
  16070. *
  16071. * </script>
  16072. * // ES6 Import
  16073. * import { SpatialRelationType } from '{npm}';
  16074. *
  16075. * const result = {namespace}.SpatialRelationType.CONTAIN;
  16076. * ```
  16077. */
  16078. var SpatialRelationType = {
  16079. /** 包含关系。 */
  16080. CONTAIN: "CONTAIN",
  16081. /** 相交关系。 */
  16082. INTERSECT: "INTERSECT",
  16083. /** 被包含关系。 */
  16084. WITHIN: "WITHIN"
  16085. };
  16086. /**
  16087. * @enum MeasureMode
  16088. * @type {string}
  16089. * @description 量算模式枚举。
  16090. * @category BaseTypes Constant
  16091. * 该类定义了两种测量模式:距离测量和面积测量。
  16092. * @usage
  16093. * ```
  16094. * // 浏览器
  16095. * <script type="text/javascript" src="{cdn}"></script>
  16096. * <script>
  16097. * const result = {namespace}.MeasureMode.DISTANCE;
  16098. *
  16099. * </script>
  16100. * // ES6 Import
  16101. * import { MeasureMode } from '{npm}';
  16102. *
  16103. * const result = MeasureMode.DISTANCE;
  16104. * ```
  16105. */
  16106. var MeasureMode = {
  16107. /** 距离测量。 */
  16108. DISTANCE: "DISTANCE",
  16109. /** 面积测量。 */
  16110. AREA: "AREA"
  16111. };
  16112. /**
  16113. * @enum Unit
  16114. * @description 距离单位枚举。
  16115. * 该类定义了一系列距离单位类型。
  16116. * @category BaseTypes Constant
  16117. * @type {string}
  16118. * @usage
  16119. * ```
  16120. * // 浏览器
  16121. * <script type="text/javascript" src="{cdn}"></script>
  16122. * <script>
  16123. * const result = {namespace}.Unit.METER;
  16124. *
  16125. * </script>
  16126. * // ES6 Import
  16127. * import { Unit } from '{npm}';
  16128. *
  16129. * const result = Unit.METER;
  16130. * ```
  16131. */
  16132. var Unit = {
  16133. /** 米。 */
  16134. METER: "METER",
  16135. /** 千米。 */
  16136. KILOMETER: "KILOMETER",
  16137. /** 英里。 */
  16138. MILE: "MILE",
  16139. /** 码。 */
  16140. YARD: "YARD",
  16141. /** 度。 */
  16142. DEGREE: "DEGREE",
  16143. /** 毫米。 */
  16144. MILLIMETER: "MILLIMETER",
  16145. /** 厘米。 */
  16146. CENTIMETER: "CENTIMETER",
  16147. /** 英寸。 */
  16148. INCH: "INCH",
  16149. /** 分米。 */
  16150. DECIMETER: "DECIMETER",
  16151. /** 英尺。 */
  16152. FOOT: "FOOT",
  16153. /** 秒。 */
  16154. SECOND: "SECOND",
  16155. /** 分。 */
  16156. MINUTE: "MINUTE",
  16157. /** 弧度。 */
  16158. RADIAN: "RADIAN"
  16159. };
  16160. /**
  16161. * @enum BufferRadiusUnit
  16162. * @description 缓冲区距离单位枚举。该类定义了一系列缓冲距离单位类型。
  16163. * @category BaseTypes Constant
  16164. * @type {string}
  16165. * @usage
  16166. * ```
  16167. * // 浏览器
  16168. * <script type="text/javascript" src="{cdn}"></script>
  16169. * <script>
  16170. * const result = {namespace}.BufferRadiusUnit.CENTIMETER;
  16171. *
  16172. * </script>
  16173. * // ES6 Import
  16174. * import { BufferRadiusUnit } from '{npm}';
  16175. *
  16176. * const result = BufferRadiusUnit.CENTIMETER;
  16177. * ```
  16178. */
  16179. var BufferRadiusUnit = {
  16180. /** 厘米。 */
  16181. CENTIMETER: "CENTIMETER",
  16182. /** 分米。 */
  16183. DECIMETER: "DECIMETER",
  16184. /** 英尺。 */
  16185. FOOT: "FOOT",
  16186. /** 英寸。 */
  16187. INCH: "INCH",
  16188. /** 千米。 */
  16189. KILOMETER: "KILOMETER",
  16190. /** 米。 */
  16191. METER: "METER",
  16192. /** 英里。 */
  16193. MILE: "MILE",
  16194. /** 毫米。 */
  16195. MILLIMETER: "MILLIMETER",
  16196. /** 码。 */
  16197. YARD: "YARD"
  16198. }
  16199. /**
  16200. * @enum EngineType
  16201. * @description 数据源引擎类型枚举。
  16202. * @category BaseTypes Constant
  16203. * @type {string}
  16204. * @usage
  16205. * ```
  16206. * // 浏览器
  16207. * <script type="text/javascript" src="{cdn}"></script>
  16208. * <script>
  16209. * const result = {namespace}.EngineType.IMAGEPLUGINS;
  16210. *
  16211. * </script>
  16212. * // ES6 Import
  16213. * import { EngineType } from '{npm}';
  16214. *
  16215. * const result = EngineType.IMAGEPLUGINS;
  16216. * ```
  16217. */
  16218. var EngineType = {
  16219. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  16220. IMAGEPLUGINS: "IMAGEPLUGINS",
  16221. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  16222. OGC: "OGC",
  16223. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  16224. ORACLEPLUS: "ORACLEPLUS",
  16225. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  16226. SDBPLUS: "SDBPLUS",
  16227. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎。 */
  16228. SQLPLUS: "SQLPLUS",
  16229. /** UDB 引擎类型,文件引擎。 */
  16230. UDB: "UDB"
  16231. };
  16232. /**
  16233. * @enum ThemeGraphTextFormat
  16234. * @description 统计专题图文本显示格式枚举。
  16235. * @category BaseTypes Constant
  16236. * @type {string}
  16237. * @usage
  16238. * ```
  16239. * // 浏览器
  16240. * <script type="text/javascript" src="{cdn}"></script>
  16241. * <script>
  16242. * const result = {namespace}.ThemeGraphTextFormat.CAPTION;
  16243. *
  16244. * </script>
  16245. * // ES6 Import
  16246. * import { ThemeGraphTextFormat } from '{npm}';
  16247. *
  16248. * const result = ThemeGraphTextFormat.CAPTION;
  16249. * ```
  16250. */
  16251. var ThemeGraphTextFormat = {
  16252. /** 标题。以各子项的标题来进行标注。 */
  16253. CAPTION: "CAPTION",
  16254. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  16255. CAPTION_PERCENT: "CAPTION_PERCENT",
  16256. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  16257. CAPTION_VALUE: "CAPTION_VALUE",
  16258. /** 百分数。以各子项所占的百分比来进行标注。 */
  16259. PERCENT: "PERCENT",
  16260. /** 实际数值。以各子项的真实数值来进行标注。 */
  16261. VALUE: "VALUE"
  16262. };
  16263. /**
  16264. * @enum ThemeGraphType
  16265. * @description 统计专题图类型枚举。
  16266. * @category BaseTypes Constant
  16267. * @type {string}
  16268. * @usage
  16269. * ```
  16270. * // 浏览器
  16271. * <script type="text/javascript" src="{cdn}"></script>
  16272. * <script>
  16273. * const result = {namespace}.ThemeGraphType.AREA;
  16274. *
  16275. * </script>
  16276. * // ES6 Import
  16277. * import { ThemeGraphType } from '{npm}';
  16278. *
  16279. * const result = ThemeGraphType.AREA;
  16280. * ```
  16281. */
  16282. var ThemeGraphType = {
  16283. /** 面积图。 */
  16284. AREA: "AREA",
  16285. /** 柱状图。 */
  16286. BAR: "BAR",
  16287. /** 三维柱状图。 */
  16288. BAR3D: "BAR3D",
  16289. /** 折线图。 */
  16290. LINE: "LINE",
  16291. /** 饼图。 */
  16292. PIE: "PIE",
  16293. /** 三维饼图。 */
  16294. PIE3D: "PIE3D",
  16295. /** 点状图。 */
  16296. POINT: "POINT",
  16297. /** 环状图。 */
  16298. RING: "RING",
  16299. /** 玫瑰图。 */
  16300. ROSE: "ROSE",
  16301. /** 三维玫瑰图。 */
  16302. ROSE3D: "ROSE3D",
  16303. /** 堆叠柱状图。 */
  16304. STACK_BAR: "STACK_BAR",
  16305. /** 三维堆叠柱状图。 */
  16306. STACK_BAR3D: "STACK_BAR3D",
  16307. /** 阶梯图。 */
  16308. STEP: "STEP"
  16309. };
  16310. /**
  16311. * @enum GraphAxesTextDisplayMode
  16312. * @description 统计专题图坐标轴文本显示模式。
  16313. * @category BaseTypes Constant
  16314. * @type {string}
  16315. * @usage
  16316. * ```
  16317. * // 浏览器
  16318. * <script type="text/javascript" src="{cdn}"></script>
  16319. * <script>
  16320. * const result = {namespace}.GraphAxesTextDisplayMode.ALL;
  16321. *
  16322. * </script>
  16323. * // ES6 Import
  16324. * import { GraphAxesTextDisplayMode } from '{npm}';
  16325. *
  16326. * const result = GraphAxesTextDisplayMode.ALL;
  16327. * ```
  16328. */
  16329. var GraphAxesTextDisplayMode = {
  16330. /** 显示全部文本。 */
  16331. ALL: "ALL",
  16332. /** 不显示。 */
  16333. NONE: "NONE",
  16334. /** 显示Y轴的文本。 */
  16335. YAXES: "YAXES"
  16336. };
  16337. /**
  16338. * @enum GraduatedMode
  16339. * @description 专题图分级模式枚举。
  16340. * @category BaseTypes Constant
  16341. * @type {string}
  16342. * @usage
  16343. * ```
  16344. * // 浏览器
  16345. * <script type="text/javascript" src="{cdn}"></script>
  16346. * <script>
  16347. * const result = {namespace}.GraduatedMode.CONSTANT;
  16348. *
  16349. * </script>
  16350. * // ES6 Import
  16351. * import { GraduatedMode } from '{npm}';
  16352. *
  16353. * const result = GraduatedMode.CONSTANT;
  16354. * ```
  16355. */
  16356. var GraduatedMode = {
  16357. /** 常量分级模式。 */
  16358. CONSTANT: "CONSTANT",
  16359. /** 对数分级模式。 */
  16360. LOGARITHM: "LOGARITHM",
  16361. /** 平方根分级模式。 */
  16362. SQUAREROOT: "SQUAREROOT"
  16363. };
  16364. /**
  16365. * @enum RangeMode
  16366. * @description 范围分段专题图分段方式枚举。
  16367. * @category BaseTypes Constant
  16368. * @type {string}
  16369. * @usage
  16370. * ```
  16371. * // 浏览器
  16372. * <script type="text/javascript" src="{cdn}"></script>
  16373. * <script>
  16374. * const result = {namespace}.RangeMode.CUSTOMINTERVAL;
  16375. *
  16376. * </script>
  16377. * // ES6 Import
  16378. * import { RangeMode } from '{npm}';
  16379. *
  16380. * const result = RangeMode.CUSTOMINTERVAL;
  16381. * ```
  16382. */
  16383. var RangeMode = {
  16384. /** 自定义分段法。 */
  16385. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  16386. /** 等距离分段法。 */
  16387. EQUALINTERVAL: "EQUALINTERVAL",
  16388. /** 对数分段法。 */
  16389. LOGARITHM: "LOGARITHM",
  16390. /** 等计数分段法。 */
  16391. QUANTILE: "QUANTILE",
  16392. /** 平方根分段法。 */
  16393. SQUAREROOT: "SQUAREROOT",
  16394. /** 标准差分段法。 */
  16395. STDDEVIATION: "STDDEVIATION"
  16396. };
  16397. /**
  16398. * @enum ThemeType
  16399. * @description 专题图类型枚举。
  16400. * @category BaseTypes Constant
  16401. * @type {string}
  16402. * @usage
  16403. * ```
  16404. * // 浏览器
  16405. * <script type="text/javascript" src="{cdn}"></script>
  16406. * <script>
  16407. * const result = {namespace}.ThemeType.DOTDENSITY;
  16408. *
  16409. * </script>
  16410. * // ES6 Import
  16411. * import { ThemeType } from '{npm}';
  16412. *
  16413. * const result = ThemeType.DOTDENSITY;
  16414. * ```
  16415. */
  16416. var ThemeType = {
  16417. /** 点密度专题图。 */
  16418. DOTDENSITY: "DOTDENSITY",
  16419. /** 等级符号专题图。 */
  16420. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  16421. /** 统计专题图。 */
  16422. GRAPH: "GRAPH",
  16423. /** 标签专题图。 */
  16424. LABEL: "LABEL",
  16425. /** 分段专题图。 */
  16426. RANGE: "RANGE",
  16427. /** 単值专题图。 */
  16428. UNIQUE: "UNIQUE"
  16429. };
  16430. /**
  16431. * @enum ColorGradientType
  16432. * @description 渐变颜色枚举。
  16433. * @category BaseTypes Constant
  16434. * @type {string}
  16435. * @usage
  16436. * ```
  16437. * // 浏览器
  16438. * <script type="text/javascript" src="{cdn}"></script>
  16439. * <script>
  16440. * const result = {namespace}.ColorGradientType.BLACK_WHITE;
  16441. *
  16442. * </script>
  16443. * // ES6 Import
  16444. * import { ColorGradientType } from '{npm}';
  16445. *
  16446. * const result = ColorGradientType.BLACK_WHITE;
  16447. * ```
  16448. */
  16449. var ColorGradientType = {
  16450. /** 黑白渐变色。 */
  16451. BLACK_WHITE: "BLACKWHITE",
  16452. /** 蓝黑渐变色。 */
  16453. BLUE_BLACK: "BLUEBLACK",
  16454. /** 蓝红渐变色。 */
  16455. BLUE_RED: "BLUERED",
  16456. /** 蓝白渐变色。 */
  16457. BLUE_WHITE: "BLUEWHITE",
  16458. /** 青黑渐变色。 */
  16459. CYAN_BLACK: "CYANBLACK",
  16460. /** 青蓝渐变色。 */
  16461. CYAN_BLUE: "CYANBLUE",
  16462. /** 青绿渐变色。 */
  16463. CYAN_GREEN: "CYANGREEN",
  16464. /** 青白渐变色。 */
  16465. CYAN_WHITE: "CYANWHITE",
  16466. /** 绿黑渐变色。 */
  16467. GREEN_BLACK: "GREENBLACK",
  16468. /** 绿蓝渐变色。 */
  16469. GREEN_BLUE: "GREENBLUE",
  16470. /** 绿橙紫渐变色。 */
  16471. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  16472. /** 绿红渐变色。 */
  16473. GREEN_RED: "GREENRED",
  16474. /** 蓝红渐变色。 */
  16475. GREEN_WHITE: "GREENWHITE",
  16476. /** 粉黑渐变色。 */
  16477. PINK_BLACK: "PINKBLACK",
  16478. /** 粉蓝渐变色。 */
  16479. PINK_BLUE: "PINKBLUE",
  16480. /** 粉红渐变色。 */
  16481. PINK_RED: "PINKRED",
  16482. /** 粉白渐变色。 */
  16483. PINK_WHITE: "PINKWHITE",
  16484. /** 彩虹色。 */
  16485. RAIN_BOW: "RAINBOW",
  16486. /** 红黑渐变色。 */
  16487. RED_BLACK: "REDBLACK",
  16488. /** 红白渐变色。 */
  16489. RED_WHITE: "REDWHITE",
  16490. /** 光谱渐变。 */
  16491. SPECTRUM: "SPECTRUM",
  16492. /** 地形渐变,用于三维显示效果较好。 */
  16493. TERRAIN: "TERRAIN",
  16494. /** 黄黑渐变色。 */
  16495. YELLOW_BLACK: "YELLOWBLACK",
  16496. /** 黄蓝渐变色。 */
  16497. YELLOW_BLUE: "YELLOWBLUE",
  16498. /** 黄绿渐变色。 */
  16499. YELLOW_GREEN: "YELLOWGREEN",
  16500. /** 黄红渐变色。 */
  16501. YELLOW_RED: "YELLOWRED",
  16502. /** 黄白渐变色。 */
  16503. YELLOW_WHITE: "YELLOWWHITE"
  16504. };
  16505. /**
  16506. * @enum TextAlignment
  16507. * @description 文本对齐枚举。
  16508. * @category BaseTypes Constant
  16509. * @type {string}
  16510. * @usage
  16511. * ```
  16512. * // 浏览器
  16513. * <script type="text/javascript" src="{cdn}"></script>
  16514. * <script>
  16515. * const result = {namespace}.TextAlignment.TOPLEFT;
  16516. *
  16517. * </script>
  16518. * // ES6 Import
  16519. * import { TextAlignment } from '{npm}';
  16520. *
  16521. * const result = TextAlignment.TOPLEFT;
  16522. * ```
  16523. */
  16524. var TextAlignment = {
  16525. /** 左上角对齐。 */
  16526. TOPLEFT: "TOPLEFT",
  16527. /** 顶部居中对齐。 */
  16528. TOPCENTER: "TOPCENTER",
  16529. /** 右上角对齐。 */
  16530. TOPRIGHT: "TOPRIGHT",
  16531. /** 基准线左对齐。 */
  16532. BASELINELEFT: "BASELINELEFT",
  16533. /** 基准线居中对齐。 */
  16534. BASELINECENTER: "BASELINECENTER",
  16535. /** 基准线右对齐。 */
  16536. BASELINERIGHT: "BASELINERIGHT",
  16537. /** 左下角对齐。 */
  16538. BOTTOMLEFT: "BOTTOMLEFT",
  16539. /** 底部居中对齐。 */
  16540. BOTTOMCENTER: "BOTTOMCENTER",
  16541. /** 右下角对齐。 */
  16542. BOTTOMRIGHT: "BOTTOMRIGHT",
  16543. /** 左中对齐。 */
  16544. MIDDLELEFT: "MIDDLELEFT",
  16545. /** 中心对齐。 */
  16546. MIDDLECENTER: "MIDDLECENTER",
  16547. /** 右中对齐。 */
  16548. MIDDLERIGHT: "MIDDLERIGHT"
  16549. };
  16550. /**
  16551. * @enum FillGradientMode
  16552. * @description 渐变填充风格的渐变类型枚举。
  16553. * @category BaseTypes Constant
  16554. * @type {string}
  16555. * @usage
  16556. * ```
  16557. * // 浏览器
  16558. * <script type="text/javascript" src="{cdn}"></script>
  16559. * <script>
  16560. * const result = {namespace}.FillGradientMode.NONE;
  16561. *
  16562. * </script>
  16563. * // ES6 Import
  16564. * import { FillGradientMode } from '{npm}';
  16565. *
  16566. * const result = FillGradientMode.NONE;
  16567. * ```
  16568. */
  16569. var FillGradientMode = {
  16570. /** 无渐变。 */
  16571. NONE: "NONE",
  16572. /** 线性渐变填充。 */
  16573. LINEAR: "LINEAR",
  16574. /** 辐射渐变填充。 */
  16575. RADIAL: "RADIAL",
  16576. /** 圆锥渐变填充。 */
  16577. CONICAL: "CONICAL",
  16578. /** 四角渐变填充。 */
  16579. SQUARE: "SQUARE"
  16580. };
  16581. /**
  16582. * @enum AlongLineDirection
  16583. * @description 标签沿线标注方向枚举。
  16584. * @category BaseTypes Constant
  16585. * @type {string}
  16586. * @usage
  16587. * ```
  16588. * // 浏览器
  16589. * <script type="text/javascript" src="{cdn}"></script>
  16590. * <script>
  16591. * const result = {namespace}.AlongLineDirection.NORMAL;
  16592. *
  16593. * </script>
  16594. * // ES6 Import
  16595. * import { AlongLineDirection } from '{npm}';
  16596. *
  16597. * const result = AlongLineDirection.NORMAL;
  16598. * ```
  16599. */
  16600. var AlongLineDirection = {
  16601. /** 沿线的法线方向放置标签。 */
  16602. NORMAL: "ALONG_LINE_NORMAL",
  16603. /** 从下到上,从左到右放置。 */
  16604. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  16605. /** 从上到下,从左到右放置。 */
  16606. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  16607. /** 从下到上,从右到左放置。 */
  16608. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  16609. /** 从上到下,从右到左放置。 */
  16610. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  16611. };
  16612. /**
  16613. * @enum LabelBackShape
  16614. * @description 标签专题图中标签背景的形状枚举。
  16615. * @category BaseTypes Constant
  16616. * @type {string}
  16617. * @usage
  16618. * ```
  16619. * // 浏览器
  16620. * <script type="text/javascript" src="{cdn}"></script>
  16621. * <script>
  16622. * const result = {namespace}.LabelBackShape.DIAMOND;
  16623. *
  16624. * </script>
  16625. * // ES6 Import
  16626. * import { LabelBackShape } from '{npm}';
  16627. *
  16628. * const result = LabelBackShape.DIAMOND;
  16629. * ```
  16630. */
  16631. var LabelBackShape = {
  16632. /** 菱形背景,即标签背景的形状为菱形。 */
  16633. DIAMOND: "DIAMOND",
  16634. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  16635. ELLIPSE: "ELLIPSE",
  16636. /** 符号背景,即标签背景的形状为设定的符号。 */
  16637. MARKER: "MARKER",
  16638. /** 空背景,即不使用任何形状作为标签的背景。 */
  16639. NONE: "NONE",
  16640. /** 矩形背景,即标签背景的形状为矩形。 */
  16641. RECT: "RECT",
  16642. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  16643. ROUNDRECT: "ROUNDRECT",
  16644. /** 三角形背景,即标签背景的形状为三角形。 */
  16645. TRIANGLE: "TRIANGLE"
  16646. };
  16647. /**
  16648. * @enum LabelOverLengthMode
  16649. * @description 标签专题图中超长标签的处理模式枚举。
  16650. * @category BaseTypes Constant
  16651. * @type {string}
  16652. * @usage
  16653. * ```
  16654. * // 浏览器
  16655. * <script type="text/javascript" src="{cdn}"></script>
  16656. * <script>
  16657. * const result = {namespace}.LabelOverLengthMode.NEWLINE;
  16658. *
  16659. * </script>
  16660. * // ES6 Import
  16661. * import { LabelOverLengthMode } from '{npm}';
  16662. *
  16663. * const result = LabelOverLengthMode.NEWLINE;
  16664. * ```
  16665. */
  16666. var LabelOverLengthMode = {
  16667. /** 换行显示。 */
  16668. NEWLINE: "NEWLINE",
  16669. /** 对超长标签不进行处理。 */
  16670. NONE: "NONE",
  16671. /** 省略超出部分。 */
  16672. OMIT: "OMIT"
  16673. };
  16674. /**
  16675. * @enum DirectionType
  16676. * @description 网络分析中方向枚举。
  16677. * 在行驶引导子项中使用。
  16678. * @category BaseTypes Constant
  16679. * @type {string}
  16680. * @usage
  16681. * ```
  16682. * // 浏览器
  16683. * <script type="text/javascript" src="{cdn}"></script>
  16684. * <script>
  16685. * const result = {namespace}.DirectionType.EAST;
  16686. *
  16687. * </script>
  16688. * // ES6 Import
  16689. * import { DirectionType } from '{npm}';
  16690. *
  16691. * const result = DirectionType.EAST;
  16692. * ```
  16693. */
  16694. var DirectionType = {
  16695. /** 东。 */
  16696. EAST: "EAST",
  16697. /** 无方向。 */
  16698. NONE: "NONE",
  16699. /** 北。 */
  16700. NORTH: "NORTH",
  16701. /** 南。 */
  16702. SOURTH: "SOURTH",
  16703. /** 西。 */
  16704. WEST: "WEST"
  16705. };
  16706. /**
  16707. * @enum SideType
  16708. * @description 行驶位置枚举。
  16709. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  16710. * @category BaseTypes Constant
  16711. * @type {string}
  16712. * @usage
  16713. * ```
  16714. * // 浏览器
  16715. * <script type="text/javascript" src="{cdn}"></script>
  16716. * <script>
  16717. * const result = {namespace}.SideType.LEFT;
  16718. *
  16719. * </script>
  16720. * // ES6 Import
  16721. * import { SideType } from '{npm}';
  16722. *
  16723. * const result = SideType.LEFT;
  16724. * ```
  16725. */
  16726. var SideType = {
  16727. /** 路的左侧。 */
  16728. LEFT: "LEFT",
  16729. /** 在路上(即路的中间)。 */
  16730. MIDDLE: "MIDDLE",
  16731. /** 无效值。 */
  16732. NONE: "NONE",
  16733. /** 路的右侧。 */
  16734. RIGHT: "RIGHT"
  16735. };
  16736. /**
  16737. * @enum SupplyCenterType
  16738. * @description 资源供给中心类型枚举。
  16739. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  16740. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  16741. * @category BaseTypes Constant
  16742. * @type {string}
  16743. * @usage
  16744. * ```
  16745. * // 浏览器
  16746. * <script type="text/javascript" src="{cdn}"></script>
  16747. * <script>
  16748. * const result = {namespace}.SupplyCenterType.FIXEDCENTER;
  16749. *
  16750. * </script>
  16751. * // ES6 Import
  16752. * import { SupplyCenterType } from '{npm}';
  16753. *
  16754. * const result = SupplyCenterType.FIXEDCENTER;
  16755. * ```
  16756. */
  16757. var SupplyCenterType = {
  16758. /** 固定中心点。 */
  16759. FIXEDCENTER: "FIXEDCENTER",
  16760. /** 非中心点。 */
  16761. NULL: "NULL",
  16762. /** 可选中心点。 */
  16763. OPTIONALCENTER: "OPTIONALCENTER"
  16764. };
  16765. /**
  16766. * @enum TurnType
  16767. * @description 转弯方向枚举。
  16768. * 用在行驶引导子项类中,表示转弯的方向。
  16769. * @category BaseTypes Constant
  16770. * @type {string}
  16771. * @usage
  16772. * ```
  16773. * // 浏览器
  16774. * <script type="text/javascript" src="{cdn}"></script>
  16775. * <script>
  16776. * const result = {namespace}.TurnType.AHEAD;
  16777. *
  16778. * </script>
  16779. * // ES6 Import
  16780. * import { TurnType } from '{npm}';
  16781. *
  16782. * const result = TurnType.AHEAD;
  16783. * ```
  16784. */
  16785. var TurnType = {
  16786. /** 向前直行。 */
  16787. AHEAD: "AHEAD",
  16788. /** 掉头。 */
  16789. BACK: "BACK",
  16790. /** 终点,不拐弯。 */
  16791. END: "END",
  16792. /** 左转弯。 */
  16793. LEFT: "LEFT",
  16794. /** 无效值。 */
  16795. NONE: "NONE",
  16796. /** 右转弯。 */
  16797. RIGHT: "RIGHT"
  16798. };
  16799. /**
  16800. * @enum BufferEndType
  16801. * @description 缓冲区分析BufferEnd类型。
  16802. * @category BaseTypes Constant
  16803. * @type {string}
  16804. * @usage
  16805. * ```
  16806. * // 浏览器
  16807. * <script type="text/javascript" src="{cdn}"></script>
  16808. * <script>
  16809. * const result = {namespace}.BufferEndType.FLAT;
  16810. *
  16811. * </script>
  16812. * // ES6 Import
  16813. * import { BufferEndType } from '{npm}';
  16814. *
  16815. * const result = BufferEndType.FLAT;
  16816. * ```
  16817. */
  16818. var BufferEndType = {
  16819. /** 平头缓冲。 */
  16820. FLAT: "FLAT",
  16821. /** 圆头缓冲。 */
  16822. ROUND: "ROUND"
  16823. };
  16824. /**
  16825. * @enum OverlayOperationType
  16826. * @description 叠加分析类型枚举。
  16827. * @category BaseTypes Constant
  16828. * @type {string}
  16829. * @usage
  16830. * ```
  16831. * // 浏览器
  16832. * <script type="text/javascript" src="{cdn}"></script>
  16833. * <script>
  16834. * const result = {namespace}.OverlayOperationType.CLIP;
  16835. *
  16836. * </script>
  16837. * // ES6 Import
  16838. * import { OverlayOperationType } from '{npm}';
  16839. *
  16840. * const result = OverlayOperationType.CLIP;
  16841. * ```
  16842. */
  16843. var OverlayOperationType = {
  16844. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  16845. CLIP: "CLIP",
  16846. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  16847. ERASE: "ERASE",
  16848. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  16849. IDENTITY: "IDENTITY",
  16850. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  16851. INTERSECT: "INTERSECT",
  16852. /** 对两个面数据集(几何对象)进行合并操作。 */
  16853. UNION: "UNION",
  16854. /** 对两个面数据集(几何对象)进行更新操作。 */
  16855. UPDATE: "UPDATE",
  16856. /** 对两个面数据集(几何对象)进行对称差操作。 */
  16857. XOR: "XOR"
  16858. };
  16859. /**
  16860. * @enum OutputType
  16861. * @description 分布式分析输出类型枚举。
  16862. * @category BaseTypes Constant
  16863. * @type {string}
  16864. * @usage
  16865. * ```
  16866. * // 浏览器
  16867. * <script type="text/javascript" src="{cdn}"></script>
  16868. * <script>
  16869. * const result = {namespace}.OutputType.INDEXEDHDFS;
  16870. *
  16871. * </script>
  16872. * // ES6 Import
  16873. * import { OutputType } from '{npm}';
  16874. *
  16875. * const result = OutputType.INDEXEDHDFS;
  16876. * ```
  16877. */
  16878. var OutputType = {
  16879. /** INDEXEDHDFS */
  16880. INDEXEDHDFS: "INDEXEDHDFS",
  16881. /** UDB */
  16882. UDB: "UDB",
  16883. /** MONGODB */
  16884. MONGODB: "MONGODB",
  16885. /** PG */
  16886. PG: "PG"
  16887. };
  16888. /**
  16889. * @enum SmoothMethod
  16890. * @description 光滑方法枚举。
  16891. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  16892. * @category BaseTypes Constant
  16893. * @type {string}
  16894. * @usage
  16895. * ```
  16896. * // 浏览器
  16897. * <script type="text/javascript" src="{cdn}"></script>
  16898. * <script>
  16899. * const result = {namespace}.SmoothMethod.BSPLINE;
  16900. *
  16901. * </script>
  16902. * // ES6 Import
  16903. * import { SmoothMethod } from '{npm}';
  16904. *
  16905. * const result = SmoothMethod.BSPLINE;
  16906. * ```
  16907. */
  16908. var SmoothMethod = {
  16909. /** B 样条法。 */
  16910. BSPLINE: "BSPLINE",
  16911. /** 磨角法。 */
  16912. POLISH: "POLISH"
  16913. };
  16914. /**
  16915. * @enum SurfaceAnalystMethod
  16916. * @description 表面分析方法枚举。
  16917. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  16918. * @category BaseTypes Constant
  16919. * @type {string}
  16920. * @usage
  16921. * ```
  16922. * // 浏览器
  16923. * <script type="text/javascript" src="{cdn}"></script>
  16924. * <script>
  16925. * const result = {namespace}.SurfaceAnalystMethod.ISOLINE;
  16926. *
  16927. * </script>
  16928. * // ES6 Import
  16929. * import { SurfaceAnalystMethod } from '{npm}';
  16930. *
  16931. * const result = SurfaceAnalystMethod.ISOLINE;
  16932. * ```
  16933. */
  16934. var SurfaceAnalystMethod = {
  16935. /** 等值线提取。 */
  16936. ISOLINE: "ISOLINE",
  16937. /** 等值面提取。 */
  16938. ISOREGION: "ISOREGION"
  16939. };
  16940. /**
  16941. * @enum DataReturnMode
  16942. * @description 数据返回模式枚举。
  16943. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  16944. * @category BaseTypes Constant
  16945. * @type {string}
  16946. * @usage
  16947. * ```
  16948. * // 浏览器
  16949. * <script type="text/javascript" src="{cdn}"></script>
  16950. * <script>
  16951. * const result = {namespace}.DataReturnMode.DATASET_AND_RECORDSET;
  16952. *
  16953. * </script>
  16954. * // ES6 Import
  16955. * import { DataReturnMode } from '{npm}';
  16956. *
  16957. * const result = DataReturnMode.DATASET_AND_RECORDSET;
  16958. * ```
  16959. */
  16960. var DataReturnMode = {
  16961. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  16962. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  16963. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  16964. DATASET_ONLY: "DATASET_ONLY",
  16965. /** 只返回记录集(RecordSet)。 */
  16966. RECORDSET_ONLY: "RECORDSET_ONLY"
  16967. };
  16968. /**
  16969. * @enum EditType
  16970. * @description 要素集更新模式枚举。
  16971. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  16972. * @category BaseTypes Constant
  16973. * @type {string}
  16974. * @usage
  16975. * ```
  16976. * // 浏览器
  16977. * <script type="text/javascript" src="{cdn}"></script>
  16978. * <script>
  16979. * const result = {namespace}.EditType.ADD;
  16980. *
  16981. * </script>
  16982. * // ES6 Import
  16983. * import { EditType } from '{npm}';
  16984. *
  16985. * const result = {namespace}.EditType.ADD;
  16986. * ```
  16987. */
  16988. var EditType = {
  16989. /** 增加操作。 */
  16990. ADD: "add",
  16991. /** 修改操作。 */
  16992. UPDATE: "update",
  16993. /** 删除操作。 */
  16994. DELETE: "delete"
  16995. };
  16996. /**
  16997. * @enum TransferTactic
  16998. * @description 公交换乘策略枚举。
  16999. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  17000. * @category BaseTypes Constant
  17001. * @type {string}
  17002. * @usage
  17003. * ```
  17004. * // 浏览器
  17005. * <script type="text/javascript" src="{cdn}"></script>
  17006. * <script>
  17007. * const result = {namespace}.TransferTactic.LESS_TIME;
  17008. *
  17009. * </script>
  17010. * // ES6 Import
  17011. * import { TransferTactic } from '{npm}';
  17012. *
  17013. * const result = TransferTactic.LESS_TIME;
  17014. * ```
  17015. */
  17016. var TransferTactic = {
  17017. /** 时间短。 */
  17018. LESS_TIME: "LESS_TIME",
  17019. /** 少换乘。 */
  17020. LESS_TRANSFER: "LESS_TRANSFER",
  17021. /** 少步行。 */
  17022. LESS_WALK: "LESS_WALK",
  17023. /** 距离最短。 */
  17024. MIN_DISTANCE: "MIN_DISTANCE"
  17025. };
  17026. /**
  17027. * @enum TransferPreference
  17028. * @description 公交换乘策略枚举。
  17029. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  17030. * @category BaseTypes Constant
  17031. * @type {string}
  17032. * @usage
  17033. * ```
  17034. * // 浏览器
  17035. * <script type="text/javascript" src="{cdn}"></script>
  17036. * <script>
  17037. * const result = {namespace}.TransferPreference.BUS;
  17038. *
  17039. * </script>
  17040. * // ES6 Import
  17041. * import { TransferPreference } from '{npm}';
  17042. *
  17043. * const result = TransferPreference.BUS;
  17044. * ```
  17045. */
  17046. var TransferPreference = {
  17047. /** 公交汽车优先。 */
  17048. BUS: "BUS",
  17049. /** 地铁优先。 */
  17050. SUBWAY: "SUBWAY",
  17051. /** 不乘坐地铁。 */
  17052. NO_SUBWAY: "NO_SUBWAY",
  17053. /** 无乘车偏好。 */
  17054. NONE: "NONE"
  17055. };
  17056. /**
  17057. * @enum GridType
  17058. * @description 地图背景格网类型枚举。
  17059. * @category BaseTypes Constant
  17060. * @type {string}
  17061. * @usage
  17062. * ```
  17063. * // 浏览器
  17064. * <script type="text/javascript" src="{cdn}"></script>
  17065. * <script>
  17066. * const result = {namespace}.GridType.CROSS;
  17067. *
  17068. * </script>
  17069. * // ES6 Import
  17070. * import { GridType } from '{npm}';
  17071. *
  17072. * const result = GridType.CROSS;
  17073. * ```
  17074. */
  17075. var GridType = {
  17076. /** 十字叉丝。 */
  17077. CROSS: "CROSS",
  17078. /** 网格线。 */
  17079. GRID: "GRID",
  17080. /** 点。 */
  17081. POINT: "POINT"
  17082. };
  17083. /**
  17084. * @enum ColorSpaceType
  17085. * @description 色彩空间枚举。
  17086. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  17087. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  17088. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  17089. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  17090. * @category BaseTypes Constant
  17091. * @type {string}
  17092. * @usage
  17093. * ```
  17094. * // 浏览器
  17095. * <script type="text/javascript" src="{cdn}"></script>
  17096. * <script>
  17097. * const result = {namespace}.ColorSpaceType.CMYK;
  17098. *
  17099. * </script>
  17100. * // ES6 Import
  17101. * import { ColorSpaceType } from '{npm}';
  17102. *
  17103. * const result = ColorSpaceType.CMYK;
  17104. * ```
  17105. */
  17106. var ColorSpaceType = {
  17107. /** 该类型主要在印刷系统使用。 */
  17108. CMYK: "CMYK",
  17109. /** 该类型主要在显示系统中使用。 */
  17110. RGB: "RGB"
  17111. };
  17112. /**
  17113. * @enum LayerType
  17114. * @description 图层类型。
  17115. * @category BaseTypes Constant
  17116. * @type {string}
  17117. * @usage
  17118. * ```
  17119. * // 浏览器
  17120. * <script type="text/javascript" src="{cdn}"></script>
  17121. * <script>
  17122. * const result = {namespace}.LayerType.UGC;
  17123. *
  17124. * </script>
  17125. * // ES6 Import
  17126. * import { LayerType } from '{npm}';
  17127. *
  17128. * const result = LayerType.UGC;
  17129. * ```
  17130. */
  17131. var LayerType = {
  17132. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  17133. UGC: "UGC",
  17134. /** WMS 图层。 */
  17135. WMS: "WMS",
  17136. /** WFS 图层。 */
  17137. WFS: "WFS",
  17138. /** 自定义图层。 */
  17139. CUSTOM: "CUSTOM"
  17140. };
  17141. /**
  17142. * @enum UGCLayerType
  17143. * @description SuperMap 图层类型。
  17144. * @category BaseTypes Constant
  17145. * @type {string}
  17146. * @usage
  17147. * ```
  17148. * // 浏览器
  17149. * <script type="text/javascript" src="{cdn}"></script>
  17150. * <script>
  17151. * const result = {namespace}.UGCLayerType.THEME;
  17152. *
  17153. * </script>
  17154. * // ES6 Import
  17155. * import { UGCLayerType } from '{npm}';
  17156. *
  17157. * const result = UGCLayerType.THEME;
  17158. * ```
  17159. */
  17160. var UGCLayerType = {
  17161. /** 专题图层。 */
  17162. THEME: "THEME",
  17163. /** 矢量图层。 */
  17164. VECTOR: "VECTOR",
  17165. /** 栅格图层。 */
  17166. GRID: "GRID",
  17167. /** 影像图层。 */
  17168. IMAGE: "IMAGE"
  17169. };
  17170. /**
  17171. * @enum StatisticMode
  17172. * @description 字段统计方法类型。
  17173. * @category BaseTypes Constant
  17174. * @type {string}
  17175. * @usage
  17176. * ```
  17177. * // 浏览器
  17178. * <script type="text/javascript" src="{cdn}"></script>
  17179. * <script>
  17180. * const result = {namespace}.StatisticMode.AVERAGE;
  17181. *
  17182. * </script>
  17183. * // ES6 Import
  17184. * import { StatisticMode } from '{npm}';
  17185. *
  17186. * const result = StatisticMode.AVERAGE;
  17187. * ```
  17188. */
  17189. var StatisticMode = {
  17190. /** 统计所选字段的平均值。 */
  17191. AVERAGE: "AVERAGE",
  17192. /** 统计所选字段的最大值。 */
  17193. MAX: "MAX",
  17194. /** 统计所选字段的最小值。 */
  17195. MIN: "MIN",
  17196. /** 统计所选字段的标准差 */
  17197. STDDEVIATION: "STDDEVIATION",
  17198. /** 统计所选字段的总和。 */
  17199. SUM: "SUM",
  17200. /** 统计所选字段的方差。 */
  17201. VARIANCE: "VARIANCE"
  17202. };
  17203. /**
  17204. * @enum PixelFormat
  17205. * @description 栅格与影像数据存储的像素格式枚举。
  17206. * @category BaseTypes Constant
  17207. * @type {string}
  17208. * @usage
  17209. * ```
  17210. * // 浏览器
  17211. * <script type="text/javascript" src="{cdn}"></script>
  17212. * <script>
  17213. * const result = {namespace}.PixelFormat.BIT16;
  17214. *
  17215. * </script>
  17216. * // ES6 Import
  17217. * import { PixelFormat } from '{npm}';
  17218. *
  17219. * const result = PixelFormat.BIT16;
  17220. * ```
  17221. */
  17222. var PixelFormat = {
  17223. /** 每个像元用16个比特(即2个字节)表示。 */
  17224. BIT16: "BIT16",
  17225. /** 每个像元用32个比特(即4个字节)表示。 */
  17226. BIT32: "BIT32",
  17227. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  17228. BIT64: "BIT64",
  17229. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  17230. SINGLE: "SINGLE",
  17231. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  17232. DOUBLE: "DOUBLE",
  17233. /** 每个像元用1个比特表示。 */
  17234. UBIT1: "UBIT1",
  17235. /** 每个像元用4个比特来表示。 */
  17236. UBIT4: "UBIT4",
  17237. /** 每个像元用8个比特(即1个字节)来表示。 */
  17238. UBIT8: "UBIT8",
  17239. /** 每个像元用24个比特(即3个字节)来表示。 */
  17240. UBIT24: "UBIT24",
  17241. /** 每个像元用32个比特(即4个字节)来表示。 */
  17242. UBIT32: "UBIT32"
  17243. };
  17244. /**
  17245. * @enum SearchMode
  17246. * @description 内插时使用的样本点的查找方式枚举。
  17247. * @category BaseTypes Constant
  17248. * @type {string}
  17249. * @usage
  17250. * ```
  17251. * // 浏览器
  17252. * <script type="text/javascript" src="{cdn}"></script>
  17253. * <script>
  17254. * const result = {namespace}.SearchMode.KDTREE_FIXED_COUNT;
  17255. *
  17256. * </script>
  17257. * // ES6 Import
  17258. * import { SearchMode } from '{npm}';
  17259. *
  17260. * const result = SearchMode.KDTREE_FIXED_COUNT;
  17261. * ```
  17262. */
  17263. var SearchMode = {
  17264. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  17265. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  17266. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  17267. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  17268. /** 不进行查找,使用所有的输入点进行内插分析。 */
  17269. NONE: "NONE",
  17270. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  17271. QUADTREE: "QUADTREE"
  17272. };
  17273. /**
  17274. * @enum InterpolationAlgorithmType
  17275. * @description 插值分析的算法的类型。
  17276. * @category BaseTypes Constant
  17277. * @type {string}
  17278. * @usage
  17279. * ```
  17280. * // 浏览器
  17281. * <script type="text/javascript" src="{cdn}"></script>
  17282. * <script>
  17283. * const result = {namespace}.InterpolationAlgorithmType.KRIGING;
  17284. *
  17285. * </script>
  17286. * // ES6 Import
  17287. * import { InterpolationAlgorithmType } from '{npm}';
  17288. *
  17289. * const result = InterpolationAlgorithmType.KRIGING;
  17290. * ```
  17291. */
  17292. var InterpolationAlgorithmType = {
  17293. /** 普通克吕金插值法。 */
  17294. KRIGING: "KRIGING",
  17295. /** 简单克吕金插值法。 */
  17296. SimpleKriging: "SimpleKriging",
  17297. /** 泛克吕金插值法。 */
  17298. UniversalKriging: "UniversalKriging"
  17299. };
  17300. /**
  17301. * @enum VariogramMode
  17302. * @description 克吕金(Kriging)插值时的半变函数类型枚举。
  17303. * @category BaseTypes Constant
  17304. * @type {string}
  17305. * @usage
  17306. * ```
  17307. * // 浏览器
  17308. * <script type="text/javascript" src="{cdn}"></script>
  17309. * <script>
  17310. * const result = {namespace}.VariogramMode.EXPONENTIAL;
  17311. *
  17312. * </script>
  17313. * // ES6 Import
  17314. * import { VariogramMode } from '{npm}';
  17315. *
  17316. * const result = VariogramMode.EXPONENTIAL;
  17317. * ```
  17318. */
  17319. var VariogramMode = {
  17320. /** 指数函数。 */
  17321. EXPONENTIAL: "EXPONENTIAL",
  17322. /** 高斯函数。 */
  17323. GAUSSIAN: "GAUSSIAN",
  17324. /** 球型函数。 */
  17325. SPHERICAL: "SPHERICAL"
  17326. };
  17327. /**
  17328. * @enum Exponent
  17329. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数。
  17330. * @category BaseTypes Constant
  17331. * @type {string}
  17332. * @usage
  17333. * ```
  17334. * // 浏览器
  17335. * <script type="text/javascript" src="{cdn}"></script>
  17336. * <script>
  17337. * const result = {namespace}.Exponent.EXP1;
  17338. *
  17339. * </script>
  17340. * // ES6 Import
  17341. * import { Exponent } from '{npm}';
  17342. *
  17343. * const result = Exponent.EXP1;
  17344. * ```
  17345. */
  17346. var Exponent = {
  17347. /** 阶数为1。 */
  17348. EXP1: "EXP1",
  17349. /** 阶数为2。 */
  17350. EXP2: "EXP2"
  17351. };
  17352. /**
  17353. * @enum ClientType
  17354. * @description token申请的客户端标识类型。
  17355. * @category BaseTypes Constant
  17356. * @type {string}
  17357. * @usage
  17358. * ```
  17359. * // 浏览器
  17360. * <script type="text/javascript" src="{cdn}"></script>
  17361. * <script>
  17362. * const result = {namespace}.ClientType.IP;
  17363. *
  17364. * </script>
  17365. * // ES6 Import
  17366. * import { ClientType } from '{npm}';
  17367. *
  17368. * const result = ClientType.IP;
  17369. * ```
  17370. */
  17371. var ClientType = {
  17372. /** 指定的 IP 地址。 */
  17373. IP: "IP",
  17374. /** 指定的 URL。 */
  17375. REFERER: "Referer",
  17376. /** 发送申请令牌请求的客户端 IP。 */
  17377. REQUESTIP: "RequestIP",
  17378. /** 不做任何验证。 */
  17379. NONE: "NONE",
  17380. /** SERVER。 */
  17381. SERVER: "SERVER",
  17382. /** WEB。 */
  17383. WEB: "WEB"
  17384. };
  17385. /**
  17386. * @enum ChartType
  17387. * @description 客户端专题图图表类型。
  17388. * @category BaseTypes Constant
  17389. * @type {string}
  17390. * @usage
  17391. * ```
  17392. * // 浏览器
  17393. * <script type="text/javascript" src="{cdn}"></script>
  17394. * <script>
  17395. * const result = {namespace}.ChartType.BAR;
  17396. *
  17397. * </script>
  17398. * // ES6 Import
  17399. * import { ChartType } from '{npm}';
  17400. *
  17401. * const result = ChartType.BAR;
  17402. * ```
  17403. */
  17404. var ChartType = {
  17405. /** 柱状图。 */
  17406. BAR: "Bar",
  17407. /** 三维柱状图。 */
  17408. BAR3D: "Bar3D",
  17409. /** 圆形图。 */
  17410. CIRCLE: "Circle",
  17411. /** 饼图。 */
  17412. PIE: "Pie",
  17413. /** 散点图。 */
  17414. POINT: "Point",
  17415. /** 折线图。 */
  17416. LINE: "Line",
  17417. /** 环状图。 */
  17418. RING: "Ring"
  17419. };
  17420. /**
  17421. * @enum ClipAnalystMode
  17422. * @description 裁剪分析模式
  17423. * @category BaseTypes Constant
  17424. * @type {string}
  17425. * @usage
  17426. * ```
  17427. * // 浏览器
  17428. * <script type="text/javascript" src="{cdn}"></script>
  17429. * <script>
  17430. * const result = {namespace}.ClipAnalystMode.CLIP;
  17431. *
  17432. * </script>
  17433. * // ES6 Import
  17434. * import { ClipAnalystMode } from '{npm}';
  17435. *
  17436. * const result = ClipAnalystMode.CLIP;
  17437. * ```
  17438. */
  17439. var ClipAnalystMode = {
  17440. /** CLIP。 */
  17441. CLIP: "clip",
  17442. /** INTERSECT。 */
  17443. INTERSECT: "intersect"
  17444. };
  17445. /**
  17446. * @enum AnalystAreaUnit
  17447. * @description 分布式分析面积单位。
  17448. * @category BaseTypes Constant
  17449. * @type {string}
  17450. * @usage
  17451. * ```
  17452. * // 浏览器
  17453. * <script type="text/javascript" src="{cdn}"></script>
  17454. * <script>
  17455. * const result = {namespace}.AnalystAreaUnit.SQUAREMETER;
  17456. *
  17457. * </script>
  17458. * // ES6 Import
  17459. * import { AnalystAreaUnit } from '{npm}';
  17460. *
  17461. * const result = AnalystAreaUnit.SQUAREMETER;
  17462. * ```
  17463. */
  17464. var AnalystAreaUnit = {
  17465. /** 平方米。 */
  17466. "SQUAREMETER": "SquareMeter",
  17467. /** 平方千米。 */
  17468. "SQUAREKILOMETER": "SquareKiloMeter",
  17469. /** 公顷。 */
  17470. "HECTARE": "Hectare",
  17471. /** 公亩。 */
  17472. "ARE": "Are",
  17473. /** 英亩。 */
  17474. "ACRE": "Acre",
  17475. /** 平方英尺。 */
  17476. "SQUAREFOOT": "SquareFoot",
  17477. /** 平方码。 */
  17478. "SQUAREYARD": "SquareYard",
  17479. /** 平方英里。 */
  17480. "SQUAREMILE": "SquareMile"
  17481. };
  17482. /**
  17483. * @enum AnalystSizeUnit
  17484. * @description 分布式分析单位。
  17485. * @category BaseTypes Constant
  17486. * @type {string}
  17487. * @usage
  17488. * ```
  17489. * // 浏览器
  17490. * <script type="text/javascript" src="{cdn}"></script>
  17491. * <script>
  17492. * const result = {namespace}.AnalystSizeUnit.METER;
  17493. *
  17494. * </script>
  17495. * // ES6 Import
  17496. * import { AnalystSizeUnit } from '{npm}';
  17497. *
  17498. * const result = AnalystSizeUnit.METER;
  17499. * ```
  17500. */
  17501. var AnalystSizeUnit = {
  17502. /** 米。 */
  17503. "METER": "Meter",
  17504. /** 千米。 */
  17505. "KILOMETER": "Kilometer",
  17506. /** 码。 */
  17507. "YARD": "Yard",
  17508. /** 英尺。 */
  17509. "FOOT": "Foot",
  17510. /** 英里。 */
  17511. "MILE": "Mile"
  17512. };
  17513. /**
  17514. * @enum StatisticAnalystMode
  17515. * @description 分布式分析统计模式。
  17516. * @category BaseTypes Constant
  17517. * @type {string}
  17518. * @usage
  17519. * ```
  17520. * // 浏览器
  17521. * <script type="text/javascript" src="{cdn}"></script>
  17522. * <script>
  17523. * const result = {namespace}.StatisticAnalystMode.MAX;
  17524. *
  17525. * </script>
  17526. * // ES6 Import
  17527. * import { StatisticAnalystMode } from '{npm}';
  17528. *
  17529. * const result = StatisticAnalystMode.MAX;
  17530. * ```
  17531. */
  17532. var StatisticAnalystMode = {
  17533. /** 统计所选字段的最大值。 */
  17534. "MAX": "max",
  17535. /** 统计所选字段的最小值。 */
  17536. "MIN": "min",
  17537. /** 统计所选字段的平均值。 */
  17538. "AVERAGE": "average",
  17539. /** 统计所选字段的总和。 */
  17540. "SUM": "sum",
  17541. /** 统计所选字段的方差。 */
  17542. "VARIANCE": "variance",
  17543. /** 统计所选字段的标准差。 */
  17544. "STDDEVIATION": "stdDeviation"
  17545. };
  17546. /**
  17547. * @enum SummaryType
  17548. * @description 分布式分析聚合类型。
  17549. * @category BaseTypes Constant
  17550. * @type {string}
  17551. * @usage
  17552. * ```
  17553. * // 浏览器
  17554. * <script type="text/javascript" src="{cdn}"></script>
  17555. * <script>
  17556. * const result = {namespace}.SummaryType.SUMMARYMESH;
  17557. *
  17558. * </script>
  17559. * // ES6 Import
  17560. * import { SummaryType } from '{npm}';
  17561. *
  17562. * const result = SummaryType.SUMMARYMESH;
  17563. * ```
  17564. */
  17565. var SummaryType = {
  17566. /** 格网聚合。 */
  17567. "SUMMARYMESH": "SUMMARYMESH",
  17568. /** 多边形聚合。 */
  17569. "SUMMARYREGION": "SUMMARYREGION"
  17570. };
  17571. /**
  17572. * @enum TopologyValidatorRule
  17573. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  17574. * @category BaseTypes Constant
  17575. * @type {string}
  17576. * @usage
  17577. * ```
  17578. * // 浏览器
  17579. * <script type="text/javascript" src="{cdn}"></script>
  17580. * <script>
  17581. * const result = {namespace}.TopologyValidatorRule.REGIONNOOVERLAP;
  17582. *
  17583. * </script>
  17584. * // ES6 Import
  17585. * import { TopologyValidatorRule } from '{npm}';
  17586. *
  17587. * const result = TopologyValidatorRule.REGIONNOOVERLAP;
  17588. * ```
  17589. */
  17590. var TopologyValidatorRule = {
  17591. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  17592. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  17593. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  17594. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  17595. /** 面被面包含,用于对面数据进行拓扑检查。 */
  17596. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  17597. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  17598. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  17599. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  17600. LINENOOVERLAP: "LINENOOVERLAP",
  17601. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  17602. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  17603. /** 点不相同,用于对点数据进行拓扑检查。 */
  17604. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  17605. };
  17606. /**
  17607. * @enum BucketAggType
  17608. * @description 格网聚合查询枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
  17609. * @category BaseTypes Constant
  17610. * @type {string}
  17611. * @usage
  17612. * ```
  17613. * // 浏览器
  17614. * <script type="text/javascript" src="{cdn}"></script>
  17615. * <script>
  17616. * const result = {namespace}.BucketAggType.GEOHASH_GRID;
  17617. *
  17618. * </script>
  17619. * // ES6 Import
  17620. * import { BucketAggType } from '{npm}';
  17621. *
  17622. * const result = BucketAggType.GEOHASH_GRID;
  17623. * ```
  17624. */
  17625. var BucketAggType = {
  17626. /** 格网聚合类型。 */
  17627. GEOHASH_GRID: "geohash_grid"
  17628. };
  17629. /**
  17630. * @enum MetricsAggType
  17631. * @description 指标聚合类型枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量。
  17632. * @category BaseTypes Constant
  17633. * @type {string}
  17634. * @usage
  17635. * ```
  17636. * // 浏览器
  17637. * <script type="text/javascript" src="{cdn}"></script>
  17638. * <script>
  17639. * const result = {namespace}.MetricsAggType.AVG;
  17640. *
  17641. * </script>
  17642. * // ES6 Import
  17643. * import { MetricsAggType } from '{npm}';
  17644. *
  17645. * const result = MetricsAggType.AVG;
  17646. * ```
  17647. */
  17648. var MetricsAggType = {
  17649. /** 平均值聚合类型。 */
  17650. AVG:'avg',
  17651. /** 最大值聚合类型。 */
  17652. MAX:'max',
  17653. /** 最小值聚合类型。 */
  17654. MIN:'min',
  17655. /** 求和聚合类型。 */
  17656. SUM:'sum'
  17657. };
  17658. /**
  17659. * @enum GetFeatureMode
  17660. * @description feature 查询方式。
  17661. * @category BaseTypes Constant
  17662. * @type {string}
  17663. * @usage
  17664. * ```
  17665. * // 浏览器
  17666. * <script type="text/javascript" src="{cdn}"></script>
  17667. * <script>
  17668. * const result = {namespace}.GetFeatureMode.BOUNDS;
  17669. *
  17670. * </script>
  17671. * // ES6 Import
  17672. * import { GetFeatureMode } from '{npm}';
  17673. *
  17674. * const result = GetFeatureMode.BOUNDS;
  17675. * ```
  17676. */
  17677. var GetFeatureMode = {
  17678. /** 通过范围查询来获取要素。 */
  17679. BOUNDS: "BOUNDS",
  17680. /** 通过几何对象的缓冲区来获取要素。 */
  17681. BUFFER: "BUFFER",
  17682. /** 通过 ID 来获取要素。 */
  17683. ID: "ID",
  17684. /** 通过空间查询模式来获取要素。 */
  17685. SPATIAL: "SPATIAL",
  17686. /** 通过 SQL 查询来获取要素。 */
  17687. SQL: 'SQL'
  17688. }
  17689. /**
  17690. * @enum RasterFunctionType
  17691. * @description 栅格分析方法。
  17692. * @category BaseTypes Constant
  17693. * @type {string}
  17694. * @usage
  17695. * ```
  17696. * // 浏览器
  17697. * <script type="text/javascript" src="{cdn}"></script>
  17698. * <script>
  17699. * const result = {namespace}.GetFeatureMode.NDVI;
  17700. *
  17701. * </script>
  17702. * // ES6 Import
  17703. * import { GetFeatureMode } from '{npm}';
  17704. *
  17705. * const result = GetFeatureMode.NDVI;
  17706. * ```
  17707. */
  17708. var RasterFunctionType = {
  17709. /** 归一化植被指数。 */
  17710. NDVI: "NDVI",
  17711. /** 阴影面分析。 */
  17712. HILLSHADE: "HILLSHADE"
  17713. }
  17714. /**
  17715. * @enum ResourceType
  17716. * @description iportal资源类型。
  17717. * @category BaseTypes Constant
  17718. * @version 10.0.1
  17719. * @type {string}
  17720. * @usage
  17721. * ```
  17722. * // 浏览器
  17723. * <script type="text/javascript" src="{cdn}"></script>
  17724. * <script>
  17725. * const result = {namespace}.GetFeatureMode.MAP;
  17726. *
  17727. * </script>
  17728. * // ES6 Import
  17729. * import { GetFeatureMode } from '{npm}';
  17730. *
  17731. * const result = GetFeatureMode.MAP;
  17732. * ```
  17733. */
  17734. var ResourceType = {
  17735. /** 地图。 */
  17736. MAP: "MAP",
  17737. /** 服务。 */
  17738. SERVICE: "SERVICE",
  17739. /** 场景。 */
  17740. SCENE: "SCENE",
  17741. /** 数据。 */
  17742. DATA: "DATA",
  17743. /** 洞察。 */
  17744. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  17745. /** 大屏。 */
  17746. MAP_DASHBOARD: "MAP_DASHBOARD"
  17747. }
  17748. /**
  17749. * @enum OrderBy
  17750. * @description iportal资源排序字段。
  17751. * @category BaseTypes Constant
  17752. * @version 10.0.1
  17753. * @type {string}
  17754. * @usage
  17755. * ```
  17756. * // 浏览器
  17757. * <script type="text/javascript" src="{cdn}"></script>
  17758. * <script>
  17759. * const result = {namespace}.OrderBy.UPDATETIME;
  17760. *
  17761. * </script>
  17762. * // ES6 Import
  17763. * import { OrderBy } from '{npm}';
  17764. *
  17765. * const result = OrderBy.UPDATETIME;
  17766. * ```
  17767. */
  17768. var OrderBy = {
  17769. /** 按更新时间排序。 */
  17770. UPDATETIME: "UPDATETIME",
  17771. /** 按热度(可能是访问量、下载量)排序。 */
  17772. HEATLEVEL: "HEATLEVEL",
  17773. /** 按相关性排序。 */
  17774. RELEVANCE: "RELEVANCE"
  17775. }
  17776. /**
  17777. * @enum OrderType
  17778. * @description iportal资源升序还是降序过滤。
  17779. * @category BaseTypes Constant
  17780. * @version 10.0.1
  17781. * @type {string}
  17782. * @usage
  17783. * ```
  17784. * // 浏览器
  17785. * <script type="text/javascript" src="{cdn}"></script>
  17786. * <script>
  17787. * const result = {namespace}.OrderType.ASC;
  17788. *
  17789. * </script>
  17790. * // ES6 Import
  17791. * import { OrderType } from '{npm}';
  17792. *
  17793. * const result = OrderType.ASC;
  17794. * ```
  17795. */
  17796. var OrderType = {
  17797. /** 升序。 */
  17798. ASC: "ASC",
  17799. /** 降序。 */
  17800. DESC: "DESC"
  17801. }
  17802. /**
  17803. * @enum SearchType
  17804. * @description iportal资源查询的范围进行过滤。
  17805. * @category BaseTypes Constant
  17806. * @version 10.0.1
  17807. * @type {string}
  17808. * @usage
  17809. * ```
  17810. * // 浏览器
  17811. * <script type="text/javascript" src="{cdn}"></script>
  17812. * <script>
  17813. * const result = {namespace}.SearchType.PUBLIC;
  17814. *
  17815. * </script>
  17816. * // ES6 Import
  17817. * import { SearchType } from '{npm}';
  17818. *
  17819. * const result = SearchType.PUBLIC;
  17820. * ```
  17821. */
  17822. var SearchType = {
  17823. /** 公开资源。 */
  17824. PUBLIC: "PUBLIC",
  17825. /** 我的资源。 */
  17826. MY_RES: "MY_RES",
  17827. /** 我的群组资源。 */
  17828. MYGROUP_RES: "MYGROUP_RES",
  17829. /** 我的部门资源。 */
  17830. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  17831. /** 分享给我的资源。 */
  17832. SHARETOME_RES: "SHARETOME_RES"
  17833. }
  17834. /**
  17835. * @enum AggregationTypes
  17836. * @description iportal资源聚合查询的类型。
  17837. * @category BaseTypes Constant
  17838. * @version 10.0.1
  17839. * @type {string}
  17840. * @usage
  17841. * ```
  17842. * // 浏览器
  17843. * <script type="text/javascript" src="{cdn}"></script>
  17844. * <script>
  17845. * const result = {namespace}.AggregationTypes.TAG;
  17846. *
  17847. * </script>
  17848. * // ES6 Import
  17849. * import { AggregationTypes } from '{npm}';
  17850. *
  17851. * const result = AggregationTypes.TAG;
  17852. * ```
  17853. */
  17854. var AggregationTypes = {
  17855. /** 标签。 */
  17856. TAG: "TAG",
  17857. /** 资源类型。 */
  17858. TYPE: "TYPE"
  17859. }
  17860. /**
  17861. * @enum PermissionType
  17862. * @description iportal资源权限类型。
  17863. * @category BaseTypes Constant
  17864. * @version 10.0.1
  17865. * @type {string}
  17866. * @usage
  17867. * ```
  17868. * // 浏览器
  17869. * <script type="text/javascript" src="{cdn}"></script>
  17870. * <script>
  17871. * const result = {namespace}.PermissionType.SEARCH;
  17872. *
  17873. * </script>
  17874. * // ES6 Import
  17875. * import { PermissionType } from '{npm}';
  17876. *
  17877. * const result = PermissionType.SEARCH;
  17878. * ```
  17879. */
  17880. var PermissionType = {
  17881. /** 可检索。 */
  17882. SEARCH:"SEARCH",
  17883. /** 可查看。 */
  17884. READ: "READ",
  17885. /** 可编辑。 */
  17886. READWRITE: "READWRITE",
  17887. /** 可删除。 */
  17888. DELETE: "DELETE",
  17889. /** 可下载,包括可读、可检索。 */
  17890. DOWNLOAD:"DOWNLOAD"
  17891. }
  17892. /**
  17893. * @enum EntityType
  17894. * @description iportal资源实体类型。
  17895. * @category BaseTypes Constant
  17896. * @version 10.0.1
  17897. * @type {string}
  17898. * @usage
  17899. * ```
  17900. * // 浏览器
  17901. * <script type="text/javascript" src="{cdn}"></script>
  17902. * <script>
  17903. * const result = {namespace}.EntityType.DEPARTMENT;
  17904. *
  17905. * </script>
  17906. * // ES6 Import
  17907. * import { EntityType } from '{npm}';
  17908. *
  17909. * const result = EntityType.DEPARTMENT;
  17910. * ```
  17911. */
  17912. var EntityType = {
  17913. /** 部门。 */
  17914. DEPARTMENT: "DEPARTMENT",
  17915. /** 用户组。 */
  17916. GROUP: "GROUP",
  17917. /** 群组。 */
  17918. IPORTALGROUP: "IPORTALGROUP",
  17919. /** 角色。 */
  17920. ROLE: "ROLE",
  17921. /** 用户。 */
  17922. USER: "USER"
  17923. }
  17924. /**
  17925. * @enum DataItemType
  17926. * @description iportal数据类型。
  17927. * @category BaseTypes Constant
  17928. * @version 10.0.1
  17929. * @type {string}
  17930. * @usage
  17931. * ```
  17932. * // 浏览器
  17933. * <script type="text/javascript" src="{cdn}"></script>
  17934. * <script>
  17935. * const result = {namespace}.DataItemType.GEOJSON;
  17936. *
  17937. * </script>
  17938. * // ES6 Import
  17939. * import { DataItemType } from '{npm}';
  17940. *
  17941. * const result = DataItemType.GEOJSON;
  17942. * ```
  17943. */
  17944. var DataItemType = {
  17945. /** geojson 数据。 */
  17946. GEOJSON: "GEOJSON",
  17947. /** UGCV5_MVT。 */
  17948. UGCV5_MVT: "UGCV5_MVT",
  17949. /** json数据。 */
  17950. JSON: "JSON",
  17951. /** 音频文件。 */
  17952. AUDIO: "AUDIO",
  17953. /** Color 颜色。 */
  17954. COLOR: "COLOR",
  17955. /** ColorScheme 颜色方案。 */
  17956. COLORSCHEME: "COLORSCHEME",
  17957. /** CSV 数据。 */
  17958. CSV: "CSV",
  17959. /** EXCEL 数据。 */
  17960. EXCEL: "EXCEL",
  17961. /** FillSymbol 填充符号库。 */
  17962. FILLSYMBOL: "FILLSYMBOL",
  17963. /** 图片类型。 */
  17964. IMAGE: "IMAGE",
  17965. /** LayerTemplate 图层模板。 */
  17966. LAYERTEMPLATE: "LAYERTEMPLATE",
  17967. /** LayoutTemplate 布局模板。 */
  17968. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  17969. /** LineSymbol 线符号库。 */
  17970. LINESYMBOL: "LINESYMBOL",
  17971. /** MapTemplate 地图模板。 */
  17972. MAPTEMPLATE: "MAPTEMPLATE",
  17973. /** MarkerSymbol 点符号库。 */
  17974. MARKERSYMBOL: "MARKERSYMBOL",
  17975. /** MBTILES。 */
  17976. MBTILES: "MBTILES",
  17977. /** 照片。 */
  17978. PHOTOS: "PHOTOS",
  17979. /** SHP 空间数据。 */
  17980. SHP: "SHP",
  17981. /** SMTILES。 */
  17982. SMTILES: "SMTILES",
  17983. /** SVTILES。 */
  17984. SVTILES: "SVTILES",
  17985. /** ThemeTemplate 专题图模板。 */
  17986. THEMETEMPLATE: "THEMETEMPLATE",
  17987. /** TPK。 */
  17988. TPK: "TPK",
  17989. /** UDB 数据源。 */
  17990. UDB: "UDB",
  17991. /** UGCV5。 */
  17992. UGCV5: "UGCV5",
  17993. /** 其他类型(普通文件)。 */
  17994. UNKNOWN: "UNKNOWN",
  17995. /** 视频文件。 */
  17996. VIDEO: "VIDEO",
  17997. /** WorkEnviroment 工作环境。 */
  17998. WORKENVIRONMENT: "WORKENVIRONMENT",
  17999. /** 工作空间。 */
  18000. WORKSPACE: "WORKSPACE"
  18001. }
  18002. /**
  18003. * @enum WebExportFormatType
  18004. * @description Web 打印输出的格式。
  18005. * @category BaseTypes Constant
  18006. * @version 10.0.1
  18007. * @type {string}
  18008. * @usage
  18009. * ```
  18010. * // 浏览器
  18011. * <script type="text/javascript" src="{cdn}"></script>
  18012. * <script>
  18013. * const result = {namespace}.WebExportFormatType.PNG;
  18014. *
  18015. * </script>
  18016. * // ES6 Import
  18017. * import { WebExportFormatType } from '{npm}';
  18018. *
  18019. * const result = WebExportFormatType.PNG;
  18020. * ```
  18021. */
  18022. var WebExportFormatType = {
  18023. /** PNG */
  18024. PNG: "PNG",
  18025. /** PDF */
  18026. PDF: "PDF"
  18027. }
  18028. /**
  18029. * @enum WebScaleOrientationType
  18030. * @description Web 比例尺的方位样式。
  18031. * @category BaseTypes Constant
  18032. * @version 10.0.1
  18033. * @type {string}
  18034. * @usage
  18035. * ```
  18036. * // 浏览器
  18037. * <script type="text/javascript" src="{cdn}"></script>
  18038. * <script>
  18039. * const result = {namespace}.WebScaleOrientationType.HORIZONTALLABELSBELOW;
  18040. *
  18041. * </script>
  18042. * // ES6 Import
  18043. * import { WebScaleOrientationType } from '{npm}';
  18044. *
  18045. * const result = WebScaleOrientationType.HORIZONTALLABELSBELOW;
  18046. * ```
  18047. */
  18048. var WebScaleOrientationType = {
  18049. /** horizontal labels below. */
  18050. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  18051. /** horizontal labels above. */
  18052. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  18053. /** vertical labels left. */
  18054. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  18055. /** vertical labels right. */
  18056. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  18057. }
  18058. /**
  18059. * @enum WebScaleType
  18060. * @description Web 比例尺的样式。
  18061. * @category BaseTypes Constant
  18062. * @version 10.0.1
  18063. * @type {string}
  18064. * @usage
  18065. * ```
  18066. * // 浏览器
  18067. * <script type="text/javascript" src="{cdn}"></script>
  18068. * <script>
  18069. * const result = {namespace}.WebScaleType.LINE;
  18070. *
  18071. * </script>
  18072. * // ES6 Import
  18073. * import { WebScaleType } from '{npm}';
  18074. *
  18075. * const result = WebScaleType.LINE;
  18076. * ```
  18077. */
  18078. var WebScaleType = {
  18079. /** line. */
  18080. LINE: "LINE",
  18081. /** bar. */
  18082. BAR: "BAR",
  18083. /** bar sub. */
  18084. BAR_SUB: "BAR_SUB"
  18085. }
  18086. /**
  18087. * @enum WebScaleUnit
  18088. * @description Web 比例尺的单位制。
  18089. * @category BaseTypes Constant
  18090. * @version 10.0.1
  18091. * @type {string}
  18092. * @usage
  18093. * ```
  18094. * // 浏览器
  18095. * <script type="text/javascript" src="{cdn}"></script>
  18096. * <script>
  18097. * const result = {namespace}.WebScaleUnit.METER;
  18098. *
  18099. * </script>
  18100. * // ES6 Import
  18101. * import { WebScaleUnit } from '{npm}';
  18102. *
  18103. * const result = WebScaleUnit.METER;
  18104. * ```
  18105. */
  18106. var WebScaleUnit = {
  18107. /** 米。 */
  18108. METER: "METER",
  18109. /** 英尺。 */
  18110. FOOT: "FOOT",
  18111. /** 度。 */
  18112. DEGREES: "DEGREES"
  18113. }
  18114. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  18115. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18116. * This program are made available under the terms of the Apache License, Version 2.0
  18117. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18118. /**
  18119. * @class Size
  18120. * @deprecatedclass SuperMap.Size
  18121. * @category BaseTypes Style
  18122. * @classdesc 此类描绘一对高宽值的实例。
  18123. * @param {number} [w=0.0] - 宽度。
  18124. * @param {number} [h=0.0] - 高度。
  18125. *
  18126. * @example
  18127. * var size = new Size(31,46);
  18128. * @usage
  18129. */
  18130. class Size {
  18131. constructor(w, h) {
  18132. /**
  18133. * @member {number} [Size.prototype.w=0.0]
  18134. * @description 宽度。
  18135. */
  18136. this.w = w ? parseFloat(w) : 0.0;
  18137. /**
  18138. * @member {number} [Size.prototype.h=0.0]
  18139. * @description 高度。
  18140. */
  18141. this.h = w ? parseFloat(h) : 0.0;
  18142. this.CLASS_NAME = "SuperMap.Size";
  18143. }
  18144. /**
  18145. * @function Size.prototype.toString
  18146. * @description 返回字符串形式。
  18147. * @example
  18148. * var size = new Size(10,5);
  18149. * var str = size.toString();
  18150. * @returns {string} 例如:"w=10,h=5"。
  18151. */
  18152. toString() {
  18153. return ("w=" + this.w + ",h=" + this.h);
  18154. }
  18155. /**
  18156. * @function Size.prototype.clone
  18157. * @description 克隆当前size对象。
  18158. * @example
  18159. * var size = new Size(31,46);
  18160. * var size2 = size.clone();
  18161. * @returns {Size} 新的与当前 size 对象有相同宽、高的 Size 对象。
  18162. */
  18163. clone() {
  18164. return new Size(this.w, this.h);
  18165. }
  18166. /**
  18167. *
  18168. * @function Size.prototype.equals
  18169. * @description 比较两个 size 对象是否相等。
  18170. * @example
  18171. * var size = new Size(31,46);
  18172. * var size2 = new Size(31,46);
  18173. * var isEquals = size.equals(size2);
  18174. *
  18175. * @param {Size} sz - 用于比较相等的 Size 对象。
  18176. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  18177. *
  18178. */
  18179. equals(sz) {
  18180. var equals = false;
  18181. if (sz != null) {
  18182. equals = ((this.w === sz.w && this.h === sz.h) ||
  18183. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  18184. }
  18185. return equals;
  18186. }
  18187. /**
  18188. *
  18189. * @function Size.prototype.destroy
  18190. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  18191. * @example
  18192. * var size = new Size(31,46);
  18193. * size.destroy();
  18194. */
  18195. destroy() {
  18196. this.w = null;
  18197. this.h = null;
  18198. }
  18199. }
  18200. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  18201. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18202. * This program are made available under the terms of the Apache License, Version 2.0
  18203. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18204. /**
  18205. * @class Pixel
  18206. * @deprecatedclass SuperMap.Pixel
  18207. * @category BaseTypes Geometry
  18208. * @classdesc 用 x,y 坐标描绘屏幕坐标(像素点)。
  18209. * @param {number} [x=0.0] - x 坐标。
  18210. * @param {number} [y=0.0] - y 坐标。
  18211. * @param {Pixel.Mode} [mode=Pixel.Mode.LeftTop] - 坐标模式。
  18212. *
  18213. * @example
  18214. * //单独创建一个对象
  18215. * var pixcel = new Pixel(100,50);
  18216. *
  18217. * //依据 size 创建
  18218. * var size = new Size(21,25);
  18219. * var offset = new Pixel(-(size.w/2), -size.h);
  18220. * @usage
  18221. */
  18222. class Pixel {
  18223. constructor(x, y, mode) {
  18224. /**
  18225. * @member {number} [Pixel.prototype.x=0.0]
  18226. * @description x 坐标。
  18227. */
  18228. this.x = x ? parseFloat(x) : 0.0;
  18229. /**
  18230. * @member {number} [Pixel.prototype.y=0.0]
  18231. * @description y 坐标。
  18232. */
  18233. this.y = y ? parseFloat(y) : 0.0;
  18234. /**
  18235. * @member {Pixel.Mode} [Pixel.prototype.mode=Pixel.Mode.LeftTop]
  18236. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  18237. */
  18238. this.mode = mode;
  18239. this.CLASS_NAME = 'SuperMap.Pixel';
  18240. }
  18241. /**
  18242. * @function Pixel.prototype.toString
  18243. * @description 返回此对象的字符串形式。
  18244. * @example
  18245. *
  18246. * var pixcel = new Pixel(100,50);
  18247. * var str = pixcel.toString();
  18248. *
  18249. * @returns {string} 例如: "x=200.4,y=242.2"
  18250. */
  18251. toString() {
  18252. return 'x=' + this.x + ',y=' + this.y;
  18253. }
  18254. /**
  18255. * @function Pixel.prototype.clone
  18256. * @description 克隆当前的 pixel 对象。
  18257. * @example
  18258. * var pixcel = new Pixel(100,50);
  18259. * var pixcel2 = pixcel.clone();
  18260. * @returns {Pixel} 新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  18261. */
  18262. clone() {
  18263. return new Pixel(this.x, this.y, this.mode);
  18264. }
  18265. /**
  18266. * @function Pixel.prototype.equals
  18267. * @description 比较两 pixel 是否相等。
  18268. * @example
  18269. * var pixcel = new Pixel(100,50);
  18270. * var pixcel2 = new Pixel(100,50);
  18271. * var isEquals = pixcel.equals(pixcel2);
  18272. *
  18273. * @param {Pixel} px - 用于比较相等的 pixel 对象。
  18274. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  18275. */
  18276. equals(px) {
  18277. var equals = false;
  18278. if (px != null) {
  18279. equals = (this.x == px.x && this.y == px.y) || (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y));
  18280. }
  18281. return equals;
  18282. }
  18283. /**
  18284. * @function Pixel.prototype.distanceTo
  18285. * @description 返回两个 pixel 的距离。
  18286. * @example
  18287. * var pixcel = new Pixel(100,50);
  18288. * var pixcel2 = new Pixel(110,30);
  18289. * var distance = pixcel.distanceTo(pixcel2);
  18290. *
  18291. * @param {Pixel} px - 需要计算的 pixel。
  18292. * @returns {number} 作为参数传入的像素与当前像素点的距离。
  18293. */
  18294. distanceTo(px) {
  18295. return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
  18296. }
  18297. /**
  18298. * @function Pixel.prototype.add
  18299. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  18300. * @example
  18301. * var pixcel = new Pixel(100,50);
  18302. * //pixcel2是新的对象
  18303. * var pixcel2 = pixcel.add(20,30);
  18304. *
  18305. * @param {number} x - 传入的 x 值。
  18306. * @param {number} y - 传入的 y 值。
  18307. * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  18308. */
  18309. add(x, y) {
  18310. if (x == null || y == null) {
  18311. throw new TypeError('Pixel.add cannot receive null values');
  18312. }
  18313. return new Pixel(this.x + x, this.y + y);
  18314. }
  18315. /**
  18316. * @function Pixel.prototype.offset
  18317. * @description 通过传入的 {@link Pixel} 参数对原屏幕坐标进行偏移。
  18318. * @example
  18319. * var pixcel = new Pixel(100,50);
  18320. * var pixcel2 = new Pixel(130,20);
  18321. * //pixcel3 是新的对象
  18322. * var pixcel3 = pixcel.offset(pixcel2);
  18323. *
  18324. * @param {Pixel} px - 传入的 {@link Pixel} 对象。
  18325. * @returns {Pixel} 新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  18326. */
  18327. offset(px) {
  18328. var newPx = this.clone();
  18329. if (px) {
  18330. newPx = this.add(px.x, px.y);
  18331. }
  18332. return newPx;
  18333. }
  18334. /**
  18335. *
  18336. * @function Pixel.prototype.destroy
  18337. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  18338. * @example
  18339. * var pixcel = new Pixel(100,50);
  18340. * pixcel.destroy();
  18341. */
  18342. destroy() {
  18343. this.x = null;
  18344. this.y = null;
  18345. this.mode = null;
  18346. }
  18347. }
  18348. /**
  18349. * @enum Mode
  18350. * @memberOf Pixel
  18351. * @readonly
  18352. * @description 模式。
  18353. * @type {string}
  18354. */
  18355. Pixel.Mode = {
  18356. /** 左上模式。*/
  18357. LeftTop: 'lefttop',
  18358. /** 右上模式。 */
  18359. RightTop: 'righttop',
  18360. /** 右下模式。 */
  18361. RightBottom: 'rightbottom',
  18362. /** 左下模式。 */
  18363. LeftBottom: 'leftbottom'
  18364. };
  18365. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  18366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18367. * This program are made available under the terms of the Apache License, Version 2.0
  18368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18369. /**
  18370. * @function inherit
  18371. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  18372. * @param {Object} C - 继承的类。
  18373. * @param {Object} P - 被继承的父类。
  18374. * @private
  18375. */
  18376. var inheritExt = function (C, P) {
  18377. var F = function () {
  18378. };
  18379. F.prototype = P.prototype;
  18380. C.prototype = new F;
  18381. var i, l, o;
  18382. for (i = 2, l = arguments.length; i < l; i++) {
  18383. o = arguments[i];
  18384. if (typeof o === "function") {
  18385. o = o.prototype;
  18386. }
  18387. Util_Util.extend(C.prototype, o);
  18388. }
  18389. };
  18390. /**
  18391. * @function mixinExt
  18392. * @description 实现多重继承。
  18393. * @param {Class|Object} ...mixins - 继承的类。
  18394. * @private
  18395. */
  18396. var mixinExt = function (...mixins) {
  18397. class Mix {
  18398. constructor(options) {
  18399. for (var index = 0; index < mixins.length; index++) {
  18400. copyProperties(this, new mixins[index](options));
  18401. }
  18402. }
  18403. }
  18404. for (var index = 0; index < mixins.length; index++) {
  18405. var mixin = mixins[index];
  18406. copyProperties(Mix, mixin);
  18407. copyProperties(Mix.prototype, mixin.prototype);
  18408. copyProperties(Mix.prototype, new mixin());
  18409. }
  18410. return Mix;
  18411. function copyProperties(target, source) {
  18412. var ownKeys = Object.getOwnPropertyNames(source);
  18413. if (Object.getOwnPropertySymbols) {
  18414. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  18415. }
  18416. for (var index = 0; index < ownKeys.length; index++) {
  18417. var key = ownKeys[index];
  18418. if (key !== "constructor"
  18419. && key !== "prototype"
  18420. && key !== "name" && key !== "length") {
  18421. let desc = Object.getOwnPropertyDescriptor(source, key);
  18422. if (window["ActiveXObject"]) {
  18423. Object.defineProperty(target, key, desc || {});
  18424. } else {
  18425. Object.defineProperty(target, key, desc);
  18426. }
  18427. }
  18428. }
  18429. }
  18430. };
  18431. /**
  18432. * @name String
  18433. * @namespace
  18434. * @category BaseTypes Util
  18435. * @description 字符串操作的一系列常用扩展函数。
  18436. * @private
  18437. */
  18438. var StringExt = {
  18439. /**
  18440. * @function StringExt.startsWith
  18441. * @description 判断目标字符串是否以指定的子字符串开头。
  18442. * @param {string} str - 目标字符串。
  18443. * @param {string} sub - 查找的子字符串。
  18444. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  18445. */
  18446. startsWith: function (str, sub) {
  18447. return (str.indexOf(sub) == 0);
  18448. },
  18449. /**
  18450. * @function StringExt.contains
  18451. * @description 判断目标字符串是否包含指定的子字符串。
  18452. * @param {string} str - 目标字符串。
  18453. * @param {string} sub - 查找的子字符串。
  18454. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  18455. */
  18456. contains: function (str, sub) {
  18457. return (str.indexOf(sub) != -1);
  18458. },
  18459. /**
  18460. * @function StringExt.trim
  18461. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  18462. * @param {string} str - (可能)存在空白字符填塞的字符串。
  18463. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  18464. */
  18465. trim: function (str) {
  18466. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  18467. },
  18468. /**
  18469. * @function StringExt.camelize
  18470. * @description 骆驼式("-")连字符的字符串处理。
  18471. * 例如:"chicken-head" becomes "chickenHead",
  18472. * "-chicken-head" becomes "ChickenHead"。
  18473. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  18474. * @returns {string}
  18475. */
  18476. camelize: function (str) {
  18477. var oStringList = str.split('-');
  18478. var camelizedString = oStringList[0];
  18479. for (var i = 1, len = oStringList.length; i < len; i++) {
  18480. var s = oStringList[i];
  18481. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  18482. }
  18483. return camelizedString;
  18484. },
  18485. /**
  18486. * @function StringExt.format
  18487. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  18488. * @example
  18489. * 示例:
  18490. * (code)
  18491. * 1、template = "${value,getValue}";
  18492. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  18493. * args = [2,23,12,36,21];
  18494. * 返回值:36
  18495. * (end)
  18496. * 示例:
  18497. * (code)
  18498. * 2、template = "$${{value,getValue}}";
  18499. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  18500. * args = [2,23,12,36,21];
  18501. * 返回值:"${36}"
  18502. * (end)
  18503. * 示例:
  18504. * (code)
  18505. * 3、template = "${a,b}";
  18506. * context = {a: {b:"format"}};
  18507. * args = null;
  18508. * 返回值:"format"
  18509. * (end)
  18510. * 示例:
  18511. * (code)
  18512. * 3、template = "${a,b}";
  18513. * context = null;
  18514. * args = null;
  18515. * 返回值:"${a.b}"
  18516. * (end)
  18517. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  18518. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  18519. * @param {Array.<number>} [args] - 可选参数传递给在 context 对象上找到的函数。
  18520. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  18521. */
  18522. format: function (template, context, args) {
  18523. if (!context) {
  18524. context = window;
  18525. }
  18526. // Example matching:
  18527. // str = ${foo.bar}
  18528. // match = foo.bar
  18529. var replacer = function (str, match) {
  18530. var replacement;
  18531. // Loop through all subs. Example: ${a.b.c}
  18532. // 0 -> replacement = context[a];
  18533. // 1 -> replacement = context[a][b];
  18534. // 2 -> replacement = context[a][b][c];
  18535. var subs = match.split(/\.+/);
  18536. for (var i = 0; i < subs.length; i++) {
  18537. if (i == 0) {
  18538. replacement = context;
  18539. }
  18540. replacement = replacement[subs[i]];
  18541. }
  18542. if (typeof replacement === "function") {
  18543. replacement = args ?
  18544. replacement.apply(null, args) :
  18545. replacement();
  18546. }
  18547. // If replacement is undefined, return the string 'undefined'.
  18548. // This is a workaround for a bugs in browsers not properly
  18549. // dealing with non-participating groups in regular expressions:
  18550. // http://blog.stevenlevithan.com/archives/npcg-javascript
  18551. if (typeof replacement == 'undefined') {
  18552. return 'undefined';
  18553. } else {
  18554. return replacement;
  18555. }
  18556. };
  18557. return template.replace(StringExt.tokenRegEx, replacer);
  18558. },
  18559. /**
  18560. * @member {RegExp} [StringExt.tokenRegEx]
  18561. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  18562. * @example
  18563. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  18564. */
  18565. tokenRegEx: /\$\{([\w.]+?)\}/g,
  18566. /**
  18567. * @member {RegExp} [StringExt.numberRegEx]
  18568. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  18569. */
  18570. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  18571. /**
  18572. * @function StringExt.isNumeric
  18573. * @description 判断一个字符串是否只包含一个数值。
  18574. * @example
  18575. * (code)
  18576. * StringExt.isNumeric("6.02e23") // true
  18577. * StringExt.isNumeric("12 dozen") // false
  18578. * StringExt.isNumeric("4") // true
  18579. * StringExt.isNumeric(" 4 ") // false
  18580. * (end)
  18581. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  18582. */
  18583. isNumeric: function (value) {
  18584. return StringExt.numberRegEx.test(value);
  18585. },
  18586. /**
  18587. * @function StringExt.numericIf
  18588. * @description 把一个看似数值型的字符串转化为一个数值。
  18589. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  18590. */
  18591. numericIf: function (value) {
  18592. return StringExt.isNumeric(value) ? parseFloat(value) : value;
  18593. }
  18594. };
  18595. /**
  18596. * @name Number
  18597. * @namespace
  18598. * @category BaseTypes Util
  18599. * @description 数值操作的一系列常用扩展函数。
  18600. * @private
  18601. */
  18602. var NumberExt = {
  18603. /**
  18604. * @member {string} [NumberExt.decimalSeparator='.']
  18605. * @description 格式化数字时默认的小数点分隔符。
  18606. * @constant
  18607. */
  18608. decimalSeparator: ".",
  18609. /**
  18610. * @member {string} [NumberExt.thousandsSeparator=',']
  18611. * @description 格式化数字时默认的千位分隔符。
  18612. * @constant
  18613. */
  18614. thousandsSeparator: ",",
  18615. /**
  18616. * @function NumberExt.limitSigDigs
  18617. * @description 限制浮点数的有效数字位数。
  18618. * @param {number} num - 浮点数。
  18619. * @param {number} sig - 有效位数。
  18620. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  18621. */
  18622. limitSigDigs: function (num, sig) {
  18623. var fig = 0;
  18624. if (sig > 0) {
  18625. fig = parseFloat(num.toPrecision(sig));
  18626. }
  18627. return fig;
  18628. },
  18629. /**
  18630. * @function NumberExt.format
  18631. * @description 数字格式化输出。
  18632. * @param {number} num - 数字。
  18633. * @param {number} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  18634. * @param {string} [tsep=','] - 千位分隔符。
  18635. * @param {string} [dsep='.'] - 小数点分隔符。
  18636. * @returns {string} 数字格式化后的字符串。
  18637. */
  18638. format: function (num, dec, tsep, dsep) {
  18639. dec = (typeof dec != "undefined") ? dec : 0;
  18640. tsep = (typeof tsep != "undefined") ? tsep :
  18641. NumberExt.thousandsSeparator;
  18642. dsep = (typeof dsep != "undefined") ? dsep :
  18643. NumberExt.decimalSeparator;
  18644. if (dec != null) {
  18645. num = parseFloat(num.toFixed(dec));
  18646. }
  18647. var parts = num.toString().split(".");
  18648. if (parts.length === 1 && dec == null) {
  18649. // integer where we do not want to touch the decimals
  18650. dec = 0;
  18651. }
  18652. var integer = parts[0];
  18653. if (tsep) {
  18654. var thousands = /(-?[0-9]+)([0-9]{3})/;
  18655. while (thousands.test(integer)) {
  18656. integer = integer.replace(thousands, "$1" + tsep + "$2");
  18657. }
  18658. }
  18659. var str;
  18660. if (dec == 0) {
  18661. str = integer;
  18662. } else {
  18663. var rem = parts.length > 1 ? parts[1] : "0";
  18664. if (dec != null) {
  18665. rem = rem + new Array(dec - rem.length + 1).join("0");
  18666. }
  18667. str = integer + dsep + rem;
  18668. }
  18669. return str;
  18670. }
  18671. };
  18672. if (!Number.prototype.limitSigDigs) {
  18673. /**
  18674. * APIMethod: Number.limitSigDigs
  18675. * 限制浮点数的有效数字位数.
  18676. * @param {number} sig -有效位数。
  18677. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  18678. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  18679. */
  18680. Number.prototype.limitSigDigs = function (sig) {
  18681. return NumberExt.limitSigDigs(this, sig);
  18682. };
  18683. }
  18684. /**
  18685. * @name Function
  18686. * @namespace
  18687. * @category BaseTypes Util
  18688. * @description 函数操作的一系列常用扩展函数。
  18689. * @private
  18690. */
  18691. var FunctionExt = {
  18692. /**
  18693. * @function FunctionExt.bind
  18694. * @description 绑定函数到对象。方便创建 this 的作用域。
  18695. * @param {function} func - 输入函数。
  18696. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  18697. * @returns {function} object 参数作为 func 函数的 this 对象。
  18698. */
  18699. bind: function (func, object) {
  18700. // create a reference to all arguments past the second one
  18701. var args = Array.prototype.slice.apply(arguments, [2]);
  18702. return function () {
  18703. // Push on any additional arguments from the actual function call.
  18704. // These will come after those sent to the bind call.
  18705. var newArgs = args.concat(
  18706. Array.prototype.slice.apply(arguments, [0])
  18707. );
  18708. return func.apply(object, newArgs);
  18709. };
  18710. },
  18711. /**
  18712. * @function FunctionExt.bindAsEventListener
  18713. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  18714. * @param {function} func - 用于监听事件的函数。
  18715. * @param {Object} object - this 对象的引用。
  18716. * @returns {function}
  18717. */
  18718. bindAsEventListener: function (func, object) {
  18719. return function (event) {
  18720. return func.call(object, event || window.event);
  18721. };
  18722. },
  18723. /**
  18724. * @function FunctionExt.False
  18725. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  18726. * @example
  18727. * document.onclick = FunctionExt.False;
  18728. * @returns {boolean}
  18729. */
  18730. False: function () {
  18731. return false;
  18732. },
  18733. /**
  18734. * @function FunctionExt.True
  18735. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  18736. * @example
  18737. * document.onclick = FunctionExt.True;
  18738. * @returns {boolean}
  18739. */
  18740. True: function () {
  18741. return true;
  18742. },
  18743. /**
  18744. * @function FunctionExt.Void
  18745. * @description 可重用函数,仅仅返回 "undefined"。
  18746. * @returns {undefined}
  18747. */
  18748. Void: function () {
  18749. }
  18750. };
  18751. /**
  18752. * @name Array
  18753. * @namespace
  18754. * @category BaseTypes Util
  18755. * @description 数组操作的一系列常用扩展函数。
  18756. * @private
  18757. */
  18758. var ArrayExt = {
  18759. /**
  18760. * @function ArrayExt.filter
  18761. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  18762. * @param {Array} array - 要过滤的数组。
  18763. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  18764. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  18765. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  18766. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  18767. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  18768. */
  18769. filter: function (array, callback, caller) {
  18770. var selected = [];
  18771. if (Array.prototype.filter) {
  18772. selected = array.filter(callback, caller);
  18773. } else {
  18774. var len = array.length;
  18775. if (typeof callback != "function") {
  18776. throw new TypeError();
  18777. }
  18778. for (var i = 0; i < len; i++) {
  18779. if (i in array) {
  18780. var val = array[i];
  18781. if (callback.call(caller, val, i, array)) {
  18782. selected.push(val);
  18783. }
  18784. }
  18785. }
  18786. }
  18787. return selected;
  18788. }
  18789. };
  18790. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  18791. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18792. * This program are made available under the terms of the Apache License, Version 2.0
  18793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18794. // import {WKT} from '../format/WKT';
  18795. // import {Vector} from './Vector';
  18796. /**
  18797. * @class Geometry
  18798. * @deprecatedclass SuperMap.Geometry
  18799. * @category BaseTypes Geometry
  18800. * @classdesc 几何对象类,描述地理对象的几何图形。
  18801. * @usage
  18802. */
  18803. class Geometry_Geometry {
  18804. constructor() {
  18805. this.CLASS_NAME = "SuperMap.Geometry";
  18806. /**
  18807. * @member {string} Geometry.prototype.id
  18808. * @description 几何对象的唯一标识符。
  18809. *
  18810. */
  18811. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  18812. /**
  18813. * @member {Geometry} Geometry.prototype.parent
  18814. * @description 父类几何对象。
  18815. */
  18816. this.parent = null;
  18817. /**
  18818. * @member {Bounds} Geometry.prototype.bounds
  18819. * @description 几何对象的范围。
  18820. *
  18821. */
  18822. this.bounds = null;
  18823. /**
  18824. * @member {number} Geometry.prototype.SRID
  18825. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  18826. * @example
  18827. * var geometry= new Geometry();
  18828. * geometry. SRID=4326;
  18829. *
  18830. */
  18831. this.SRID = null;
  18832. }
  18833. /**
  18834. * @function Geometry.prototype.destroy
  18835. * @description 解构 Geometry 类,释放资源。
  18836. */
  18837. destroy() {
  18838. this.id = null;
  18839. this.bounds = null;
  18840. this.SRID = null;
  18841. }
  18842. /**
  18843. * @function Geometry.prototype.clone
  18844. * @description 克隆几何图形。克隆的几何图形不设置非标准的属性。
  18845. * @returns {Geometry} 克隆的几何图形。
  18846. */
  18847. clone() {
  18848. return new Geometry_Geometry();
  18849. }
  18850. /**
  18851. * @function Geometry.prototype.setBounds
  18852. * @description 设置几何对象的 bounds。
  18853. * @param {Bounds} bounds - 范围。
  18854. */
  18855. setBounds(bounds) {
  18856. if (bounds) {
  18857. this.bounds = bounds.clone();
  18858. }
  18859. }
  18860. /**
  18861. * @function Geometry.prototype.clearBounds
  18862. * @description 清除几何对象的 bounds。
  18863. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  18864. */
  18865. clearBounds() {
  18866. this.bounds = null;
  18867. if (this.parent) {
  18868. this.parent.clearBounds();
  18869. }
  18870. }
  18871. /**
  18872. * @function Geometry.prototype.extendBounds
  18873. * @description 扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
  18874. * @param {Bounds} newBounds - 几何对象的 bounds。
  18875. */
  18876. extendBounds(newBounds) {
  18877. var bounds = this.getBounds();
  18878. if (!bounds) {
  18879. this.setBounds(newBounds);
  18880. } else {
  18881. this.bounds.extend(newBounds);
  18882. }
  18883. }
  18884. /**
  18885. * @function Geometry.prototype.getBounds
  18886. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  18887. * @returns {Bounds} 几何对象的边界。
  18888. */
  18889. getBounds() {
  18890. if (this.bounds == null) {
  18891. this.calculateBounds();
  18892. }
  18893. return this.bounds;
  18894. }
  18895. /**
  18896. * @function Geometry.prototype.calculateBounds
  18897. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  18898. */
  18899. calculateBounds() {
  18900. //
  18901. // This should be overridden by subclasses.
  18902. //
  18903. }
  18904. /**
  18905. * @function Geometry.prototype.getVertices
  18906. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  18907. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  18908. * @returns {Array} 几何图形的顶点列表。
  18909. */
  18910. getVertices(nodes) { // eslint-disable-line no-unused-vars
  18911. }
  18912. /**
  18913. * @function Geometry.prototype.getArea
  18914. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  18915. * @returns {number} 计算后的对象面积。
  18916. */
  18917. getArea() {
  18918. //to be overridden by geometries that actually have an area
  18919. //
  18920. return 0.0;
  18921. }
  18922. // /**
  18923. // * @function Geometry.prototype.toString
  18924. // * @description 返回geometry对象的字符串表述,需要引入{@link WKTFormat}。此方法只能在子类实现,在父类使用会报错。
  18925. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  18926. // */
  18927. // toString() {
  18928. // var string;
  18929. // if (WKT) {
  18930. // var wkt = new WKT();
  18931. // string = wkt.write(new Vector(this));
  18932. // } else {
  18933. // string = Object.prototype.toString.call(this);
  18934. // }
  18935. // return string;
  18936. // }
  18937. }
  18938. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  18939. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18940. * This program are made available under the terms of the Apache License, Version 2.0
  18941. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18942. /**
  18943. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  18944. * * "opera" -- Opera
  18945. * * "msie" -- Internet Explorer
  18946. * * "safari" -- Safari
  18947. * * "firefox" -- Firefox
  18948. * * "mozilla" -- Mozilla
  18949. * @category BaseTypes Constant
  18950. * @constant {Object}
  18951. * @usage
  18952. * ```
  18953. * // 浏览器
  18954. * <script type="text/javascript" src="{cdn}"></script>
  18955. * <script>
  18956. * const result = {namespace}.Browser.name;
  18957. *
  18958. * </script>
  18959. * // ES6 Import
  18960. * import { Browser } from '{npm}';
  18961. *
  18962. * const result = Browser.name;
  18963. * ```
  18964. */
  18965. const Browser = (function () {
  18966. var name = '',
  18967. version = '',
  18968. device = 'pc',
  18969. uaMatch;
  18970. //以下进行测试
  18971. var ua = navigator.userAgent.toLowerCase();
  18972. if (ua.indexOf('msie') > -1 || (ua.indexOf('trident') > -1 && ua.indexOf('rv') > -1)) {
  18973. name = 'msie';
  18974. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  18975. } else if (ua.indexOf('chrome') > -1) {
  18976. name = 'chrome';
  18977. uaMatch = ua.match(/chrome\/([\d.]+)/);
  18978. } else if (ua.indexOf('firefox') > -1) {
  18979. name = 'firefox';
  18980. uaMatch = ua.match(/firefox\/([\d.]+)/);
  18981. } else if (ua.indexOf('opera') > -1) {
  18982. name = 'opera';
  18983. uaMatch = ua.match(/version\/([\d.]+)/);
  18984. } else if (ua.indexOf('safari') > -1) {
  18985. name = 'safari';
  18986. uaMatch = ua.match(/version\/([\d.]+)/);
  18987. }
  18988. version = uaMatch ? uaMatch[1] : '';
  18989. if (ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1 || ua.indexOf('iphone') > -1) {
  18990. device = 'apple';
  18991. } else if (ua.indexOf('android') > -1) {
  18992. uaMatch = ua.match(/version\/([\d.]+)/);
  18993. version = uaMatch ? uaMatch[1] : '';
  18994. device = 'android';
  18995. }
  18996. return { name: name, version: version, device: device };
  18997. })();
  18998. const isSupportCanvas = (function () {
  18999. var checkRes = true,
  19000. broz = Browser;
  19001. if (document.createElement('canvas').getContext) {
  19002. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  19003. checkRes = false;
  19004. }
  19005. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  19006. checkRes = false;
  19007. }
  19008. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  19009. checkRes = false;
  19010. }
  19011. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  19012. checkRes = false;
  19013. }
  19014. } else {
  19015. checkRes = false;
  19016. }
  19017. return checkRes;
  19018. })();
  19019. /**
  19020. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  19021. * @constant {number}
  19022. * @private
  19023. */
  19024. const IS_GECKO = (function () {
  19025. var ua = navigator.userAgent.toLowerCase();
  19026. return ua.indexOf('webkit') === -1 && ua.indexOf('gecko') !== -1;
  19027. })();
  19028. /**
  19029. * @constant {number}
  19030. * @default
  19031. * @description 分辨率与比例尺之间转换的常量。
  19032. * @private
  19033. */
  19034. const DOTS_PER_INCH = 96;
  19035. /**
  19036. * @name CommonUtil
  19037. * @namespace
  19038. * @category BaseTypes Util
  19039. * @description common 工具类。
  19040. * @usage
  19041. * ```
  19042. * // 浏览器
  19043. * <script type="text/javascript" src="{cdn}"></script>
  19044. * <script>
  19045. * const result = {namespace}.CommonUtil.getElement();
  19046. *
  19047. * // 弃用的写法
  19048. * const result = SuperMap.Util.getElement();
  19049. *
  19050. * </script>
  19051. *
  19052. * // ES6 Import
  19053. * import { CommonUtil } from '{npm}';
  19054. *
  19055. * const result = CommonUtil.getElement();
  19056. * ```
  19057. */
  19058. const Util_Util = {
  19059. /**
  19060. * @function Util.extend
  19061. * @description 对象拷贝赋值。
  19062. * @param {Object} dest - 目标对象。
  19063. * @param {Object} arguments - 待拷贝的对象。
  19064. * @returns {Object} 赋值后的目标对象。
  19065. */
  19066. assign(dest) {
  19067. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  19068. var arg = Object.getOwnPropertyNames(arguments)[index];
  19069. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  19070. continue;
  19071. }
  19072. var obj = arguments[arg];
  19073. if (obj) {
  19074. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  19075. var key = Object.getOwnPropertyNames(obj)[j];
  19076. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  19077. continue;
  19078. }
  19079. dest[key] = obj[key];
  19080. }
  19081. }
  19082. }
  19083. return dest;
  19084. },
  19085. /**
  19086. * @memberOf CommonUtil
  19087. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  19088. * @example
  19089. * 要复制 Size 对象的所有属性到自定义对象上,使用方法如下:
  19090. * var size = new Size(100, 100);
  19091. * var obj = {};
  19092. * CommonUtil.extend(obj, size);
  19093. * @param {Object} [destination] - 目标对象。
  19094. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  19095. * @returns {Object} 目标对象。
  19096. */
  19097. extend: function (destination, source) {
  19098. destination = destination || {};
  19099. if (source) {
  19100. for (var property in source) {
  19101. var value = source[property];
  19102. if (value !== undefined) {
  19103. destination[property] = value;
  19104. }
  19105. }
  19106. /**
  19107. * IE doesn't include the toString property when iterating over an object's
  19108. * properties with the for(property in object) syntax. Explicitly check if
  19109. * the source has its own toString property.
  19110. */
  19111. /*
  19112. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  19113. * prototype object" when calling hawOwnProperty if the source object
  19114. * is an instance of window.Event.
  19115. */
  19116. var sourceIsEvt = typeof window.Event === 'function' && source instanceof window.Event;
  19117. if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
  19118. destination.toString = source.toString;
  19119. }
  19120. }
  19121. return destination;
  19122. },
  19123. /**
  19124. * @memberOf CommonUtil
  19125. * @description 对象拷贝。
  19126. * @param {Object} [des] - 目标对象。
  19127. * @param {Object} soc - 源对象。
  19128. */
  19129. copy: function (des, soc) {
  19130. des = des || {};
  19131. var v;
  19132. if (soc) {
  19133. for (var p in des) {
  19134. v = soc[p];
  19135. if (typeof v !== 'undefined') {
  19136. des[p] = v;
  19137. }
  19138. }
  19139. }
  19140. },
  19141. /**
  19142. * @memberOf CommonUtil
  19143. * @description 销毁对象,将其属性置空。
  19144. * @param {Object} [obj] - 目标对象。
  19145. */
  19146. reset: function (obj) {
  19147. obj = obj || {};
  19148. for (var p in obj) {
  19149. if (obj.hasOwnProperty(p)) {
  19150. if (typeof obj[p] === 'object' && obj[p] instanceof Array) {
  19151. for (var i in obj[p]) {
  19152. if (obj[p][i].destroy) {
  19153. obj[p][i].destroy();
  19154. }
  19155. }
  19156. obj[p].length = 0;
  19157. } else if (typeof obj[p] === 'object' && obj[p] instanceof Object) {
  19158. if (obj[p].destroy) {
  19159. obj[p].destroy();
  19160. }
  19161. }
  19162. obj[p] = null;
  19163. }
  19164. }
  19165. },
  19166. /**
  19167. * @memberOf CommonUtil
  19168. * @description 获取 HTML 元素数组。
  19169. * @returns {Array.<HTMLElement>} HTML 元素数组。
  19170. */
  19171. getElement: function () {
  19172. var elements = [];
  19173. for (var i = 0, len = arguments.length; i < len; i++) {
  19174. var element = arguments[i];
  19175. if (typeof element === 'string') {
  19176. element = document.getElementById(element);
  19177. }
  19178. if (arguments.length === 1) {
  19179. return element;
  19180. }
  19181. elements.push(element);
  19182. }
  19183. return elements;
  19184. },
  19185. /**
  19186. * @memberOf CommonUtil
  19187. * @description instance of 的跨浏览器实现。
  19188. * @param {Object} o - 对象。
  19189. * @returns {boolean} 是否是页面元素。
  19190. */
  19191. isElement: function (o) {
  19192. return !!(o && o.nodeType === 1);
  19193. },
  19194. /**
  19195. * @memberOf CommonUtil
  19196. * @description 判断一个对象是否是数组。
  19197. * @param {Object} a - 对象。
  19198. * @returns {boolean} 是否是数组。
  19199. */
  19200. isArray: function (a) {
  19201. return Object.prototype.toString.call(a) === '[object Array]';
  19202. },
  19203. /**
  19204. * @memberOf CommonUtil
  19205. * @description 从数组中删除某一项。
  19206. * @param {Array} array - 数组。
  19207. * @param {Object} item - 数组中要删除的一项。
  19208. * @returns {Array} 执行删除操作后的数组。
  19209. */
  19210. removeItem: function (array, item) {
  19211. for (var i = array.length - 1; i >= 0; i--) {
  19212. if (array[i] === item) {
  19213. array.splice(i, 1);
  19214. //break;more than once??
  19215. }
  19216. }
  19217. return array;
  19218. },
  19219. /**
  19220. * @memberOf CommonUtil
  19221. * @description 获取某对象在数组中的索引值。
  19222. * @param {Array.<Object>} array - 数组。
  19223. * @param {Object} obj - 对象。
  19224. * @returns {number} 某对象在数组中的索引值。
  19225. */
  19226. indexOf: function (array, obj) {
  19227. if (array == null) {
  19228. return -1;
  19229. } else {
  19230. // use the build-in function if available.
  19231. if (typeof array.indexOf === 'function') {
  19232. return array.indexOf(obj);
  19233. } else {
  19234. for (var i = 0, len = array.length; i < len; i++) {
  19235. if (array[i] === obj) {
  19236. return i;
  19237. }
  19238. }
  19239. return -1;
  19240. }
  19241. }
  19242. },
  19243. /**
  19244. * @memberOf CommonUtil
  19245. * @description 修改某 DOM 元素的许多属性。
  19246. * @param {HTMLElement} element - 待修改的 DOM 元素。
  19247. * @param {string} [id] - DOM 元素的 ID。
  19248. * @param {Pixel} [px] - DOM 元素的 style 属性的 left 和 top 属性。
  19249. * @param {Size} [sz] - DOM 元素的 width 和 height 属性。
  19250. * @param {string} [position] - DOM 元素的 position 属性。
  19251. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  19252. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  19253. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  19254. */
  19255. modifyDOMElement: function (element, id, px, sz, position, border, overflow, opacity) {
  19256. if (id) {
  19257. element.id = id;
  19258. }
  19259. if (px) {
  19260. element.style.left = px.x + 'px';
  19261. element.style.top = px.y + 'px';
  19262. }
  19263. if (sz) {
  19264. element.style.width = sz.w + 'px';
  19265. element.style.height = sz.h + 'px';
  19266. }
  19267. if (position) {
  19268. element.style.position = position;
  19269. }
  19270. if (border) {
  19271. element.style.border = border;
  19272. }
  19273. if (overflow) {
  19274. element.style.overflow = overflow;
  19275. }
  19276. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  19277. element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
  19278. element.style.opacity = opacity;
  19279. } else if (parseFloat(opacity) === 1.0) {
  19280. element.style.filter = '';
  19281. element.style.opacity = '';
  19282. }
  19283. },
  19284. /**
  19285. * @memberOf CommonUtil
  19286. * @description 比较两个对象并合并。
  19287. * @param {Object} [to] - 目标对象。
  19288. * @param {Object} from - 源对象。
  19289. * @returns {Object} 返回合并后的对象。
  19290. */
  19291. applyDefaults: function (to, from) {
  19292. to = to || {};
  19293. /*
  19294. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  19295. * prototype object" when calling hawOwnProperty if the source object is an
  19296. * instance of window.Event.
  19297. */
  19298. var fromIsEvt = typeof window.Event === 'function' && from instanceof window.Event;
  19299. for (var key in from) {
  19300. if (
  19301. to[key] === undefined ||
  19302. (!fromIsEvt && from.hasOwnProperty && from.hasOwnProperty(key) && !to.hasOwnProperty(key))
  19303. ) {
  19304. to[key] = from[key];
  19305. }
  19306. }
  19307. /**
  19308. * IE doesn't include the toString property when iterating over an object's
  19309. * properties with the for(property in object) syntax. Explicitly check if
  19310. * the source has its own toString property.
  19311. */
  19312. if (
  19313. !fromIsEvt &&
  19314. from &&
  19315. from.hasOwnProperty &&
  19316. from.hasOwnProperty('toString') &&
  19317. !to.hasOwnProperty('toString')
  19318. ) {
  19319. to.toString = from.toString;
  19320. }
  19321. return to;
  19322. },
  19323. /**
  19324. * @memberOf CommonUtil
  19325. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  19326. * @param {Object} params - 参数对象。
  19327. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  19328. */
  19329. getParameterString: function (params) {
  19330. var paramsArray = [];
  19331. for (var key in params) {
  19332. var value = params[key];
  19333. if (value != null && typeof value !== 'function') {
  19334. var encodedValue;
  19335. if (Array.isArray(value) || value.toString() === '[object Object]') {
  19336. encodedValue = encodeURIComponent(JSON.stringify(value));
  19337. } else {
  19338. /* value is a string; simply encode */
  19339. encodedValue = encodeURIComponent(value);
  19340. }
  19341. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  19342. }
  19343. }
  19344. return paramsArray.join('&');
  19345. },
  19346. /**
  19347. * @memberOf CommonUtil
  19348. * @description 给 URL 追加查询参数。
  19349. * @param {string} url - 待追加参数的 URL 字符串。
  19350. * @param {string} paramStr - 待追加的查询参数。
  19351. * @returns {string} 新的 URL。
  19352. */
  19353. urlAppend: function (url, paramStr) {
  19354. var newUrl = url;
  19355. if (paramStr) {
  19356. if (paramStr.indexOf('?') === 0) {
  19357. paramStr = paramStr.substring(1);
  19358. }
  19359. var parts = (url + ' ').split(/[?&]/);
  19360. newUrl += parts.pop() === ' ' ? paramStr : parts.length ? '&' + paramStr : '?' + paramStr;
  19361. }
  19362. return newUrl;
  19363. },
  19364. /**
  19365. * @memberOf CommonUtil
  19366. * @description 给 URL 追加 path 参数。
  19367. * @param {string} url - 待追加参数的 URL 字符串。
  19368. * @param {string} paramStr - 待追加的path参数。
  19369. * @returns {string} 新的 URL。
  19370. */
  19371. urlPathAppend: function (url, pathStr) {
  19372. let newUrl = url;
  19373. if (!pathStr) {
  19374. return newUrl;
  19375. }
  19376. if (pathStr.indexOf('/') === 0) {
  19377. pathStr = pathStr.substring(1);
  19378. }
  19379. const parts = url.split('?');
  19380. if (parts[0].indexOf('/', parts[0].length - 1) < 0) {
  19381. parts[0] += '/';
  19382. }
  19383. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  19384. return newUrl;
  19385. },
  19386. /**
  19387. * @memberOf CommonUtil
  19388. * @description 为了避免浮点精度错误而保留的有效位数。
  19389. * @type {number}
  19390. * @default 14
  19391. */
  19392. DEFAULT_PRECISION: 14,
  19393. /**
  19394. * @memberOf CommonUtil
  19395. * @description 将字符串以接近的精度转换为数字。
  19396. * @param {string} number - 字符串。
  19397. * @param {number} [precision=14] - 精度。
  19398. * @returns {number} 转化后的数字。
  19399. */
  19400. toFloat: function (number, precision) {
  19401. if (precision == null) {
  19402. precision = Util_Util.DEFAULT_PRECISION;
  19403. }
  19404. if (typeof number !== 'number') {
  19405. number = parseFloat(number);
  19406. }
  19407. return precision === 0 ? number : parseFloat(number.toPrecision(precision));
  19408. },
  19409. /**
  19410. * @memberOf CommonUtil
  19411. * @description 角度转弧度。
  19412. * @param {number} x - 角度。
  19413. * @returns {number} 转化后的弧度。
  19414. */
  19415. rad: function (x) {
  19416. return (x * Math.PI) / 180;
  19417. },
  19418. /**
  19419. * @memberOf CommonUtil
  19420. * @description 从 URL 字符串中解析出参数对象。
  19421. * @param {string} url - URL。
  19422. * @returns {Object} 解析出的参数对象。
  19423. */
  19424. getParameters: function (url) {
  19425. // if no url specified, take it from the location bar
  19426. url = url === null || url === undefined ? window.location.href : url;
  19427. //parse out parameters portion of url string
  19428. var paramsString = '';
  19429. if (StringExt.contains(url, '?')) {
  19430. var start = url.indexOf('?') + 1;
  19431. var end = StringExt.contains(url, '#') ? url.indexOf('#') : url.length;
  19432. paramsString = url.substring(start, end);
  19433. }
  19434. var parameters = {};
  19435. var pairs = paramsString.split(/[&;]/);
  19436. for (var i = 0, len = pairs.length; i < len; ++i) {
  19437. var keyValue = pairs[i].split('=');
  19438. if (keyValue[0]) {
  19439. var key = keyValue[0];
  19440. try {
  19441. key = decodeURIComponent(key);
  19442. } catch (err) {
  19443. key = unescape(key);
  19444. }
  19445. // being liberal by replacing "+" with " "
  19446. var value = (keyValue[1] || '').replace(/\+/g, ' ');
  19447. try {
  19448. value = decodeURIComponent(value);
  19449. } catch (err) {
  19450. value = unescape(value);
  19451. }
  19452. // follow OGC convention of comma delimited values
  19453. value = value.split(',');
  19454. //if there's only one value, do not return as array
  19455. if (value.length == 1) {
  19456. value = value[0];
  19457. }
  19458. parameters[key] = value;
  19459. }
  19460. }
  19461. return parameters;
  19462. },
  19463. /**
  19464. * @memberOf CommonUtil
  19465. * @description 不断递增计数变量,用于生成唯一 ID。
  19466. * @type {number}
  19467. * @default 0
  19468. */
  19469. lastSeqID: 0,
  19470. /**
  19471. * @memberOf CommonUtil
  19472. * @description 创建唯一 ID 值。
  19473. * @param {string} [prefix] - 前缀。
  19474. * @returns {string} 唯一的 ID 值。
  19475. */
  19476. createUniqueID: function (prefix) {
  19477. if (prefix == null) {
  19478. prefix = 'id_';
  19479. }
  19480. Util_Util.lastSeqID += 1;
  19481. return prefix + Util_Util.lastSeqID;
  19482. },
  19483. /**
  19484. * @memberOf CommonUtil
  19485. * @description 判断并转化比例尺。
  19486. * @param {number} scale - 比例尺。
  19487. * @returns {number} 正常的 scale 值。
  19488. */
  19489. normalizeScale: function (scale) {
  19490. var normScale = scale > 1.0 ? 1.0 / scale : scale;
  19491. return normScale;
  19492. },
  19493. /**
  19494. * @memberOf CommonUtil
  19495. * @description 比例尺转分辨率。
  19496. * @param {number} scale - 比例尺。
  19497. * @param {string} [units='degrees'] - 比例尺单位。
  19498. * @returns {number} 转化后的分辨率。
  19499. */
  19500. getResolutionFromScale: function (scale, units) {
  19501. var resolution;
  19502. if (scale) {
  19503. if (units == null) {
  19504. units = 'degrees';
  19505. }
  19506. var normScale = Util_Util.normalizeScale(scale);
  19507. resolution = 1 / (normScale * INCHES_PER_UNIT[units] * DOTS_PER_INCH);
  19508. }
  19509. return resolution;
  19510. },
  19511. /**
  19512. * @memberOf CommonUtil
  19513. * @description 分辨率转比例尺。
  19514. * @param {number} resolution - 分辨率。
  19515. * @param {string} [units='degrees'] - 分辨率单位。
  19516. * @returns {number} 转化后的比例尺。
  19517. */
  19518. getScaleFromResolution: function (resolution, units) {
  19519. if (units == null) {
  19520. units = 'degrees';
  19521. }
  19522. var scale = resolution * INCHES_PER_UNIT[units] * DOTS_PER_INCH;
  19523. return scale;
  19524. },
  19525. /**
  19526. * @memberOf CommonUtil
  19527. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  19528. * @returns {Object} 浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  19529. */
  19530. getBrowser: function () {
  19531. return Browser;
  19532. },
  19533. /**
  19534. * @memberOf CommonUtil
  19535. * @description 浏览器是否支持 Canvas。
  19536. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas。
  19537. */
  19538. isSupportCanvas,
  19539. /**
  19540. * @memberOf CommonUtil
  19541. * @description 判断浏览器是否支持 Canvas。
  19542. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas 。
  19543. */
  19544. supportCanvas: function () {
  19545. return Util_Util.isSupportCanvas;
  19546. },
  19547. /**
  19548. * @memberOf CommonUtil
  19549. * @description 判断一个 URL 请求是否在当前域中。
  19550. * @param {string} url - URL 请求字符串。
  19551. * @returns {boolean} URL 请求是否在当前域中。
  19552. */
  19553. isInTheSameDomain: function (url) {
  19554. if (!url) {
  19555. return true;
  19556. }
  19557. var index = url.indexOf('//');
  19558. var documentUrl = document.location.toString();
  19559. var documentIndex = documentUrl.indexOf('//');
  19560. if (index === -1) {
  19561. return true;
  19562. } else {
  19563. var protocol;
  19564. var substring = (protocol = url.substring(0, index));
  19565. var documentSubString = documentUrl.substring(documentIndex + 2);
  19566. documentIndex = documentSubString.indexOf('/');
  19567. var documentPortIndex = documentSubString.indexOf(':');
  19568. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  19569. //var documentPort;
  19570. var documentprotocol = document.location.protocol;
  19571. if (documentPortIndex !== -1) {
  19572. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  19573. } else {
  19574. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  19575. }
  19576. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  19577. return false;
  19578. }
  19579. substring = url.substring(index + 2);
  19580. var portIndex = substring.indexOf(':');
  19581. index = substring.indexOf('/');
  19582. var domainWithPort = substring.substring(0, index);
  19583. var domain;
  19584. if (portIndex !== -1) {
  19585. domain = substring.substring(0, portIndex);
  19586. } else {
  19587. domain = substring.substring(0, index);
  19588. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  19589. }
  19590. var documentDomain = document.domain;
  19591. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  19592. return true;
  19593. }
  19594. }
  19595. return false;
  19596. },
  19597. /**
  19598. * @memberOf CommonUtil
  19599. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  19600. * @param {Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  19601. * @param {Size} viewer - 地图初始化时默认的地图图片的尺寸。
  19602. * @param {number} scale - 地图初始化时默认的显示比例尺。
  19603. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  19604. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  19605. * @returns {number} 图层显示分辨率。
  19606. */
  19607. calculateDpi: function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  19608. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  19609. if (!viewBounds || !viewer || !scale) {
  19610. return;
  19611. }
  19612. var ratio = 10000,
  19613. rvbWidth = viewBounds.getWidth(),
  19614. rvbHeight = viewBounds.getHeight(),
  19615. rvWidth = viewer.w,
  19616. rvHeight = viewer.h;
  19617. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  19618. datumAxis = datumAxis || 6378137;
  19619. coordUnit = coordUnit || 'degrees';
  19620. var dpi;
  19621. if (
  19622. coordUnit.toLowerCase() === 'degree' ||
  19623. coordUnit.toLowerCase() === 'degrees' ||
  19624. coordUnit.toLowerCase() === 'dd'
  19625. ) {
  19626. let num1 = rvbWidth / rvWidth,
  19627. num2 = rvbHeight / rvHeight,
  19628. resolution = num1 > num2 ? num1 : num2;
  19629. dpi = (0.0254 * ratio) / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  19630. } else {
  19631. let resolution = rvbWidth / rvWidth;
  19632. dpi = (0.0254 * ratio) / resolution / scale / ratio;
  19633. }
  19634. return dpi;
  19635. },
  19636. /**
  19637. * @memberOf CommonUtil
  19638. * @description 将对象转换成 JSON 字符串。
  19639. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  19640. * @returns {string} 转换后的 JSON 对象。
  19641. */
  19642. toJSON: function (obj) {
  19643. var objInn = obj;
  19644. if (objInn == null) {
  19645. return null;
  19646. }
  19647. switch (objInn.constructor) {
  19648. case String:
  19649. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  19650. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  19651. objInn = objInn.replace(/\n/g, '\\n');
  19652. objInn = objInn.replace(/\r/g, '\\r');
  19653. objInn = objInn.replace('<', '&lt;');
  19654. objInn = objInn.replace('>', '&gt;');
  19655. objInn = objInn.replace(/%/g, '%25');
  19656. objInn = objInn.replace(/&/g, '%26');
  19657. return objInn;
  19658. case Array:
  19659. var arr = '';
  19660. for (var i = 0, len = objInn.length; i < len; i++) {
  19661. arr += Util_Util.toJSON(objInn[i]);
  19662. if (i !== objInn.length - 1) {
  19663. arr += ',';
  19664. }
  19665. }
  19666. return "[" + arr + "]";
  19667. case Number:
  19668. return isFinite(objInn) ? String(objInn) : null;
  19669. case Boolean:
  19670. return String(objInn);
  19671. case Date:
  19672. var dateStr =
  19673. '{' +
  19674. '\'__type\':"System.DateTime",' +
  19675. "'Year':" +
  19676. objInn.getFullYear() +
  19677. ',' +
  19678. "'Month':" +
  19679. (objInn.getMonth() + 1) +
  19680. ',' +
  19681. "'Day':" +
  19682. objInn.getDate() +
  19683. ',' +
  19684. "'Hour':" +
  19685. objInn.getHours() +
  19686. ',' +
  19687. "'Minute':" +
  19688. objInn.getMinutes() +
  19689. ',' +
  19690. "'Second':" +
  19691. objInn.getSeconds() +
  19692. ',' +
  19693. "'Millisecond':" +
  19694. objInn.getMilliseconds() +
  19695. ',' +
  19696. "'TimezoneOffset':" +
  19697. objInn.getTimezoneOffset() +
  19698. '}';
  19699. return dateStr;
  19700. default:
  19701. if (objInn['toJSON'] != null && typeof objInn['toJSON'] === 'function') {
  19702. return objInn.toJSON();
  19703. }
  19704. if (typeof objInn === 'object') {
  19705. if (objInn.length) {
  19706. let arr = [];
  19707. for (let i = 0, len = objInn.length; i < len; i++) {
  19708. arr.push(Util_Util.toJSON(objInn[i]));
  19709. }
  19710. return '[' + arr.join(',') + ']';
  19711. }
  19712. let arr = [];
  19713. for (let attr in objInn) {
  19714. //为解决Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  19715. if (typeof objInn[attr] !== 'function' && attr !== 'CLASS_NAME' && attr !== 'parent') {
  19716. arr.push("'" + attr + "':" + Util_Util.toJSON(objInn[attr]));
  19717. }
  19718. }
  19719. if (arr.length > 0) {
  19720. return '{' + arr.join(',') + '}';
  19721. } else {
  19722. return '{}';
  19723. }
  19724. }
  19725. return objInn.toString();
  19726. }
  19727. },
  19728. /**
  19729. * @memberOf CommonUtil
  19730. * @description 根据比例尺和 DPI 计算屏幕分辨率。
  19731. * @category BaseTypes Util
  19732. * @param {number} scale - 比例尺。
  19733. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  19734. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  19735. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  19736. * @returns {number} 当前比例尺下的屏幕分辨率。
  19737. */
  19738. getResolutionFromScaleDpi: function (scale, dpi, coordUnit, datumAxis) {
  19739. var resolution = null,
  19740. ratio = 10000;
  19741. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  19742. datumAxis = datumAxis || 6378137;
  19743. coordUnit = coordUnit || '';
  19744. if (scale > 0 && dpi > 0) {
  19745. scale = Util_Util.normalizeScale(scale);
  19746. if (
  19747. coordUnit.toLowerCase() === 'degree' ||
  19748. coordUnit.toLowerCase() === 'degrees' ||
  19749. coordUnit.toLowerCase() === 'dd'
  19750. ) {
  19751. //scale = Util.normalizeScale(scale);
  19752. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  19753. return resolution;
  19754. } else {
  19755. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  19756. return resolution;
  19757. }
  19758. }
  19759. return -1;
  19760. },
  19761. /**
  19762. * @memberOf CommonUtil
  19763. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  19764. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  19765. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  19766. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  19767. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  19768. * @returns {number} 当前屏幕分辨率下的比例尺。
  19769. */
  19770. getScaleFromResolutionDpi: function (resolution, dpi, coordUnit, datumAxis) {
  19771. var scale = null,
  19772. ratio = 10000;
  19773. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  19774. datumAxis = datumAxis || 6378137;
  19775. coordUnit = coordUnit || '';
  19776. if (resolution > 0 && dpi > 0) {
  19777. if (
  19778. coordUnit.toLowerCase() === 'degree' ||
  19779. coordUnit.toLowerCase() === 'degrees' ||
  19780. coordUnit.toLowerCase() === 'dd'
  19781. ) {
  19782. scale = (0.0254 * ratio) / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  19783. return scale;
  19784. } else {
  19785. scale = (0.0254 * ratio) / dpi / resolution / ratio;
  19786. return scale;
  19787. }
  19788. }
  19789. return -1;
  19790. },
  19791. /**
  19792. * @memberOf CommonUtil
  19793. * @description 转换查询结果。
  19794. * @param {Object} result - 查询结果。
  19795. * @returns {Object} 转换后的查询结果。
  19796. */
  19797. transformResult: function (result) {
  19798. if (result.responseText && typeof result.responseText === 'string') {
  19799. result = JSON.parse(result.responseText);
  19800. }
  19801. return result;
  19802. },
  19803. /**
  19804. * @memberOf CommonUtil
  19805. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  19806. * @param {Object} [destination] - 拷贝目标。
  19807. * @param {Object} source - 源对象。
  19808. *
  19809. */
  19810. copyAttributes: function (destination, source) {
  19811. destination = destination || {};
  19812. if (source) {
  19813. for (var property in source) {
  19814. var value = source[property];
  19815. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  19816. destination[property] = value;
  19817. }
  19818. }
  19819. }
  19820. return destination;
  19821. },
  19822. /**
  19823. * @memberOf CommonUtil
  19824. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  19825. * @param {Object} [destination] - 目标对象。
  19826. * @param {Object} source - 源对象。
  19827. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  19828. *
  19829. */
  19830. copyAttributesWithClip: function (destination, source, clip) {
  19831. destination = destination || {};
  19832. if (source) {
  19833. for (var property in source) {
  19834. //去掉禁止拷贝的属性
  19835. var isInClip = false;
  19836. if (clip && clip.length) {
  19837. for (var i = 0, len = clip.length; i < len; i++) {
  19838. if (property === clip[i]) {
  19839. isInClip = true;
  19840. break;
  19841. }
  19842. }
  19843. }
  19844. if (isInClip === true) {
  19845. continue;
  19846. }
  19847. var value = source[property];
  19848. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  19849. destination[property] = value;
  19850. }
  19851. }
  19852. }
  19853. return destination;
  19854. },
  19855. /**
  19856. * @memberOf CommonUtil
  19857. * @description 克隆一个 Object 对象。
  19858. * @param {Object} obj - 需要克隆的对象。
  19859. * @returns {Object} 对象的拷贝对象,注意是新的对象,不是指向。
  19860. */
  19861. cloneObject: function (obj) {
  19862. // Handle the 3 simple types, and null or undefined
  19863. if (null === obj || 'object' !== typeof obj) {
  19864. return obj;
  19865. }
  19866. // Handle Date
  19867. if (obj instanceof Date) {
  19868. let copy = new Date();
  19869. copy.setTime(obj.getTime());
  19870. return copy;
  19871. }
  19872. // Handle Array
  19873. if (obj instanceof Array) {
  19874. let copy = obj.slice(0);
  19875. return copy;
  19876. }
  19877. // Handle Object
  19878. if (obj instanceof Object) {
  19879. let copy = {};
  19880. for (var attr in obj) {
  19881. if (obj.hasOwnProperty(attr)) {
  19882. copy[attr] = Util_Util.cloneObject(obj[attr]);
  19883. }
  19884. }
  19885. return copy;
  19886. }
  19887. throw new Error("Unable to copy obj! Its type isn't supported.");
  19888. },
  19889. /**
  19890. * @memberOf CommonUtil
  19891. * @description 判断两条线段是不是有交点。
  19892. * @param {GeometryPoint} a1 - 第一条线段的起始节点。
  19893. * @param {GeometryPoint} a2 - 第一条线段的结束节点。
  19894. * @param {GeometryPoint} b1 - 第二条线段的起始节点。
  19895. * @param {GeometryPoint} b2 - 第二条线段的结束节点。
  19896. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  19897. */
  19898. lineIntersection: function (a1, a2, b1, b2) {
  19899. var intersectValue = null;
  19900. var k1;
  19901. var k2;
  19902. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  19903. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  19904. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  19905. //ab==0代表两条线断的斜率一样
  19906. if (ab != 0) {
  19907. k1 = b / ab;
  19908. k2 = a / ab;
  19909. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  19910. intersectValue = new Geometry_Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  19911. } else {
  19912. intersectValue = 'No Intersection';
  19913. }
  19914. } else {
  19915. if (b == 0 && a == 0) {
  19916. var maxy = Math.max(a1.y, a2.y);
  19917. var miny = Math.min(a1.y, a2.y);
  19918. var maxx = Math.max(a1.x, a2.x);
  19919. var minx = Math.min(a1.x, a2.x);
  19920. if (
  19921. (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) && b1.x >= minx && b1.x <= maxx) ||
  19922. (b2.x >= minx && b2.x <= maxx)
  19923. ) {
  19924. intersectValue = 'Coincident'; //重合
  19925. } else {
  19926. intersectValue = 'Parallel'; //平行
  19927. }
  19928. } else {
  19929. intersectValue = 'Parallel'; //平行
  19930. }
  19931. }
  19932. return intersectValue;
  19933. },
  19934. /**
  19935. * @memberOf CommonUtil
  19936. * @description 获取文本外接矩形宽度与高度。
  19937. * @param {ThemeStyle} style - 文本样式。
  19938. * @param {string} text - 文本内容。
  19939. * @param {Object} element - DOM 元素。
  19940. * @returns {Object} 裁剪后的宽度,高度信息。
  19941. */
  19942. getTextBounds: function (style, text, element) {
  19943. document.body.appendChild(element);
  19944. element.style.width = 'auto';
  19945. element.style.height = 'auto';
  19946. if (style.fontSize) {
  19947. element.style.fontSize = style.fontSize;
  19948. }
  19949. if (style.fontFamily) {
  19950. element.style.fontFamily = style.fontFamily;
  19951. }
  19952. if (style.fontWeight) {
  19953. element.style.fontWeight = style.fontWeight;
  19954. }
  19955. element.style.position = 'relative';
  19956. element.style.visibility = 'hidden';
  19957. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  19958. element.style.display = 'inline-block';
  19959. element.innerHTML = text;
  19960. var textWidth = element.clientWidth;
  19961. var textHeight = element.clientHeight;
  19962. document.body.removeChild(element);
  19963. return {
  19964. textWidth: textWidth,
  19965. textHeight: textHeight
  19966. };
  19967. },
  19968. /**
  19969. * @memberOf CommonUtil
  19970. * @description 获取转换后的path路径。
  19971. * @param {string} path - 待转换的path,包含`{param}`。
  19972. * @param {Object} pathParams - path中待替换的参数。
  19973. * @returns {string} 转换后的path路径。
  19974. */
  19975. convertPath: function (path, pathParams) {
  19976. if (!pathParams) {
  19977. return path;
  19978. }
  19979. return path.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
  19980. var value;
  19981. if (pathParams.hasOwnProperty(key)) {
  19982. value = paramToString(pathParams[key]);
  19983. } else {
  19984. value = fullMatch;
  19985. }
  19986. return encodeURIComponent(value);
  19987. });
  19988. }
  19989. };
  19990. /**
  19991. * @enum INCHES_PER_UNIT
  19992. * @description 每单位的英尺数。
  19993. * @type {number}
  19994. * @private
  19995. */
  19996. const INCHES_PER_UNIT = {
  19997. inches: 1.0,
  19998. ft: 12.0,
  19999. mi: 63360.0,
  20000. m: 39.3701,
  20001. km: 39370.1,
  20002. dd: 4374754,
  20003. yd: 36
  20004. };
  20005. INCHES_PER_UNIT['in'] = INCHES_PER_UNIT.inches;
  20006. INCHES_PER_UNIT['degrees'] = INCHES_PER_UNIT.dd;
  20007. INCHES_PER_UNIT['nmi'] = 1852 * INCHES_PER_UNIT.m;
  20008. // Units from CS-Map
  20009. const METERS_PER_INCH = 0.0254000508001016002;
  20010. Util_Util.extend(INCHES_PER_UNIT, {
  20011. Inch: INCHES_PER_UNIT.inches,
  20012. Meter: 1.0 / METERS_PER_INCH, //EPSG:9001
  20013. Foot: 0.30480060960121920243 / METERS_PER_INCH, //EPSG:9003
  20014. IFoot: 0.3048 / METERS_PER_INCH, //EPSG:9002
  20015. ClarkeFoot: 0.3047972651151 / METERS_PER_INCH, //EPSG:9005
  20016. SearsFoot: 0.30479947153867624624 / METERS_PER_INCH, //EPSG:9041
  20017. GoldCoastFoot: 0.30479971018150881758 / METERS_PER_INCH, //EPSG:9094
  20018. IInch: 0.0254 / METERS_PER_INCH,
  20019. MicroInch: 0.0000254 / METERS_PER_INCH,
  20020. Mil: 0.0000000254 / METERS_PER_INCH,
  20021. Centimeter: 0.01 / METERS_PER_INCH,
  20022. Kilometer: 1000.0 / METERS_PER_INCH, //EPSG:9036
  20023. Yard: 0.91440182880365760731 / METERS_PER_INCH,
  20024. SearsYard: 0.914398414616029 / METERS_PER_INCH, //EPSG:9040
  20025. IndianYard: 0.91439853074444079983 / METERS_PER_INCH, //EPSG:9084
  20026. IndianYd37: 0.91439523 / METERS_PER_INCH, //EPSG:9085
  20027. IndianYd62: 0.9143988 / METERS_PER_INCH, //EPSG:9086
  20028. IndianYd75: 0.9143985 / METERS_PER_INCH, //EPSG:9087
  20029. IndianFoot: 0.30479951 / METERS_PER_INCH, //EPSG:9080
  20030. IndianFt37: 0.30479841 / METERS_PER_INCH, //EPSG:9081
  20031. IndianFt62: 0.3047996 / METERS_PER_INCH, //EPSG:9082
  20032. IndianFt75: 0.3047995 / METERS_PER_INCH, //EPSG:9083
  20033. Mile: 1609.34721869443738887477 / METERS_PER_INCH,
  20034. IYard: 0.9144 / METERS_PER_INCH, //EPSG:9096
  20035. IMile: 1609.344 / METERS_PER_INCH, //EPSG:9093
  20036. NautM: 1852.0 / METERS_PER_INCH, //EPSG:9030
  20037. 'Lat-66': 110943.316488932731 / METERS_PER_INCH,
  20038. 'Lat-83': 110946.25736872234125 / METERS_PER_INCH,
  20039. Decimeter: 0.1 / METERS_PER_INCH,
  20040. Millimeter: 0.001 / METERS_PER_INCH,
  20041. Dekameter: 10.0 / METERS_PER_INCH,
  20042. Decameter: 10.0 / METERS_PER_INCH,
  20043. Hectometer: 100.0 / METERS_PER_INCH,
  20044. GermanMeter: 1.0000135965 / METERS_PER_INCH, //EPSG:9031
  20045. CaGrid: 0.999738 / METERS_PER_INCH,
  20046. ClarkeChain: 20.1166194976 / METERS_PER_INCH, //EPSG:9038
  20047. GunterChain: 20.11684023368047 / METERS_PER_INCH, //EPSG:9033
  20048. BenoitChain: 20.116782494375872 / METERS_PER_INCH, //EPSG:9062
  20049. SearsChain: 20.11676512155 / METERS_PER_INCH, //EPSG:9042
  20050. ClarkeLink: 0.201166194976 / METERS_PER_INCH, //EPSG:9039
  20051. GunterLink: 0.2011684023368047 / METERS_PER_INCH, //EPSG:9034
  20052. BenoitLink: 0.20116782494375872 / METERS_PER_INCH, //EPSG:9063
  20053. SearsLink: 0.2011676512155 / METERS_PER_INCH, //EPSG:9043
  20054. Rod: 5.02921005842012 / METERS_PER_INCH,
  20055. IntnlChain: 20.1168 / METERS_PER_INCH, //EPSG:9097
  20056. IntnlLink: 0.201168 / METERS_PER_INCH, //EPSG:9098
  20057. Perch: 5.02921005842012 / METERS_PER_INCH,
  20058. Pole: 5.02921005842012 / METERS_PER_INCH,
  20059. Furlong: 201.1684023368046 / METERS_PER_INCH,
  20060. Rood: 3.778266898 / METERS_PER_INCH,
  20061. CapeFoot: 0.3047972615 / METERS_PER_INCH,
  20062. Brealey: 375.0 / METERS_PER_INCH,
  20063. ModAmFt: 0.304812252984505969011938 / METERS_PER_INCH,
  20064. Fathom: 1.8288 / METERS_PER_INCH,
  20065. 'NautM-UK': 1853.184 / METERS_PER_INCH,
  20066. '50kilometers': 50000.0 / METERS_PER_INCH,
  20067. '150kilometers': 150000.0 / METERS_PER_INCH
  20068. });
  20069. //unit abbreviations supported by PROJ.4
  20070. Util_Util.extend(INCHES_PER_UNIT, {
  20071. mm: INCHES_PER_UNIT['Meter'] / 1000.0,
  20072. cm: INCHES_PER_UNIT['Meter'] / 100.0,
  20073. dm: INCHES_PER_UNIT['Meter'] * 100.0,
  20074. km: INCHES_PER_UNIT['Meter'] * 1000.0,
  20075. kmi: INCHES_PER_UNIT['nmi'], //International Nautical Mile
  20076. fath: INCHES_PER_UNIT['Fathom'], //International Fathom
  20077. ch: INCHES_PER_UNIT['IntnlChain'], //International Chain
  20078. link: INCHES_PER_UNIT['IntnlLink'], //International Link
  20079. 'us-in': INCHES_PER_UNIT['inches'], //U.S. Surveyor's Inch
  20080. 'us-ft': INCHES_PER_UNIT['Foot'], //U.S. Surveyor's Foot
  20081. 'us-yd': INCHES_PER_UNIT['Yard'], //U.S. Surveyor's Yard
  20082. 'us-ch': INCHES_PER_UNIT['GunterChain'], //U.S. Surveyor's Chain
  20083. 'us-mi': INCHES_PER_UNIT['Mile'], //U.S. Surveyor's Statute Mile
  20084. 'ind-yd': INCHES_PER_UNIT['IndianYd37'], //Indian Yard
  20085. 'ind-ft': INCHES_PER_UNIT['IndianFt37'], //Indian Foot
  20086. 'ind-ch': 20.11669506 / METERS_PER_INCH //Indian Chain
  20087. });
  20088. //将服务端的地图单位转成SuperMap的地图单位
  20089. INCHES_PER_UNIT['degree'] = INCHES_PER_UNIT.dd;
  20090. INCHES_PER_UNIT['meter'] = INCHES_PER_UNIT.m;
  20091. INCHES_PER_UNIT['foot'] = INCHES_PER_UNIT.ft;
  20092. INCHES_PER_UNIT['inch'] = INCHES_PER_UNIT.inches;
  20093. INCHES_PER_UNIT['mile'] = INCHES_PER_UNIT.mi;
  20094. INCHES_PER_UNIT['kilometer'] = INCHES_PER_UNIT.km;
  20095. INCHES_PER_UNIT['yard'] = INCHES_PER_UNIT.yd;
  20096. function paramToString(param) {
  20097. if (param == undefined || param == null) {
  20098. return '';
  20099. }
  20100. if (param instanceof Date) {
  20101. return param.toJSON();
  20102. }
  20103. if (canBeJsonified(param)) {
  20104. return JSON.stringify(param);
  20105. }
  20106. return param.toString();
  20107. }
  20108. function canBeJsonified(str) {
  20109. if (typeof str !== 'string' && typeof str !== 'object') {
  20110. return false;
  20111. }
  20112. try {
  20113. const type = str.toString();
  20114. return type === '[object Object]' || type === '[object Array]';
  20115. } catch (err) {
  20116. return false;
  20117. }
  20118. }
  20119. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  20120. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20121. * This program are made available under the terms of the Apache License, Version 2.0
  20122. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20123. /**
  20124. * @class LonLat
  20125. * @category BaseTypes Geometry
  20126. * @classdesc 这个类用来表示经度和纬度对。
  20127. * @param {number|Array.<number>} [lon=0.0] - 地图单位上的 X 轴坐标或者横纵坐标组成的数组;如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  20128. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  20129. * @example
  20130. * var lonLat = new LonLat(30,45);
  20131. * @usage
  20132. */
  20133. class LonLat {
  20134. constructor(lon, lat) {
  20135. if (Util_Util.isArray(lon)) {
  20136. lat = lon[1];
  20137. lon = lon[0];
  20138. }
  20139. /**
  20140. * @member {number} [LonLat.prototype.lon=0.0]
  20141. * @description 地图的单位的 X 轴(横轴)坐标。
  20142. */
  20143. this.lon = lon ? Util_Util.toFloat(lon) : 0.0;
  20144. /**
  20145. * @member {number} [LonLat.prototype.lat=0.0]
  20146. * @description 地图的单位的 Y 轴(纵轴)坐标。
  20147. */
  20148. this.lat = lat ? Util_Util.toFloat(lat) : 0.0;
  20149. this.CLASS_NAME = "SuperMap.LonLat";
  20150. }
  20151. /**
  20152. * @function LonLat.prototype.toString
  20153. * @description 返回此对象的字符串形式。
  20154. * @example
  20155. * var lonLat = new LonLat(100,50);
  20156. * var str = lonLat.toString();
  20157. * @returns {string} 例如: "lon=100,lat=50"。
  20158. */
  20159. toString() {
  20160. return ("lon=" + this.lon + ",lat=" + this.lat);
  20161. }
  20162. /**
  20163. * @function LonLat.prototype.toShortString
  20164. * @description 将经度纬度转换成简单字符串。
  20165. * @example
  20166. * var lonLat = new LonLat(100,50);
  20167. * var str = lonLat.toShortString();
  20168. * @returns {string} 处理后的经纬度字符串。例如:"100,50"。
  20169. */
  20170. toShortString() {
  20171. return (this.lon + "," + this.lat);
  20172. }
  20173. /**
  20174. * @function LonLat.prototype.clone
  20175. * @description 复制坐标对象,并返回复制后的新对象。
  20176. * @example
  20177. * var lonLat1 = new LonLat(100,50);
  20178. * var lonLat2 = lonLat1.clone();
  20179. * @returns {LonLat} 相同坐标值的新的坐标对象。
  20180. */
  20181. clone() {
  20182. return new LonLat(this.lon, this.lat);
  20183. }
  20184. /**
  20185. * @function LonLat.prototype.add
  20186. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  20187. * @example
  20188. * var lonLat1 = new LonLat(100,50);
  20189. * //lonLat2 是新的对象
  20190. * var lonLat2 = lonLat1.add(100,50);
  20191. * @param {number} lon - 经度参数。
  20192. * @param {number} lat - 纬度参数。
  20193. * @returns {LonLat} 新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  20194. */
  20195. add(lon, lat) {
  20196. if ((lon == null) || (lat == null)) {
  20197. throw new TypeError('LonLat.add cannot receive null values');
  20198. }
  20199. return new LonLat(this.lon + Util_Util.toFloat(lon),
  20200. this.lat + Util_Util.toFloat(lat));
  20201. }
  20202. /**
  20203. * @function LonLat.prototype.equals
  20204. * @description 判断两个坐标对象是否相等。
  20205. * @example
  20206. * var lonLat1 = new LonLat(100,50);
  20207. * var lonLat2 = new LonLat(100,50);
  20208. * var isEquals = lonLat1.equals(lonLat2);
  20209. * @param {LonLat} ll - 需要进行比较的坐标对象。
  20210. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  20211. * 致或传入的ll参数为NULL则返回false。
  20212. */
  20213. equals(ll) {
  20214. var equals = false;
  20215. if (ll != null) {
  20216. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  20217. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  20218. }
  20219. return equals;
  20220. }
  20221. /**
  20222. * @function LonLat.prototype.wrapDateLine
  20223. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  20224. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  20225. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  20226. * @example
  20227. * var lonLat1 = new LonLat(420,50);
  20228. * var lonLat2 = lonLat1.wrapDateLine(
  20229. * new Bounds(-180,-90,180,90)
  20230. * );
  20231. * @param {Bounds} maxExtent - 最大边界的范围。
  20232. * @returns {LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  20233. */
  20234. wrapDateLine(maxExtent) {
  20235. var newLonLat = this.clone();
  20236. if (maxExtent) {
  20237. //shift right?
  20238. while (newLonLat.lon < maxExtent.left) {
  20239. newLonLat.lon += maxExtent.getWidth();
  20240. }
  20241. //shift left?
  20242. while (newLonLat.lon > maxExtent.right) {
  20243. newLonLat.lon -= maxExtent.getWidth();
  20244. }
  20245. }
  20246. return newLonLat;
  20247. }
  20248. /**
  20249. *
  20250. * @function LonLat.prototype.destroy
  20251. * @description 销毁此对象。
  20252. * 销毁后此对象的所有属性为 null,而不是初始值。
  20253. * @example
  20254. * var lonLat = new LonLat(100,50);
  20255. * lonLat.destroy();
  20256. */
  20257. destroy() {
  20258. this.lon = null;
  20259. this.lat = null;
  20260. }
  20261. /**
  20262. * @function LonLat.fromString
  20263. * @description 通过字符串生成一个 {@link LonLat} 对象。
  20264. * @example
  20265. * var str = "100,50";
  20266. * var lonLat = LonLat.fromString(str);
  20267. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  20268. * @returns {LonLat} {@link LonLat} 对象。
  20269. */
  20270. static fromString(str) {
  20271. var pair = str.split(",");
  20272. return new LonLat(pair[0], pair[1]);
  20273. }
  20274. /**
  20275. * @function LonLat.fromArray
  20276. * @description 通过数组生成一个 {@link LonLat} 对象。
  20277. * @param {Array.<number>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  20278. * @returns {LonLat} {@link LonLat} 对象。
  20279. */
  20280. static fromArray(arr) {
  20281. var gotArr = Util_Util.isArray(arr),
  20282. lon = gotArr && arr[0],
  20283. lat = gotArr && arr[1];
  20284. return new LonLat(lon, lat);
  20285. }
  20286. }
  20287. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  20288. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20289. * This program are made available under the terms of the Apache License, Version 2.0
  20290. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20291. /**
  20292. * @class Bounds
  20293. * @deprecatedclass SuperMap.Bounds
  20294. * @category BaseTypes Geometry
  20295. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  20296. * @param {number|Array.<number>} [left] - 如果是number,则表示左边界,注意考虑宽度,理论上小于 right 值。如果是数组,则表示 [left, bottom, right, top] 左下右上组成的数组。
  20297. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  20298. * @param {number} [right] - 右边界。
  20299. * @param {number} [top] - 上边界。
  20300. * @example
  20301. * var bounds = new Bounds();
  20302. * bounds.extend(new LonLat(4,5));
  20303. * bounds.extend(new LonLat(5,6));
  20304. * bounds.toBBOX(); // returns 4,5,5,6
  20305. * @usage
  20306. */
  20307. class Bounds {
  20308. constructor(left, bottom, right, top) {
  20309. if (Util_Util.isArray(left)) {
  20310. top = left[3];
  20311. right = left[2];
  20312. bottom = left[1];
  20313. left = left[0];
  20314. }
  20315. /**
  20316. * @member {number} Bounds.prototype.left
  20317. * @description 最小的水平坐标系。
  20318. */
  20319. this.left = left != null ? Util_Util.toFloat(left) : this.left;
  20320. /**
  20321. * @member {number} Bounds.prototype.bottom
  20322. * @description 最小的垂直坐标系。
  20323. */
  20324. this.bottom = bottom != null ? Util_Util.toFloat(bottom) : this.bottom;
  20325. /**
  20326. * @member {number} Bounds.prototype.right
  20327. * @description 最大的水平坐标系。
  20328. */
  20329. this.right = right != null ? Util_Util.toFloat(right) : this.right;
  20330. /**
  20331. * @member {number} Bounds.prototype.top
  20332. * @description 最大的垂直坐标系。
  20333. */
  20334. this.top = top != null ? Util_Util.toFloat(top) : this.top;
  20335. /**
  20336. * @member {LonLat} Bounds.prototype.centerLonLat
  20337. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  20338. */
  20339. this.centerLonLat = null;
  20340. this.CLASS_NAME = "SuperMap.Bounds";
  20341. }
  20342. /**
  20343. * @function Bounds.prototype.clone
  20344. * @description 复制当前 bounds 对象。
  20345. * @example
  20346. * var bounds1 = new Bounds(-180,-90,180,90);
  20347. * var bounds2 = bounds1.clone();
  20348. * @returns {Bounds} 克隆后的 bounds。
  20349. */
  20350. clone() {
  20351. return new Bounds(this.left, this.bottom,
  20352. this.right, this.top);
  20353. }
  20354. /**
  20355. * @function Bounds.prototype.equals
  20356. * @description 判断两个 bounds 对象是否相等。
  20357. * @example
  20358. * var bounds1 = new Bounds(-180,-90,180,90);
  20359. * var bounds2 = new Bounds(-180,-90,180,90);
  20360. * var isEquals = bounds1.equals(bounds2);
  20361. * @param {Bounds} bounds - 需要进行计较的 bounds。
  20362. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  20363. */
  20364. equals(bounds) {
  20365. var equals = false;
  20366. if (bounds != null) {
  20367. equals = ((this.left === bounds.left) &&
  20368. (this.right === bounds.right) &&
  20369. (this.top === bounds.top) &&
  20370. (this.bottom === bounds.bottom));
  20371. }
  20372. return equals;
  20373. }
  20374. /**
  20375. * @function Bounds.prototype.toString
  20376. * @description 返回此对象的字符串形式。
  20377. * @example
  20378. * var bounds = new Bounds(-180,-90,180,90);
  20379. * var str = bounds.toString();
  20380. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  20381. */
  20382. toString() {
  20383. return [this.left, this.bottom, this.right, this.top].join(",");
  20384. }
  20385. /**
  20386. * @function Bounds.prototype.toArray
  20387. * @description 边界对象的数组表示形式。
  20388. * @example
  20389. * var bounds = new Bounds(-180,-90,100,80);
  20390. * //array1 = [-180,-90,100,80];
  20391. * var array1 = bounds.toArray();
  20392. * //array1 = [-90,-180,80,100];
  20393. * var array2 = bounds.toArray(true);
  20394. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  20395. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  20396. * @returns {Array.<number>} left, bottom, right, top 数组。
  20397. */
  20398. toArray(reverseAxisOrder) {
  20399. if (reverseAxisOrder === true) {
  20400. return [this.bottom, this.left, this.top, this.right];
  20401. } else {
  20402. return [this.left, this.bottom, this.right, this.top];
  20403. }
  20404. }
  20405. /**
  20406. * @function Bounds.prototype.toBBOX
  20407. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  20408. * @example
  20409. * var bounds = new Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  20410. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  20411. * var str1 = bounds.toBBOX();
  20412. * //str2 = "-1.1,-1.8,1.4,1.6";
  20413. * var str2 = bounds.toBBOX(1);
  20414. * //str2 = "-1.8,-1.1,1.6,1.4";
  20415. * var str2 = bounds.toBBOX(1,true);
  20416. * @param {number} [decimal=6] - 边界方位坐标的有效数字个数。
  20417. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  20418. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  20419. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  20420. */
  20421. toBBOX(decimal, reverseAxisOrder) {
  20422. if (decimal == null) {
  20423. decimal = 6;
  20424. }
  20425. var mult = Math.pow(10, decimal);
  20426. var xmin = Math.round(this.left * mult) / mult;
  20427. var ymin = Math.round(this.bottom * mult) / mult;
  20428. var xmax = Math.round(this.right * mult) / mult;
  20429. var ymax = Math.round(this.top * mult) / mult;
  20430. if (reverseAxisOrder === true) {
  20431. return ymin + "," + xmin + "," + ymax + "," + xmax;
  20432. } else {
  20433. return xmin + "," + ymin + "," + xmax + "," + ymax;
  20434. }
  20435. }
  20436. ///**
  20437. // * @function Bounds.prototype.toGeometry
  20438. // * @description 基于当前边界范围创建一个新的多边形对象。
  20439. // * @example
  20440. // * var bounds = new Bounds(-180,-90,100,80);
  20441. // * // Polygon对象
  20442. // * var geo = bounds.toGeometry();
  20443. // * @returns {GeometryPolygon} 基于当前 bounds 坐标创建的新的多边形。
  20444. // */
  20445. // toGeometry() {
  20446. // return new Polygon([
  20447. // new LinearRing([
  20448. // new Point(this.left, this.bottom),
  20449. // new Point(this.right, this.bottom),
  20450. // new Point(this.right, this.top),
  20451. // new Point(this.left, this.top)
  20452. // ])
  20453. // ]);
  20454. // }
  20455. /**
  20456. * @function Bounds.prototype.getWidth
  20457. * @description 获取 bounds 的宽度。
  20458. * @example
  20459. * var bounds = new Bounds(-180,-90,100,80);
  20460. * //width = 280;
  20461. * var width = bounds.getWidth();
  20462. * @returns {number} 获取当前 bounds 的宽度(right 减去 left)。
  20463. */
  20464. getWidth() {
  20465. return (this.right - this.left);
  20466. }
  20467. /**
  20468. * @function Bounds.prototype.getHeight
  20469. * @description 获取 bounds 的高度。
  20470. * @example
  20471. * var bounds = new Bounds(-180,-90,100,80);
  20472. * //height = 170;
  20473. * var height = bounds.getHeight();
  20474. * @returns {number} 边界高度(top 减去 bottom)。
  20475. */
  20476. getHeight() {
  20477. return (this.top - this.bottom);
  20478. }
  20479. /**
  20480. * @function Bounds.prototype.getSize
  20481. * @description 获取边框大小。
  20482. * @example
  20483. * var bounds = new Bounds(-180,-90,100,80);
  20484. * var size = bounds.getSize();
  20485. * @returns {Size} 边框大小。
  20486. */
  20487. getSize() {
  20488. return new Size(this.getWidth(), this.getHeight());
  20489. }
  20490. /**
  20491. * @function Bounds.prototype.getCenterPixel
  20492. * @description 获取像素格式的范围中心点。
  20493. * @example
  20494. * var bounds = new Bounds(-180,-90,100,80);
  20495. * var pixel = bounds.getCenterPixel();
  20496. * @returns {Pixel} 像素格式的当前范围的中心点。
  20497. */
  20498. getCenterPixel() {
  20499. return new Pixel((this.left + this.right) / 2,
  20500. (this.bottom + this.top) / 2);
  20501. }
  20502. /**
  20503. * @function Bounds.prototype.getCenterLonLat
  20504. * @description 获取地理格式的范围中心点。
  20505. * @example
  20506. * var bounds = new Bounds(-180,-90,100,80);
  20507. * var lonlat = bounds.getCenterLonLat();
  20508. * @returns {LonLat} 当前地理范围的中心点。
  20509. */
  20510. getCenterLonLat() {
  20511. if (!this.centerLonLat) {
  20512. this.centerLonLat = new LonLat(
  20513. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  20514. );
  20515. }
  20516. return this.centerLonLat;
  20517. }
  20518. /**
  20519. * @function Bounds.prototype.scale
  20520. * @description 按照比例扩大/缩小出一个新的 bounds。
  20521. * @example
  20522. * var bounds = new Bounds(-50,-50,40,40);
  20523. * var bounds2 = bounds.scale(2);
  20524. * @param {number} [ratio=1] - 需要扩大的比例。
  20525. * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  20526. * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
  20527. */
  20528. scale(ratio, origin) {
  20529. ratio = ratio ? ratio : 1;
  20530. if (origin == null) {
  20531. origin = this.getCenterLonLat();
  20532. }
  20533. var origx, origy;
  20534. // get origin coordinates
  20535. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  20536. origx = origin.lon;
  20537. origy = origin.lat;
  20538. } else {
  20539. origx = origin.x;
  20540. origy = origin.y;
  20541. }
  20542. var left = (this.left - origx) * ratio + origx;
  20543. var bottom = (this.bottom - origy) * ratio + origy;
  20544. var right = (this.right - origx) * ratio + origx;
  20545. var top = (this.top - origy) * ratio + origy;
  20546. return new Bounds(left, bottom, right, top);
  20547. }
  20548. /**
  20549. * @function Bounds.prototype.add
  20550. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  20551. * @example
  20552. * var bounds1 = new Bounds(-50,-50,40,40);
  20553. * //bounds2 是新的 bounds
  20554. * var bounds2 = bounds.add(20,10);
  20555. * @param {number} x - 坐标点的 x 坐标。
  20556. * @param {number} y - 坐标点的 y 坐标。
  20557. * @returns {Bounds} 新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  20558. */
  20559. add(x, y) {
  20560. if ((x == null) || (y == null)) {
  20561. throw new TypeError('Bounds.add cannot receive null values');
  20562. }
  20563. return new Bounds(this.left + x, this.bottom + y,
  20564. this.right + x, this.top + y);
  20565. }
  20566. /**
  20567. * @function Bounds.prototype.extend
  20568. * @description 在当前 bounds 上扩展 bounds,支持 point,lonlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  20569. * @example
  20570. * var bounds1 = new Bounds(-50,-50,40,40);
  20571. * //bounds 改变
  20572. * bounds.extend(new LonLat(50,60));
  20573. * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。
  20574. */
  20575. extend(object) {
  20576. var bounds = null;
  20577. if (object) {
  20578. // clear cached center location
  20579. switch (object.CLASS_NAME) {
  20580. case "SuperMap.LonLat":
  20581. bounds = new Bounds(object.lon, object.lat,
  20582. object.lon, object.lat);
  20583. break;
  20584. case "SuperMap.Geometry.Point":
  20585. bounds = new Bounds(object.x, object.y,
  20586. object.x, object.y);
  20587. break;
  20588. case "SuperMap.Bounds":
  20589. bounds = object;
  20590. break;
  20591. }
  20592. if (bounds) {
  20593. this.centerLonLat = null;
  20594. if ((this.left == null) || (bounds.left < this.left)) {
  20595. this.left = bounds.left;
  20596. }
  20597. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  20598. this.bottom = bounds.bottom;
  20599. }
  20600. if ((this.right == null) || (bounds.right > this.right)) {
  20601. this.right = bounds.right;
  20602. }
  20603. if ((this.top == null) || (bounds.top > this.top)) {
  20604. this.top = bounds.top;
  20605. }
  20606. }
  20607. }
  20608. }
  20609. /**
  20610. * @function Bounds.prototype.containsLonLat
  20611. * @description 判断传入的坐标是否在范围内。
  20612. * @example
  20613. * var bounds1 = new Bounds(-50,-50,40,40);
  20614. * //isContains1 = true
  20615. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  20616. * var isContains1 = bounds.containsLonLat(new LonLat(40,40),true);
  20617. *
  20618. * //(40,40)在范围内,同样(40+360,40)也在范围内
  20619. * var bounds2 = new Bounds(-50,-50,40,40);
  20620. * //isContains2 = true;
  20621. * var isContains2 = bounds2.containsLonLat(
  20622. * new LonLat(400,40),
  20623. * {
  20624. * inclusive:true,
  20625. * //全球的范围
  20626. * worldBounds: new Bounds(-180,-90,180,90)
  20627. * }
  20628. * );
  20629. * @param {(LonLat|Object)} ll - <LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  20630. * @param {Object} options - 可选参数。
  20631. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  20632. * @param {Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  20633. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  20634. * @returns {boolean} 传入坐标是否包含在范围内。
  20635. */
  20636. containsLonLat(ll, options) {
  20637. if (typeof options === "boolean") {
  20638. options = {inclusive: options};
  20639. }
  20640. options = options || {};
  20641. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  20642. worldBounds = options.worldBounds;
  20643. //日界线以外的也有可能算包含,
  20644. if (worldBounds && !contains) {
  20645. var worldWidth = worldBounds.getWidth();
  20646. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  20647. //这一步很关键
  20648. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  20649. contains = this.containsLonLat({
  20650. lon: ll.lon - worldsAway * worldWidth,
  20651. lat: ll.lat
  20652. }, {inclusive: options.inclusive});
  20653. }
  20654. return contains;
  20655. }
  20656. /**
  20657. * @function Bounds.prototype.containsPixel
  20658. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  20659. * @example
  20660. * var bounds = new Bounds(-50,-50,40,40);
  20661. * //isContains = true
  20662. * var isContains = bounds.containsPixel(new Pixel(40,40),true);
  20663. * @param {Pixel} px - 提供的像素参数。
  20664. * @param {boolean} [inclusive=true] - 是否包含边界。
  20665. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  20666. */
  20667. containsPixel(px, inclusive) {
  20668. return this.contains(px.x, px.y, inclusive);
  20669. }
  20670. /**
  20671. * @function Bounds.prototype.contains
  20672. * @description 判断传入的 x,y 坐标值是否在范围内。
  20673. * @example
  20674. * var bounds = new Bounds(-50,-50,40,40);
  20675. * //isContains = true
  20676. * var isContains = bounds.contains(40,40,true);
  20677. * @param {number} x - x 坐标值。
  20678. * @param {number} y - y 坐标值。
  20679. * @param {boolean} [inclusive=true] - 是否包含边界。
  20680. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  20681. */
  20682. contains(x, y, inclusive) {
  20683. //set default
  20684. if (inclusive == null) {
  20685. inclusive = true;
  20686. }
  20687. if (x == null || y == null) {
  20688. return false;
  20689. }
  20690. //x = Util.toFloat(x);
  20691. //y = Util.toFloat(y);
  20692. var contains = false;
  20693. if (inclusive) {
  20694. contains = ((x >= this.left) && (x <= this.right) &&
  20695. (y >= this.bottom) && (y <= this.top));
  20696. } else {
  20697. contains = ((x > this.left) && (x < this.right) &&
  20698. (y > this.bottom) && (y < this.top));
  20699. }
  20700. return contains;
  20701. }
  20702. /**
  20703. * @function Bounds.prototype.intersectsBounds
  20704. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  20705. * @example
  20706. * var bounds = new Bounds(-180,-90,100,80);
  20707. * var isIntersects = bounds.intersectsBounds(
  20708. * new Bounds(-170,-90,120,80)
  20709. * );
  20710. * @param {Bounds} bounds - 目标边界。
  20711. * @param {Object} options - 参数。
  20712. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,两个边界范围没有重叠部分仅仅是在边缘相接(重合),这种情况被认为没有相交。
  20713. * @param {Bounds} [options.worldBounds] - 提供了 worldBounds 参数,如果他们相交时是在全球范围内,两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  20714. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  20715. */
  20716. intersectsBounds(bounds, options) {
  20717. if (typeof options === "boolean") {
  20718. options = {inclusive: options};
  20719. }
  20720. options = options || {};
  20721. if (options.worldBounds) {
  20722. var self = this.wrapDateLine(options.worldBounds);
  20723. bounds = bounds.wrapDateLine(options.worldBounds);
  20724. } else {
  20725. self = this;
  20726. }
  20727. if (options.inclusive == null) {
  20728. options.inclusive = true;
  20729. }
  20730. var intersects = false;
  20731. var mightTouch = (
  20732. self.left === bounds.right ||
  20733. self.right === bounds.left ||
  20734. self.top === bounds.bottom ||
  20735. self.bottom === bounds.top
  20736. );
  20737. // if the two bounds only touch at an edge, and inclusive is false,
  20738. // then the bounds don't *really* intersect.
  20739. if (options.inclusive || !mightTouch) {
  20740. // otherwise, if one of the boundaries even partially contains another,
  20741. // inclusive of the edges, then they do intersect.
  20742. var inBottom = (
  20743. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  20744. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  20745. );
  20746. var inTop = (
  20747. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  20748. ((self.top > bounds.bottom) && (self.top < bounds.top))
  20749. );
  20750. var inLeft = (
  20751. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  20752. ((self.left >= bounds.left) && (self.left <= bounds.right))
  20753. );
  20754. var inRight = (
  20755. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  20756. ((self.right >= bounds.left) && (self.right <= bounds.right))
  20757. );
  20758. intersects = ((inBottom || inTop) && (inLeft || inRight));
  20759. }
  20760. // document me
  20761. if (options.worldBounds && !intersects) {
  20762. var world = options.worldBounds;
  20763. var width = world.getWidth();
  20764. var selfCrosses = !world.containsBounds(self);
  20765. var boundsCrosses = !world.containsBounds(bounds);
  20766. if (selfCrosses && !boundsCrosses) {
  20767. bounds = bounds.add(-width, 0);
  20768. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  20769. } else if (boundsCrosses && !selfCrosses) {
  20770. self = self.add(-width, 0);
  20771. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  20772. }
  20773. }
  20774. return intersects;
  20775. }
  20776. /**
  20777. * @function Bounds.prototype.containsBounds
  20778. * @description 判断目标边界是否被当前边界包含在内。
  20779. * @example
  20780. * var bounds = new Bounds(-180,-90,100,80);
  20781. * var isContains = bounds.containsBounds(
  20782. * new Bounds(-170,-90,100,80),true,true
  20783. * );
  20784. * @param {Bounds} bounds - 目标边界。
  20785. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  20786. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  20787. * @param {boolean} [inclusive=true] - 边缘共享是否被视为包含。
  20788. * @returns {boolean} 传入的边界是否被当前边界包含。
  20789. */
  20790. containsBounds(bounds, partial, inclusive) {
  20791. if (partial == null) {
  20792. partial = false;
  20793. }
  20794. if (inclusive == null) {
  20795. inclusive = true;
  20796. }
  20797. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  20798. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  20799. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  20800. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  20801. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  20802. : (bottomLeft && bottomRight && topLeft && topRight);
  20803. }
  20804. /**
  20805. * @function Bounds.prototype.determineQuadrant
  20806. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  20807. * @example
  20808. * var bounds = new Bounds(-180,-90,100,80);
  20809. * //str = "tr";
  20810. * var str = bounds.determineQuadrant(
  20811. * new LonLat(20,20)
  20812. * );
  20813. * @param {LonLat} lonlat - 传入的坐标对象。
  20814. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  20815. */
  20816. determineQuadrant(lonlat) {
  20817. var quadrant = "";
  20818. var center = this.getCenterLonLat();
  20819. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  20820. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  20821. return quadrant;
  20822. }
  20823. /**
  20824. * @function Bounds.prototype.wrapDateLine
  20825. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  20826. * @example
  20827. * var bounds = new Bounds(380,-40,400,-20);
  20828. * var maxExtent = new Bounds(-180,-90,100,80);
  20829. * //新的bounds
  20830. * var newBounds = bounds.wrapDateLine(maxExtent);
  20831. * @param {Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  20832. * @param {Object} options - 可选选项参数。
  20833. * @param {number} [options.leftTolerance=0] - left 允许的误差。
  20834. * @param {number} [options.rightTolerance=0] - right 允许的误差。
  20835. * @returns {Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  20836. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  20837. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  20838. */
  20839. wrapDateLine(maxExtent, options) {
  20840. options = options || {};
  20841. var leftTolerance = options.leftTolerance || 0;
  20842. var rightTolerance = options.rightTolerance || 0;
  20843. var newBounds = this.clone();
  20844. if (maxExtent) {
  20845. var width = maxExtent.getWidth();
  20846. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  20847. //shift right?
  20848. while (newBounds.left < maxExtent.left &&
  20849. newBounds.right - rightTolerance <= maxExtent.left) {
  20850. newBounds = newBounds.add(width, 0);
  20851. }
  20852. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  20853. //shift left?
  20854. while (newBounds.left + leftTolerance >= maxExtent.right &&
  20855. newBounds.right > maxExtent.right) {
  20856. newBounds = newBounds.add(-width, 0);
  20857. }
  20858. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  20859. // crosses right only? force left
  20860. var newLeft = newBounds.left + leftTolerance;
  20861. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  20862. newBounds.right - rightTolerance > maxExtent.right) {
  20863. newBounds = newBounds.add(-width, 0);
  20864. }
  20865. }
  20866. return newBounds;
  20867. }
  20868. /**
  20869. * @function Bounds.prototype.toServerJSONObject
  20870. * @description 转换成对应的 JSON 格式对象。
  20871. * @example
  20872. * var bounds = new Bounds(-180,-90,100,80);
  20873. * var obj = bounds.toServerJSONObject();
  20874. * @returns {Object} JSON 格式的 Object 对象。
  20875. */
  20876. toServerJSONObject() {
  20877. var jsonObject = {
  20878. rightTop: {x: this.right, y: this.top},
  20879. leftBottom: {x: this.left, y: this.bottom},
  20880. left: this.left,
  20881. right: this.right,
  20882. top: this.top,
  20883. bottom: this.bottom
  20884. }
  20885. return jsonObject;
  20886. }
  20887. /**
  20888. *
  20889. * @function Bounds.prototype.destroy
  20890. * @description 销毁此对象。
  20891. * 销毁后此对象的所有属性为 null,而不是初始值。
  20892. * @example
  20893. * var bounds = new Bounds(-180,-90,100,80);
  20894. * bounds.destroy();
  20895. */
  20896. destroy() {
  20897. this.left = null;
  20898. this.right = null;
  20899. this.top = null;
  20900. this.bottom = null;
  20901. this.centerLonLat = null;
  20902. }
  20903. /**
  20904. * @function Bounds.fromString
  20905. * @description 通过字符串参数创建新的 bounds 的构造函数。
  20906. * @example
  20907. * var bounds = Bounds.fromString("-180,-90,100,80");
  20908. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  20909. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  20910. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  20911. * @returns {Bounds} 给定的字符串创建的新的边界对象。
  20912. */
  20913. static fromString(str, reverseAxisOrder) {
  20914. var bounds = str.split(",");
  20915. return Bounds.fromArray(bounds, reverseAxisOrder);
  20916. }
  20917. /**
  20918. * @function Bounds.fromArray
  20919. * @description 通过边界框数组创建 Bounds。
  20920. * @example
  20921. * var bounds = Bounds.fromArray([-180,-90,100,80]);
  20922. * @param {Array.<number>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  20923. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  20924. * @returns {Bounds} 根据传入的数组创建的新的边界对象。
  20925. */
  20926. static fromArray(bbox, reverseAxisOrder) {
  20927. return reverseAxisOrder === true ?
  20928. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  20929. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  20930. }
  20931. /**
  20932. * @function Bounds.fromSize
  20933. * @description 通过传入的边界大小来创建新的边界。
  20934. * @example
  20935. * var bounds = Bounds.fromSize(new Size(20,10));
  20936. * @param {Size} size - 边界大小。
  20937. * @returns {Bounds} 根据传入的边界大小的创建新的边界。
  20938. */
  20939. static fromSize(size) {
  20940. return new Bounds(0,
  20941. size.h,
  20942. size.w,
  20943. 0);
  20944. }
  20945. /**
  20946. * @function Bounds.oppositeQuadrant
  20947. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  20948. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  20949. * @returns {string} 反转后的象限。
  20950. */
  20951. static oppositeQuadrant(quadrant) {
  20952. var opp = "";
  20953. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  20954. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  20955. return opp;
  20956. }
  20957. }
  20958. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  20959. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20960. * This program are made available under the terms of the Apache License, Version 2.0
  20961. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20962. /**
  20963. * @class GeometryCollection
  20964. * @aliasclass Geometry.Collection
  20965. * @deprecatedclass SuperMap.Geometry.Collection
  20966. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  20967. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  20968. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  20969. * @category BaseTypes Geometry
  20970. * @extends {Geometry}
  20971. * @param {Array.<Geometry>} components - 几何对象数组。
  20972. * @example
  20973. * var point1 = new GeometryPoint(10,20);
  20974. * var point2 = new GeometryPoint(30,40);
  20975. * var col = new GeometryCollection([point1,point2]);
  20976. * @usage
  20977. */
  20978. class Collection extends Geometry_Geometry {
  20979. constructor(components) {
  20980. super();
  20981. /**
  20982. * @description 存储几何对象的数组。
  20983. * @member {Array.<Geometry>} GeometryCollection.prototype.components
  20984. */
  20985. this.components = [];
  20986. /**
  20987. * @member {Array.<string>} GeometryCollection.prototype.componentTypes
  20988. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  20989. */
  20990. this.componentTypes = null;
  20991. if (components != null) {
  20992. this.addComponents(components);
  20993. }
  20994. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  20995. this.geometryType = "Collection";
  20996. }
  20997. /**
  20998. * @function GeometryCollection.prototype.destroy
  20999. * @description 销毁几何图形。
  21000. */
  21001. destroy() {
  21002. this.components.length = 0;
  21003. this.components = null;
  21004. super.destroy();
  21005. }
  21006. /**
  21007. * @function GeometryCollection.prototype.clone
  21008. * @description 克隆当前几何对象。
  21009. * @returns {GeometryCollection} 克隆的几何对象集合。
  21010. */
  21011. clone() {
  21012. var geometry = new Collection();
  21013. for (var i = 0, len = this.components.length; i < len; i++) {
  21014. geometry.addComponent(this.components[i].clone());
  21015. }
  21016. // catch any randomly tagged-on properties
  21017. Util_Util.applyDefaults(geometry, this);
  21018. return geometry;
  21019. }
  21020. /**
  21021. * @function GeometryCollection.prototype.getComponentsString
  21022. * @description 获取 components 字符串。
  21023. * @returns {string} components 字符串。
  21024. */
  21025. getComponentsString() {
  21026. var strings = [];
  21027. for (var i = 0, len = this.components.length; i < len; i++) {
  21028. strings.push(this.components[i].toShortString());
  21029. }
  21030. return strings.join(",");
  21031. }
  21032. /**
  21033. * @function GeometryCollection.prototype.calculateBounds
  21034. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  21035. */
  21036. calculateBounds() {
  21037. this.bounds = null;
  21038. var bounds = new Bounds();
  21039. var components = this.components;
  21040. if (components) {
  21041. for (var i = 0, len = components.length; i < len; i++) {
  21042. bounds.extend(components[i].getBounds());
  21043. }
  21044. }
  21045. // to preserve old behavior, we only set bounds if non-null
  21046. // in the future, we could add bounds.isEmpty()
  21047. if (bounds.left != null && bounds.bottom != null &&
  21048. bounds.right != null && bounds.top != null) {
  21049. this.setBounds(bounds);
  21050. }
  21051. }
  21052. /**
  21053. * @function GeometryCollection.prototype.addComponents
  21054. * @description 给几何图形对象添加元素。
  21055. * @param {Array.<Geometry>} components - 几何对象组件。
  21056. * @example
  21057. * var geometryCollection = new GeometryCollection();
  21058. * geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10));
  21059. */
  21060. addComponents(components) {
  21061. if (!(Util_Util.isArray(components))) {
  21062. components = [components];
  21063. }
  21064. for (var i = 0, len = components.length; i < len; i++) {
  21065. this.addComponent(components[i]);
  21066. }
  21067. }
  21068. /**
  21069. * @function GeometryCollection.prototype.addComponent
  21070. * @description 添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  21071. * @param {Geometry} component - 待添加的几何对象。
  21072. * @param {number} [index] - 几何对象插入的位置。
  21073. * @returns {boolean} 是否添加成功。
  21074. */
  21075. addComponent(component, index) {
  21076. var added = false;
  21077. if (component) {
  21078. if (this.componentTypes == null ||
  21079. (Util_Util.indexOf(this.componentTypes,
  21080. component.CLASS_NAME) > -1)) {
  21081. if (index != null && (index < this.components.length)) {
  21082. var components1 = this.components.slice(0, index);
  21083. var components2 = this.components.slice(index,
  21084. this.components.length);
  21085. components1.push(component);
  21086. this.components = components1.concat(components2);
  21087. } else {
  21088. this.components.push(component);
  21089. }
  21090. component.parent = this;
  21091. this.clearBounds();
  21092. added = true;
  21093. }
  21094. }
  21095. return added;
  21096. }
  21097. /**
  21098. * @function GeometryCollection.prototype.removeComponents
  21099. * @description 清除几何对象。
  21100. * @param {Array.<Geometry>} components - 需要清除的几何对象。
  21101. * @returns {boolean} 元素是否被删除。
  21102. */
  21103. removeComponents(components) {
  21104. var removed = false;
  21105. if (!(Util_Util.isArray(components))) {
  21106. components = [components];
  21107. }
  21108. for (var i = components.length - 1; i >= 0; --i) {
  21109. removed = this.removeComponent(components[i]) || removed;
  21110. }
  21111. return removed;
  21112. }
  21113. /**
  21114. * @function GeometryCollection.prototype.removeComponent
  21115. * @description 从集合中移除几何对象。
  21116. * @param {Geometry} component - 要移除的几何对象。
  21117. * @returns {boolean} 几何对象是否移除成功。
  21118. */
  21119. removeComponent(component) {
  21120. Util_Util.removeItem(this.components, component);
  21121. // clearBounds() so that it gets recalculated on the next call
  21122. // to this.getBounds();
  21123. this.clearBounds();
  21124. return true;
  21125. }
  21126. /**
  21127. * @function GeometryCollection.prototype.getArea
  21128. * @description 计算几何对象的面积。注意,这个方法在 {@link GeometryPolygon} 类中需要重写。
  21129. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  21130. */
  21131. getArea() {
  21132. var area = 0.0;
  21133. for (var i = 0, len = this.components.length; i < len; i++) {
  21134. area += this.components[i].getArea();
  21135. }
  21136. return area;
  21137. }
  21138. /**
  21139. * @function GeometryCollection.prototype.equals
  21140. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  21141. * @param {Geometry} geometry - 需要判断的几何图形。
  21142. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  21143. */
  21144. equals(geometry) {
  21145. var equivalent = true;
  21146. if (!geometry || !geometry.CLASS_NAME ||
  21147. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  21148. equivalent = false;
  21149. } else if (!(Util_Util.isArray(geometry.components)) ||
  21150. (geometry.components.length !== this.components.length)) {
  21151. equivalent = false;
  21152. } else {
  21153. for (var i = 0, len = this.components.length; i < len; ++i) {
  21154. if (!this.components[i].equals(geometry.components[i])) {
  21155. equivalent = false;
  21156. break;
  21157. }
  21158. }
  21159. }
  21160. return equivalent;
  21161. }
  21162. /**
  21163. * @function GeometryCollection.prototype.getVertices
  21164. * @description 返回几何对象的所有结点的列表。
  21165. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  21166. * @returns {Array} 几何对象的顶点列表。
  21167. */
  21168. getVertices(nodes) {
  21169. var vertices = [];
  21170. for (var i = 0, len = this.components.length; i < len; ++i) {
  21171. Array.prototype.push.apply(
  21172. vertices, this.components[i].getVertices(nodes)
  21173. );
  21174. }
  21175. return vertices;
  21176. }
  21177. }
  21178. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  21179. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21180. * This program are made available under the terms of the Apache License, Version 2.0
  21181. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21182. /**
  21183. * @class GeometryMultiPoint
  21184. * @aliasclass Geometry.MultiPoint
  21185. * @deprecatedclass SuperMap.Geometry.MultiPoint
  21186. * @classdesc 几何对象多点类。
  21187. * @category BaseTypes Geometry
  21188. * @extends GeometryCollection
  21189. * @param {Array.<GeometryPoint>} components - 点对象数组。
  21190. * @example
  21191. * var point1 = new GeometryPoint(5,6);
  21192. * var poine2 = new GeometryMultiPoint(7,8);
  21193. * var multiPoint = new MultiPoint([point1,point2]);
  21194. * @usage
  21195. */
  21196. class MultiPoint extends Collection {
  21197. constructor(components) {
  21198. super(components);
  21199. /**
  21200. * @member {Array.<string>} [GeometryMultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  21201. * @description components 存储的几何对象所支持的几何类型数组。
  21202. * @readonly
  21203. */
  21204. this.componentTypes = ["SuperMap.Geometry.Point"];
  21205. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  21206. this.geometryType = "MultiPoint";
  21207. }
  21208. /**
  21209. * @function GeometryMultiPoint.prototype.addPoint
  21210. * @description 添加点,封装了 {@link GeometryCollection|GeometryCollection.addComponent} 方法。
  21211. * @param {GeometryPoint} point - 添加的点。
  21212. * @param {number} [index] - 下标。
  21213. */
  21214. addPoint(point, index) {
  21215. this.addComponent(point, index);
  21216. }
  21217. /**
  21218. * @function GeometryMultiPoint.prototype.removePoint
  21219. * @description 移除点,封装了 {@link GeometryCollection|GeometryCollection.removeComponent} 方法。
  21220. * @param {GeometryPoint} point - 移除的点对象。
  21221. */
  21222. removePoint(point) {
  21223. this.removeComponent(point);
  21224. }
  21225. }
  21226. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  21227. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21228. * This program are made available under the terms of the Apache License, Version 2.0
  21229. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21230. /**
  21231. * @class GeometryCurve
  21232. * @aliasclass Geometry.Curve
  21233. * @deprecatedclass SuperMap.Geometry.Curve
  21234. * @classdesc 几何对象曲线类。
  21235. * @category BaseTypes Geometry
  21236. * @extends GeometryMultiPoint
  21237. * @param {Array.<GeometryPoint>} components - 几何对象数组。
  21238. * @example
  21239. * var point1 = new GeometryPoint(10,20);
  21240. * var point2 = new GeometryPoint(30,40);
  21241. * var curve = new Curve([point1,point2]);
  21242. * @usage
  21243. */
  21244. class Curve extends MultiPoint {
  21245. constructor(components) {
  21246. super(components);
  21247. /**
  21248. * @member {Array.<string>} [GeometryCurve.prototype.componentTypes=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  21249. * @description components 存储的几何对象所支持的几何类型数组。
  21250. * @readonly
  21251. */
  21252. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  21253. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  21254. this.geometryType = "Curve";
  21255. }
  21256. }
  21257. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  21258. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21259. * This program are made available under the terms of the Apache License, Version 2.0
  21260. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21261. /**
  21262. * @class GeometryPoint
  21263. * @aliasclass Geometry.Point
  21264. * @deprecatedclass SuperMap.Geometry.Point
  21265. * @classdesc 点几何对象类。
  21266. * @category BaseTypes Geometry
  21267. * @extends {Geometry}
  21268. * @param {number} x - x 坐标。
  21269. * @param {number} y - y 坐标。
  21270. * @param {string} [type = 'Point'] - 点的类型。
  21271. * @param {number} [tag] - 额外的属性,比如插值分析中的 Z 值。
  21272. * @example
  21273. * var point = new GeometryPoint(-111.04, 45.68);
  21274. * @usage
  21275. */
  21276. class Point extends Geometry_Geometry {
  21277. constructor(x, y, type, tag) {
  21278. super(x, y, type, tag);
  21279. /**
  21280. * @member {number} GeometryPoint.prototype.x
  21281. * @description 横坐标。
  21282. */
  21283. this.x = parseFloat(x);
  21284. /**
  21285. * @member {number} GeometryPoint.prototype.y
  21286. * @description 纵坐标。
  21287. */
  21288. this.y = parseFloat(y);
  21289. /**
  21290. * @member {string} GeometryPoint.prototype.tag
  21291. * @description 用来存储额外的属性,比如插值分析中的 Z 值。
  21292. */
  21293. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  21294. /**
  21295. * @member {string} GeometryPoint.prototype.type
  21296. * @description 用来存储点的类型。
  21297. */
  21298. this.type = type || "Point";
  21299. this.CLASS_NAME = "SuperMap.Geometry.Point";
  21300. this.geometryType = "Point";
  21301. }
  21302. /**
  21303. * @function GeometryPoint.prototype.clone
  21304. * @description 克隆点对象。
  21305. * @returns {GeometryPoint} 克隆后的点对象。
  21306. */
  21307. clone(obj) {
  21308. if (obj == null) {
  21309. obj = new Point(this.x, this.y);
  21310. }
  21311. // catch any randomly tagged-on properties
  21312. Util_Util.applyDefaults(obj, this);
  21313. return obj;
  21314. }
  21315. /**
  21316. * @function GeometryPoint.prototype.calculateBounds
  21317. * @description 计算点对象的范围。
  21318. */
  21319. calculateBounds() {
  21320. this.bounds = new Bounds(this.x, this.y,
  21321. this.x, this.y);
  21322. }
  21323. /**
  21324. * @function GeometryPoint.prototype.equals
  21325. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  21326. * @example
  21327. * var point= new GeometryPoint(0,0);
  21328. * var point1={x:0,y:0};
  21329. * var result= point.equals(point1);
  21330. * @param {GeometryPoint} geom - 需要判断的点对象。
  21331. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  21332. */
  21333. equals(geom) {
  21334. var equals = false;
  21335. if (geom != null) {
  21336. equals = ((this.x === geom.x && this.y === geom.y) ||
  21337. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  21338. }
  21339. return equals;
  21340. }
  21341. /**
  21342. * @function GeometryPoint.prototype.move
  21343. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  21344. * @param {number} x - x 轴正方向上的偏移量。
  21345. * @param {number} y - y 轴正方向上偏移量。
  21346. */
  21347. move(x, y) {
  21348. this.x = this.x + x;
  21349. this.y = this.y + y;
  21350. this.clearBounds();
  21351. }
  21352. /**
  21353. * @function GeometryPoint.prototype.toShortString
  21354. * @description 将 x/y 坐标转换成简单字符串。
  21355. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  21356. */
  21357. toShortString() {
  21358. return (this.x + ", " + this.y);
  21359. }
  21360. /**
  21361. * @function GeometryPoint.prototype.destroy
  21362. * @description 释放点对象的资源。
  21363. */
  21364. destroy() {
  21365. this.x = null;
  21366. this.y = null;
  21367. this.tag = null;
  21368. super.destroy();
  21369. }
  21370. /**
  21371. * @function GeometryPoint.prototype.getVertices
  21372. * @description 获取几何图形所有顶点的列表。
  21373. * @returns {Array} 几何图形的顶点列表。
  21374. */
  21375. getVertices() {
  21376. return [this];
  21377. }
  21378. }
  21379. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  21380. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21381. * This program are made available under the terms of the Apache License, Version 2.0
  21382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21383. /**
  21384. * @class GeometryLineString
  21385. * @aliasclass Geometry.LineString
  21386. * @deprecatedclass SuperMap.Geometry.LineString
  21387. * @classdesc 几何对象线串类。
  21388. * @category BaseTypes Geometry
  21389. * @param {Array.<GeometryPoint>} points - 用来生成线串的点数组。
  21390. * @extends GeometryCurve
  21391. * @example
  21392. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  21393. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  21394. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  21395. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  21396. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  21397. * var roadLine = new GeometryLineString(points);
  21398. * @usage
  21399. */
  21400. class LineString extends Curve {
  21401. constructor(points) {
  21402. super(points);
  21403. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  21404. this.geometryType = "LineString";
  21405. }
  21406. /**
  21407. * @function GeometryLineString.prototype.removeComponent
  21408. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  21409. * @param {GeometryPoint} point - 将被删除的点。
  21410. * @returns {boolean} 删除的点。
  21411. */
  21412. removeComponent(point) { // eslint-disable-line no-unused-vars
  21413. var removed = this.components && (this.components.length > 2);
  21414. if (removed) {
  21415. super.removeComponent.apply(this, arguments);
  21416. }
  21417. return removed;
  21418. }
  21419. /**
  21420. * @function GeometryLineString.prototype.getSortedSegments
  21421. * @description 获取升序排列的点坐标对象数组。
  21422. * @returns {Array} 升序排列的点坐标对象数组。
  21423. */
  21424. getSortedSegments() {
  21425. var numSeg = this.components.length - 1;
  21426. var segments = new Array(numSeg), point1, point2;
  21427. for (var i = 0; i < numSeg; ++i) {
  21428. point1 = this.components[i];
  21429. point2 = this.components[i + 1];
  21430. if (point1.x < point2.x) {
  21431. segments[i] = {
  21432. x1: point1.x,
  21433. y1: point1.y,
  21434. x2: point2.x,
  21435. y2: point2.y
  21436. };
  21437. } else {
  21438. segments[i] = {
  21439. x1: point2.x,
  21440. y1: point2.y,
  21441. x2: point1.x,
  21442. y2: point1.y
  21443. };
  21444. }
  21445. }
  21446. // more efficient to define this somewhere static
  21447. function byX1(seg1, seg2) {
  21448. return seg1.x1 - seg2.x1;
  21449. }
  21450. return segments.sort(byX1);
  21451. }
  21452. /**
  21453. * @function GeometryLineString.prototype.getVertices
  21454. * @description 返回几何图形的所有顶点的列表。
  21455. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  21456. * @returns {Array} 几何图形的顶点列表。
  21457. */
  21458. getVertices(nodes) {
  21459. var vertices;
  21460. if (nodes === true) {
  21461. vertices = [
  21462. this.components[0],
  21463. this.components[this.components.length - 1]
  21464. ];
  21465. } else if (nodes === false) {
  21466. vertices = this.components.slice(1, this.components.length - 1);
  21467. } else {
  21468. vertices = this.components.slice();
  21469. }
  21470. return vertices;
  21471. }
  21472. /**
  21473. * @function GeometryLineString.calculateCircle
  21474. * @description 三点画圆弧。
  21475. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  21476. * @returns {Array.<GeometryPoint>} 计算出相应的圆弧控制点。
  21477. * @example
  21478. * var points = [];
  21479. * points.push(new GeometryPoint(-50,30));
  21480. * points.push(new GeometryPoint(-30,50));
  21481. * points.push(new GeometryPoint(2,60));
  21482. * var circle = GeometryLineString.calculateCircle(points);
  21483. */
  21484. static calculateCircle(points) {
  21485. if (points.length < 3) {
  21486. return points
  21487. }
  21488. var centerPoint = {},
  21489. p1 = points[0],
  21490. p2 = points[1],
  21491. p3 = points[2];
  21492. var R = 0,
  21493. dStep = 0,
  21494. direc = true,
  21495. dRotation = 0,
  21496. dRotationBegin = 0,
  21497. dRotationAngle = 0,
  21498. nSegmentCount = 72,
  21499. circlePoints = [];
  21500. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  21501. var B13 = p3.y - KTan13 * p3.x;
  21502. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  21503. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  21504. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  21505. circlePoints.push(p1);
  21506. circlePoints.push(p2);
  21507. circlePoints.push(p3);
  21508. } else {
  21509. var D = ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y)) * (2 * (p3.y - p1.y)) - ((p3.x * p3.x + p3.y * p3.y) -
  21510. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  21511. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  21512. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  21513. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  21514. centerPoint.x = D / F;
  21515. centerPoint.y = E / F;
  21516. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  21517. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  21518. var cons = (2 * R * R - dis) / (2 * R * R);
  21519. cons = cons >= 1 ? 1 : cons;
  21520. cons = cons <= -1 ? -1 : cons;
  21521. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  21522. if (p3.x == p1.x) {
  21523. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  21524. } else {
  21525. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  21526. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  21527. }
  21528. dStep = dRotationAngle / 72;
  21529. if (p3.y != p1.y) {
  21530. if (p3.x == p1.x) {
  21531. if (p3.y > p1.y) {
  21532. if (p2.x < p1.x) {
  21533. direc = false;
  21534. }
  21535. } else {
  21536. if (p2.x > p1.x) {
  21537. direc = false;
  21538. }
  21539. }
  21540. } else if (p3.x < p1.x) {
  21541. if (p2.y < KTan13 * p2.x + B13) {
  21542. direc = false;
  21543. }
  21544. } else {
  21545. if (p2.y > KTan13 * p2.x + B13) {
  21546. direc = false;
  21547. }
  21548. }
  21549. } else {
  21550. if (p3.x > p1.x) {
  21551. if (p2.y > p1.y) {
  21552. direc = false;
  21553. }
  21554. } else {
  21555. if (p2.y < p1.y) {
  21556. direc = false;
  21557. }
  21558. }
  21559. }
  21560. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  21561. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  21562. var CY = Math.abs(centerPoint.y);
  21563. if ((p1.y == CY) && (CY == p3.y)) {
  21564. if (p1.x < p3.x) {
  21565. atan10 = atan10 + 180;
  21566. }
  21567. }
  21568. var newPY = p1.y - centerPoint.y;
  21569. circlePoints.push(p1);
  21570. for (var i = 1; i < nSegmentCount; i++) {
  21571. dRotation = dStep * i;
  21572. dRotationBegin = atan10;
  21573. if (direc) {
  21574. if (newPY >= 0) {
  21575. if (K10 >= 0) {
  21576. dRotationBegin = dRotationBegin + dRotation;
  21577. } else {
  21578. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  21579. }
  21580. } else {
  21581. if (K10 > 0) {
  21582. dRotationBegin = (dRotationBegin - 180) + dRotation;
  21583. } else {
  21584. dRotationBegin = (90 - dRotationBegin) + dRotation;
  21585. }
  21586. }
  21587. } else {
  21588. if (newPY >= 0) {
  21589. if (K10 >= 0) {
  21590. dRotationBegin = dRotationBegin - dRotation;
  21591. } else {
  21592. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  21593. }
  21594. } else {
  21595. if (K10 >= 0) {
  21596. dRotationBegin = (dRotationBegin - 180) - dRotation;
  21597. } else {
  21598. dRotationBegin = (90 - dRotationBegin) - dRotation;
  21599. }
  21600. }
  21601. }
  21602. dRotationBegin = dRotationBegin * Math.PI / 180;
  21603. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  21604. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  21605. circlePoints.push(new Point(x, y));
  21606. }
  21607. circlePoints.push(p3);
  21608. }
  21609. return circlePoints;
  21610. }
  21611. /**
  21612. * @function GeometryLineString.createLineEPS
  21613. * @description 根据点的类型画出不同类型的曲线。
  21614. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  21615. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  21616. * @returns {Array.<GeometryPoint>} 计算出相应的 lineEPS 控制点。
  21617. * @example
  21618. * var points = [];
  21619. * points.push(new GeometryPoint(-50,30));
  21620. * points.push(new GeometryPoint(-30,50,"LTypeArc"));
  21621. * points.push(new GeometryPoint(2,60));
  21622. * points.push(new GeometryPoint(8,20));
  21623. * var lineEPS = GeometryLineString.createLineEPS(points);
  21624. */
  21625. static createLineEPS(points) {
  21626. var list = [],
  21627. len = points.length;
  21628. if (len < 2) {
  21629. return points;
  21630. }
  21631. for (var i = 0; i < len;) {
  21632. var type = points[i].type;
  21633. if (type == 'LTypeArc') {
  21634. var listObj = LineString.createLineArc(list, i, len, points);
  21635. list = listObj[0];
  21636. i = listObj[1];
  21637. } else {
  21638. list.push(points[i]);
  21639. i++;
  21640. }
  21641. }
  21642. return list;
  21643. }
  21644. static createLineArc(list, i, len, points) {
  21645. if (i == 0) {
  21646. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  21647. Array.prototype.push.apply(list, bezierPtsObj[0]);
  21648. i = bezierPtsObj[1] + 1;
  21649. } else if (i == len - 1) {
  21650. var bezierP = [points[i - 1], points[i]],
  21651. bezierPts = LineString.calculateCircle(bezierP);
  21652. Array.prototype.push.apply(list, bezierPts);
  21653. i++;
  21654. } else {
  21655. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  21656. list.pop();
  21657. Array.prototype.push.apply(list, bezierPtsObj[0]);
  21658. i = bezierPtsObj[1] + 1;
  21659. }
  21660. return [list, i];
  21661. }
  21662. static addPointEPS(points, i, len, type) {
  21663. var bezierP = [], j = i + 1;
  21664. if (i == 0) {
  21665. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  21666. } else if (i == len - 1) {
  21667. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  21668. } else {
  21669. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  21670. }
  21671. var bezierPts;
  21672. if (type == 'LTypeCurve') {
  21673. bezierPts = LineString.calculatePointsFBZN(bezierP);
  21674. } else if (type == 'LTypeArc') {
  21675. bezierPts = LineString.calculateCircle(bezierP);
  21676. }
  21677. return [bezierPts, j];
  21678. }
  21679. }
  21680. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  21681. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21682. * This program are made available under the terms of the Apache License, Version 2.0
  21683. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21684. /**
  21685. * @class GeometryGeoText
  21686. * @aliasclass Geometry.GeoText
  21687. * @deprecatedclass SuperMap.Geometry.GeoText
  21688. * @classdesc 文本标签类。
  21689. * @category BaseTypes Geometry
  21690. * @extends {Geometry}
  21691. * @param {number} x - x 坐标。
  21692. * @param {number} y - y 坐标。
  21693. * @param {string} text - 标签中的文本内容。
  21694. * @usage
  21695. */
  21696. class GeoText extends Geometry_Geometry {
  21697. constructor(x, y, text) {
  21698. super(x, y, text);
  21699. /**
  21700. * @member {number} GeometryGeoText.prototype.x
  21701. * @description 横坐标。
  21702. */
  21703. this.x = parseFloat(x);
  21704. /**
  21705. * @member {number} GeometryGeoText.prototype.y
  21706. * @description 纵坐标。
  21707. */
  21708. this.y = parseFloat(y);
  21709. /**
  21710. * @member {string} GeometryGeoText.prototype.text
  21711. * @description 标签中的文本内容。
  21712. */
  21713. this.text = text.toString();
  21714. /**
  21715. * @member {Object} GeometryGeoText.prototype.bsInfo
  21716. * @description 标签范围的基础信息。
  21717. * @property {number} w - bounds 的宽度。
  21718. * @property {number} h - bounds 的高度。
  21719. */
  21720. this.bsInfo = {
  21721. "h": null,
  21722. "w": null
  21723. };
  21724. this.element = document.createElement('span');
  21725. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  21726. this.geometryType = "GeoText";
  21727. }
  21728. /**
  21729. * @function GeometryGeoText.prototype.destroy
  21730. * @description 销毁文本标签类。
  21731. */
  21732. destroy() {
  21733. super.destroy();
  21734. this.x = null;
  21735. this.y = null;
  21736. this.text = null;
  21737. }
  21738. /**
  21739. * @function GeometryGeoText.prototype.getCentroid
  21740. * @description 获取标签对象的质心。
  21741. * @returns {GeometryPoint} 标签对象的质心。
  21742. */
  21743. getCentroid() {
  21744. return new Point(this.x, this.y);
  21745. }
  21746. /**
  21747. * @function GeometryGeoText.prototype.clone
  21748. * @description 克隆标签对象。
  21749. * @returns {GeometryGeoText} 克隆后的标签对象。
  21750. */
  21751. clone(obj) {
  21752. if (obj == null) {
  21753. obj = new GeoText(this.x, this.y, this.text);
  21754. }
  21755. Util_Util.applyDefaults(obj, this);
  21756. return obj;
  21757. }
  21758. /**
  21759. * @function GeometryGeoText.prototype.calculateBounds
  21760. * @description 计算标签对象的范围。
  21761. */
  21762. calculateBounds() {
  21763. this.bounds = new Bounds(this.x, this.y,
  21764. this.x, this.y);
  21765. }
  21766. /**
  21767. * @function GeometryGeoText.prototype.getLabelPxBoundsByLabel
  21768. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  21769. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  21770. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  21771. * @param {string} labelHeight - 标签的高度。
  21772. * @param {Object} style - 标签的 style。
  21773. * @returns {Bounds} 标签的像素范围。
  21774. */
  21775. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  21776. var labelPxBounds, left, bottom, top, right;
  21777. var locationPx = Util_Util.cloneObject(locationPixel);
  21778. //计算文本行数
  21779. var theText = style.label || this.text;
  21780. var textRows = theText.split('\n');
  21781. var laberRows = textRows.length;
  21782. //处理文字对齐
  21783. labelWidth = parseFloat(labelWidth);
  21784. labelHeight = parseFloat(labelHeight);
  21785. if (laberRows > 1) {
  21786. labelHeight = parseFloat(labelHeight) * laberRows;
  21787. }
  21788. if (style.labelAlign && style.labelAlign !== "cm") {
  21789. switch (style.labelAlign) {
  21790. case "lt":
  21791. locationPx.x += labelWidth / 2;
  21792. locationPx.y += labelHeight / 2;
  21793. break;
  21794. case "lm":
  21795. locationPx.x += labelWidth / 2;
  21796. break;
  21797. case "lb":
  21798. locationPx.x += labelWidth / 2;
  21799. locationPx.y -= labelHeight / 2;
  21800. break;
  21801. case "ct":
  21802. locationPx.y += labelHeight / 2;
  21803. break;
  21804. case "cb":
  21805. locationPx.y -= labelHeight / 2;
  21806. break;
  21807. case "rt":
  21808. locationPx.x -= labelWidth / 2;
  21809. locationPx.y += labelHeight / 2;
  21810. break;
  21811. case "rm":
  21812. locationPx.x -= labelWidth / 2;
  21813. break;
  21814. case "rb":
  21815. locationPx.x -= labelWidth / 2;
  21816. locationPx.y -= labelHeight / 2;
  21817. break;
  21818. default:
  21819. break;
  21820. }
  21821. }
  21822. this.bsInfo.h = labelHeight;
  21823. this.bsInfo.w = labelWidth;
  21824. //bounds的四边
  21825. left = locationPx.x - parseFloat(labelWidth) / 2;
  21826. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  21827. right = locationPx.x + parseFloat(labelWidth) / 2;
  21828. top = locationPx.y - parseFloat(labelHeight) / 2;
  21829. labelPxBounds = new Bounds(left, bottom, right, top);
  21830. return labelPxBounds;
  21831. }
  21832. /**
  21833. * @function GeometryGeoText.prototype.getLabelPxBoundsByText
  21834. * @description 根据文本内容获取文字标签的像素范围。
  21835. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  21836. * @param {Object} style - 标签的样式。
  21837. * @returns {Bounds} 标签的像素范围。
  21838. */
  21839. getLabelPxBoundsByText(locationPixel, style) {
  21840. var labelPxBounds, left, bottom, top, right;
  21841. var labelSize = this.getLabelPxSize(style);
  21842. var locationPx = Util_Util.cloneObject(locationPixel);
  21843. //处理文字对齐
  21844. if (style.labelAlign && style.labelAlign !== "cm") {
  21845. switch (style.labelAlign) {
  21846. case "lt":
  21847. locationPx.x += labelSize.w / 2;
  21848. locationPx.y += labelSize.h / 2;
  21849. break;
  21850. case "lm":
  21851. locationPx.x += labelSize.w / 2;
  21852. break;
  21853. case "lb":
  21854. locationPx.x += labelSize.w / 2;
  21855. locationPx.y -= labelSize.h / 2;
  21856. break;
  21857. case "ct":
  21858. locationPx.y += labelSize.h / 2;
  21859. break;
  21860. case "cb":
  21861. locationPx.y -= labelSize.h / 2;
  21862. break;
  21863. case "rt":
  21864. locationPx.x -= labelSize.w / 2;
  21865. locationPx.y += labelSize.h / 2;
  21866. break;
  21867. case "rm":
  21868. locationPx.x -= labelSize.w / 2;
  21869. break;
  21870. case "rb":
  21871. locationPx.x -= labelSize.w / 2;
  21872. locationPx.y -= labelSize.h / 2;
  21873. break;
  21874. default:
  21875. break;
  21876. }
  21877. }
  21878. this.bsInfo.h = labelSize.h;
  21879. this.bsInfo.w = labelSize.w;
  21880. left = locationPx.x - labelSize.w / 2;
  21881. bottom = locationPx.y + labelSize.h / 2;
  21882. //处理斜体字
  21883. if (style.fontStyle && style.fontStyle === "italic") {
  21884. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  21885. } else {
  21886. right = locationPx.x + labelSize.w / 2;
  21887. }
  21888. top = locationPx.y - labelSize.h / 2;
  21889. labelPxBounds = new Bounds(left, bottom, right, top);
  21890. return labelPxBounds;
  21891. }
  21892. /**
  21893. * @function GeometryGeoText.prototype.getLabelPxSize
  21894. * @description 获取 label 的像素大小。
  21895. * @param {Object} style - 标签样式。
  21896. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  21897. */
  21898. getLabelPxSize(style) {
  21899. var text,//文本内容
  21900. fontSize,//字体大小
  21901. spacing = 1,//两个字符间的间距(单位:px)
  21902. lineSpacing = 0.2,
  21903. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  21904. text = style.label || this.text;
  21905. if (style.fontSize) {
  21906. fontSize = parseFloat(style.fontSize);
  21907. } else {
  21908. fontSize = parseFloat("12px");
  21909. }
  21910. //标签宽高
  21911. var labelW, labelH;
  21912. var textRows = text.split('\n');
  21913. var numRows = textRows.length;
  21914. if (numRows > 1) {
  21915. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  21916. } else {
  21917. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  21918. }
  21919. //取最大宽度
  21920. labelW = 0;
  21921. if (this.labelWTmp && labelW < this.labelWTmp) {
  21922. labelW = this.labelWTmp;
  21923. }
  21924. for (var i = 0; i < numRows; i++) {
  21925. var textCharC = this.getTextCount(textRows[i]);
  21926. var labelWTmp = this.labelWTmp = Util_Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  21927. if (labelW < labelWTmp) {
  21928. labelW = labelWTmp;
  21929. }
  21930. }
  21931. var labelSize = new Object(); //标签大小
  21932. labelSize.h = labelH;
  21933. labelSize.w = labelW;
  21934. return labelSize;
  21935. }
  21936. /**
  21937. * @function GeometryGeoText.prototype.getTextCount
  21938. * @description 获取 text 中的字符个数。
  21939. * @param {string} text - 字符串。
  21940. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  21941. */
  21942. getTextCount(text) {
  21943. var textCharCount = {};
  21944. var cnCount = 0;
  21945. var enCount = 0;
  21946. for (var i = 0; i < text.length; i++) {
  21947. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  21948. cnCount++;
  21949. } else {
  21950. enCount++;
  21951. }
  21952. }
  21953. //中午字符个数
  21954. textCharCount.cnC = cnCount;
  21955. //英文字符个数
  21956. textCharCount.enC = enCount;
  21957. //字符总个数
  21958. textCharCount.textC = text.length;
  21959. return textCharCount;
  21960. }
  21961. }
  21962. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  21963. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21964. * This program are made available under the terms of the Apache License, Version 2.0
  21965. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21966. /**
  21967. * @class GeometryLinearRing
  21968. * @aliasclass Geometry.LinearRing
  21969. * @deprecatedclass SuperMap.Geometry.LinearRing
  21970. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  21971. * 作为最后的一个点来自动关闭线环。
  21972. * @category BaseTypes Geometry
  21973. * @extends GeometryLineString
  21974. * @param {Array.<GeometryPoint>} points - 组成线性环的点。
  21975. * @example
  21976. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  21977. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  21978. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  21979. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  21980. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  21981. * var linearRing = new GeometryLinearRing(points);
  21982. * @usage
  21983. */
  21984. class LinearRing_LinearRing extends LineString {
  21985. constructor(points) {
  21986. super(points);
  21987. /**
  21988. * @member {Array.<string>} [GeometryLinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  21989. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  21990. * @readonly
  21991. */
  21992. this.componentTypes = ["SuperMap.Geometry.Point"];
  21993. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  21994. this.geometryType = "LinearRing";
  21995. }
  21996. /**
  21997. * @function GeometryLinearRing.prototype.addComponent
  21998. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  21999. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  22000. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  22001. * @param {GeometryPoint} point - 点对象。
  22002. * @param {number} [index] - 插入组件数组的下标。
  22003. * @returns {boolean} 点对象是否添加成功。
  22004. */
  22005. addComponent(point, index) {
  22006. var added = false;
  22007. //remove last point
  22008. var lastPoint = this.components.pop();
  22009. // given an index, add the point
  22010. // without an index only add non-duplicate points
  22011. if (index != null || !point.equals(lastPoint)) {
  22012. added = super.addComponent.apply(this, arguments);
  22013. }
  22014. //append copy of first point
  22015. var firstPoint = this.components[0];
  22016. super.addComponent.apply(this, [firstPoint]);
  22017. return added;
  22018. }
  22019. /**
  22020. * @function GeometryLinearRing.prototype.removeComponent
  22021. * @description 从几何组件中删除一个点。
  22022. * @param {GeometryPoint} point - 点对象。
  22023. * @returns {boolean} 点对象是否删除。
  22024. */
  22025. removeComponent(point) { // eslint-disable-line no-unused-vars
  22026. var removed = this.components && (this.components.length > 3);
  22027. if (removed) {
  22028. //remove last point
  22029. this.components.pop();
  22030. //remove our point
  22031. super.removeComponent.apply(this, arguments);
  22032. //append copy of first point
  22033. var firstPoint = this.components[0];
  22034. super.addComponent.apply(this, [firstPoint]);
  22035. }
  22036. return removed;
  22037. }
  22038. /**
  22039. * @function GeometryLinearRing.prototype.getArea
  22040. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  22041. * @returns {number} 环的面积。
  22042. */
  22043. getArea() {
  22044. var area = 0.0;
  22045. if (this.components && (this.components.length > 2)) {
  22046. var sum = 0.0;
  22047. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  22048. var b = this.components[i];
  22049. var c = this.components[i + 1];
  22050. sum += (b.x + c.x) * (c.y - b.y);
  22051. }
  22052. area = -sum / 2.0;
  22053. }
  22054. return area;
  22055. }
  22056. /**
  22057. * @function GeometryLinearRing.prototype.getVertices
  22058. * @description 返回几何图形的所有点的列表。
  22059. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  22060. * @returns {Array} 几何对象所有点的列表。
  22061. */
  22062. getVertices(nodes) {
  22063. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  22064. }
  22065. }
  22066. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  22067. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22068. * This program are made available under the terms of the Apache License, Version 2.0
  22069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22070. /**
  22071. * @class GeometryMultiLineString
  22072. * @aliasclass Geometry.MultiLineString
  22073. * @deprecatedclass SuperMap.Geometry.MultiLineString
  22074. * @classdesc 几何对象多线类。
  22075. * @category BaseTypes Geometry
  22076. * @extends GeometryCollection
  22077. * @param {Array.<GeometryLineString>} components - GeometryLineString 数组。
  22078. * @example
  22079. * var multi = new GeometryMultiLineString([
  22080. * new GeometryLineString([
  22081. * new GeometryPoint(1, 0),
  22082. * new GeometryPoint(0, 1)
  22083. * ])
  22084. * ]);
  22085. * @usage
  22086. */
  22087. class MultiLineString extends Collection {
  22088. constructor(components) {
  22089. super(components);
  22090. /**
  22091. * @member {Array.<string>} [GeometryMultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  22092. * @description components 存储的几何对象所支持的几何类型数组。
  22093. * @readonly
  22094. */
  22095. this.componentTypes = ["SuperMap.Geometry.LineString"];
  22096. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  22097. this.geometryType = "MultiLineString";
  22098. }
  22099. }
  22100. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  22101. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22102. * This program are made available under the terms of the Apache License, Version 2.0
  22103. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22104. /**
  22105. * @class GeometryMultiPolygon
  22106. * @aliasclass Geometry.MultiPolygon
  22107. * @deprecatedclass SuperMap.Geometry.MultiPolygon
  22108. * @classdesc 几何对象多多边形类。
  22109. * @category BaseTypes Geometry
  22110. * @extends GeometryCollection
  22111. * @param {Array.<GeometryPolygon>} components - 形成 GeometryMultiPolygon 的多边形数组。
  22112. * @example
  22113. * var points1 = [new GeometryPoint(10,10),new GeometryPoint(0,0)];
  22114. * var points2 = [new GeometryPoint(10,10),new GeometryPoint(0,0),new GeometryPoint(3,3),new GeometryPoint(10,10)];
  22115. *
  22116. * var linearRing1 = new GeometryLinearRing(points1);
  22117. * var linearRing2 = new GeometryLinearRing(points2);
  22118. *
  22119. * var polygon1 = new GeometryPolygon([linearRing1]);
  22120. * var polygon2 = new GeometryPolygon([linearRing2]);
  22121. *
  22122. * var multiPolygon1 = new GeometryMultiPolygon([polygon1,polygon2]);
  22123. * @usage
  22124. */
  22125. class MultiPolygon extends Collection {
  22126. constructor(components) {
  22127. super(components);
  22128. /**
  22129. * @member {Array.<string>} [GeometryMultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  22130. * @description components 存储的几何对象所支持的几何类型数组。
  22131. * @readonly
  22132. */
  22133. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  22134. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  22135. this.geometryType = "MultiPolygon";
  22136. }
  22137. }
  22138. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  22139. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22140. * This program are made available under the terms of the Apache License, Version 2.0
  22141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22142. /**
  22143. * @class GeometryPolygon
  22144. * @aliasclass Geometry.Polygon
  22145. * @deprecatedclass SuperMap.Geometry.Polygon
  22146. * @classdesc 多边形几何对象类。
  22147. * @category BaseTypes Geometry
  22148. * @extends GeometryCollection
  22149. * @param {Array.<GeometryLinearRing>} components - 多边形的线环数组。
  22150. * @example
  22151. * var points =[new GeometryPoint(0,4010338),
  22152. * new GeometryPoint(1063524,4010338),
  22153. * new GeometryPoint(1063524,3150322),
  22154. * new GeometryPoint(0,3150322)
  22155. * ],
  22156. * var linearRings = new GeometryLinearRing(points),
  22157. * var region = new GeometryPolygon([linearRings]);
  22158. * @usage
  22159. */
  22160. class Polygon_Polygon extends Collection {
  22161. constructor(components) {
  22162. super(components);
  22163. /**
  22164. * @member {Array.<string>} [GeometryPolygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  22165. * @description components 存储的几何对象所支持的几何类型数组。
  22166. * @readonly
  22167. */
  22168. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  22169. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  22170. this.geometryType = "Polygon";
  22171. }
  22172. /**
  22173. * @function GeometryMultiPoint.prototype.getArea
  22174. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  22175. * @returns {number} 几何对象的面积。
  22176. */
  22177. getArea() {
  22178. var area = 0.0;
  22179. if (this.components && (this.components.length > 0)) {
  22180. area += Math.abs(this.components[0].getArea());
  22181. for (var i = 1, len = this.components.length; i < len; i++) {
  22182. area -= Math.abs(this.components[i].getArea());
  22183. }
  22184. }
  22185. return area;
  22186. }
  22187. }
  22188. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  22189. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22190. * This program are made available under the terms of the Apache License, Version 2.0
  22191. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22192. /**
  22193. * @class GeometryRectangle
  22194. * @aliasclass Geometry.Rectangle
  22195. * @deprecatedclass SuperMap.Geometry.Rectangle
  22196. * @classdesc 矩形几何对象类。
  22197. * @category BaseTypes Geometry
  22198. * @param {number} x - 矩形左下角点的横坐标。
  22199. * @param {number} y - 矩形左下角点的纵坐标。
  22200. * @param {number} width - 矩形的宽度。
  22201. * @param {number} height - 矩形的高度。
  22202. * @extends {Geometry}
  22203. * @example
  22204. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  22205. * var x = 1;
  22206. * var y = 2;
  22207. * var w = 10;
  22208. * var h = 20;
  22209. * var recttangle = new GeometryRectangle(x, y, w, h);
  22210. * @usage
  22211. */
  22212. class Rectangle extends Geometry_Geometry {
  22213. constructor(x, y, width, height) {
  22214. super(x, y, width, height);
  22215. /**
  22216. * @member {number} GeometryRectangle.prototype.x
  22217. * @description 矩形左下角点的横坐标。
  22218. */
  22219. this.x = x;
  22220. /**
  22221. * @member {number} GeometryRectangle.prototype.y
  22222. * @description 矩形左下角点的纵坐标。
  22223. */
  22224. this.y = y;
  22225. /**
  22226. * @member {number} GeometryRectangle.prototype.width
  22227. * @description 矩形的宽度。
  22228. */
  22229. this.width = width;
  22230. /**
  22231. * @member {number} GeometryRectangle.prototype.height
  22232. * @description 矩形的高度。
  22233. */
  22234. this.height = height;
  22235. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  22236. this.geometryType = "Rectangle";
  22237. }
  22238. /**
  22239. * @function GeometryRectangle.prototype.calculateBounds
  22240. * @description 计算出此矩形对象的 bounds。
  22241. */
  22242. calculateBounds() {
  22243. this.bounds = new Bounds(this.x, this.y,
  22244. this.x + this.width,
  22245. this.y + this.height);
  22246. }
  22247. /**
  22248. * @function GeometryRectangle.prototype.getArea
  22249. * @description 获取矩形对象的面积。
  22250. * @returns {number} 矩形对象面积。
  22251. */
  22252. getArea() {
  22253. var area = this.width * this.height;
  22254. return area;
  22255. }
  22256. }
  22257. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  22258. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22259. * This program are made available under the terms of the Apache License, Version 2.0
  22260. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22261. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  22262. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22263. * This program are made available under the terms of the Apache License, Version 2.0
  22264. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22265. /**
  22266. * @class Credential
  22267. * @deprecatedclass SuperMap.Credential
  22268. * @category Security
  22269. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  22270. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  22271. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  22272. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  22273. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  22274. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  22275. * @example
  22276. * var pixcel = new Credential("valueString","token");
  22277. * pixcel.destroy();
  22278. * @usage
  22279. */
  22280. class Credential {
  22281. constructor(value, name) {
  22282. /**
  22283. * @member {string} Credential.prototype.value
  22284. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  22285. */
  22286. this.value = value ? value : "";
  22287. /**
  22288. * @member {string} [Credential.prototype.name='token']
  22289. * @description 验证信息前缀,name=value 部分的 name 部分。
  22290. */
  22291. this.name = name ? name : "token";
  22292. this.CLASS_NAME = "SuperMap.Credential";
  22293. }
  22294. /**
  22295. * @function Credential.prototype.getUrlParameters
  22296. * @description 获取 name=value 的表达式。
  22297. * @example
  22298. * var credential = new Credential("valueString","token");
  22299. * //这里 str = "token=valueString";
  22300. * var str = credential.getUrlParameters();
  22301. * @returns {string} 安全信息组成的 url 片段。
  22302. */
  22303. getUrlParameters() {
  22304. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  22305. return this.name + "=" + this.value;
  22306. }
  22307. /**
  22308. * @function Credential.prototype.getValue
  22309. * @description 获取 value。
  22310. * @example
  22311. * var credential = new Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  22312. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  22313. * var str = credential.getValue();
  22314. * @returns {string} value 字符串,在 iServer 服务下该 value 值即为 token 值。
  22315. */
  22316. getValue() {
  22317. return this.value;
  22318. }
  22319. /**
  22320. *
  22321. * @function Credential.prototype.destroy
  22322. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  22323. * @example
  22324. * var credential = new Credential("valueString","token");
  22325. * credential.destroy();
  22326. */
  22327. destroy() {
  22328. this.value = null;
  22329. this.name = null;
  22330. }
  22331. }
  22332. /**
  22333. * @member {Credential} Credential.CREDENTIAL
  22334. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  22335. * @example
  22336. * 代码实例:
  22337. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  22338. * var value = "(以iServer为例,这里是申请的token值)";
  22339. * var name = "token";
  22340. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  22341. * Credential.CREDENTIAL = new Credential(value, name);
  22342. *
  22343. */
  22344. Credential.CREDENTIAL = null;
  22345. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  22346. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22347. * This program are made available under the terms of the Apache License, Version 2.0
  22348. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22349. /**
  22350. * @name Date
  22351. * @namespace
  22352. * @category BaseTypes Util
  22353. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  22354. * @private
  22355. */
  22356. var DateExt = {
  22357. /**
  22358. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  22359. * @example
  22360. * var dateString = DateExt.toISOString(new Date());
  22361. * @param {Date} date - 日期对象。
  22362. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  22363. */
  22364. toISOString: (function () {
  22365. //标准的Date会存在toISOString方法,可以直接调用
  22366. if ("toISOString" in Date.prototype) {
  22367. return function (date) {
  22368. return date.toISOString();
  22369. };
  22370. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  22371. function pad(num, len) {
  22372. var str = num + "";
  22373. while (str.length < len) {
  22374. str = "0" + str;
  22375. }
  22376. return str;
  22377. }
  22378. return function (date) {
  22379. var str;
  22380. if (isNaN(date.getTime())) {
  22381. // ECMA-262 says throw RangeError, Firefox returns
  22382. // "Invalid Date"
  22383. str = "Invalid Date";
  22384. } else {
  22385. str =
  22386. date.getUTCFullYear() + "-" +
  22387. pad(date.getUTCMonth() + 1, 2) + "-" +
  22388. pad(date.getUTCDate(), 2) + "T" +
  22389. pad(date.getUTCHours(), 2) + ":" +
  22390. pad(date.getUTCMinutes(), 2) + ":" +
  22391. pad(date.getUTCSeconds(), 2) + "." +
  22392. pad(date.getUTCMilliseconds(), 3) + "Z";
  22393. }
  22394. return str;
  22395. };
  22396. }
  22397. })(),
  22398. /**
  22399. * @description 从一个字符串生成一个日期对象。
  22400. * @example
  22401. * var date = DateExt.parse("2010-08-07");
  22402. * @param {string} str - 日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  22403. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  22404. */
  22405. parse: function (str) {
  22406. var date;
  22407. var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);
  22408. if (match && (match[1] || match[7])) { // must have at least year or time
  22409. var year = parseInt(match[1], 10) || 0;
  22410. var month = (parseInt(match[2], 10) - 1) || 0;
  22411. var day = parseInt(match[3], 10) || 1;
  22412. date = new Date(Date.UTC(year, month, day));
  22413. // optional time
  22414. var type = match[7];
  22415. if (type) {
  22416. var hours = parseInt(match[4], 10);
  22417. var minutes = parseInt(match[5], 10);
  22418. var secFrac = parseFloat(match[6]);
  22419. var seconds = secFrac | 0;
  22420. var milliseconds = Math.round(1000 * (secFrac - seconds));
  22421. date.setUTCHours(hours, minutes, seconds, milliseconds);
  22422. // check offset
  22423. if (type !== "Z") {
  22424. var hoursOffset = parseInt(type, 10);
  22425. var minutesOffset = parseInt(match[8], 10) || 0;
  22426. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  22427. date = new Date(date.getTime() + offset);
  22428. }
  22429. }
  22430. } else {
  22431. date = new Date("invalid");
  22432. }
  22433. return date;
  22434. }
  22435. };
  22436. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  22437. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22438. * This program are made available under the terms of the Apache License, Version 2.0
  22439. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22440. /**
  22441. * @name Event
  22442. * @namespace
  22443. * @category BaseTypes Events
  22444. * @description 事件处理函数.
  22445. * @usage
  22446. * ```
  22447. * // 浏览器
  22448. * <script type="text/javascript" src="{cdn}"></script>
  22449. * <script>
  22450. * const element = {namespace}.Event.element();
  22451. *
  22452. * // 弃用的写法
  22453. * const result = SuperMap.Event.element();
  22454. *
  22455. * </script>
  22456. *
  22457. * // ES6 Import
  22458. * import { Event } from '{npm}';
  22459. *
  22460. * const result = Event.element();
  22461. * ```
  22462. */
  22463. var Event = {
  22464. /**
  22465. * @description 事件观察者列表。
  22466. * @type {Object}
  22467. * @default false
  22468. */
  22469. observers: false,
  22470. /**
  22471. * @description KEY_SPACE
  22472. * @type {number}
  22473. * @default 32
  22474. */
  22475. KEY_SPACE: 32,
  22476. /**
  22477. * @description KEY_BACKSPACE
  22478. * @type {number}
  22479. * @default 8
  22480. */
  22481. KEY_BACKSPACE: 8,
  22482. /**
  22483. * @description KEY_TAB
  22484. * @type {number}
  22485. * @default 9
  22486. */
  22487. KEY_TAB: 9,
  22488. /**
  22489. * @description KEY_RETURN
  22490. * @type {number}
  22491. * @default 13
  22492. */
  22493. KEY_RETURN: 13,
  22494. /**
  22495. * @description KEY_ESC
  22496. * @type {number}
  22497. * @default 27
  22498. */
  22499. KEY_ESC: 27,
  22500. /**
  22501. * @description KEY_LEFT
  22502. * @type {number}
  22503. * @default 37
  22504. */
  22505. KEY_LEFT: 37,
  22506. /**
  22507. * @description KEY_UP
  22508. * @type {number}
  22509. * @default 38
  22510. */
  22511. KEY_UP: 38,
  22512. /**
  22513. * @description KEY_RIGHT
  22514. * @type {number}
  22515. * @default 39
  22516. */
  22517. KEY_RIGHT: 39,
  22518. /**
  22519. * @description KEY_DOWN
  22520. * @type {number}
  22521. * @default 40
  22522. */
  22523. KEY_DOWN: 40,
  22524. /**
  22525. * @description KEY_DELETE
  22526. * @type {number}
  22527. * @default 46
  22528. */
  22529. KEY_DELETE: 46,
  22530. /**
  22531. * @description 监听浏览器 DOM 事件。
  22532. * @param {Event} event - Event 对象。
  22533. * @returns {HTMLElement} 触发事件的 DOM 元素。
  22534. */
  22535. element: function (event) {
  22536. return event.target || event.srcElement;
  22537. },
  22538. /**
  22539. * @description 判断事件是否由单次触摸引起。
  22540. * @param {Event} event - Event 对象。
  22541. * @returns {boolean} 是否有且只有一个当前在与触摸表面接触的 Touch 对象。
  22542. */
  22543. isSingleTouch: function (event) {
  22544. return event.touches && event.touches.length === 1;
  22545. },
  22546. /**
  22547. * @description 判断事件是否由多点触控引起。
  22548. * @param {Event} event - Event 对象。
  22549. * @returns {boolean} 是否存在多个当前在与触摸表面接触的 Touch 对象。
  22550. */
  22551. isMultiTouch: function (event) {
  22552. return event.touches && event.touches.length > 1;
  22553. },
  22554. /**
  22555. * @description 确定事件是否由左键单击引起。
  22556. * @param {Event} event - Event 对象。
  22557. * @returns {boolean} 是否点击鼠标左键。
  22558. */
  22559. isLeftClick: function (event) {
  22560. return (((event.which) && (event.which === 1)) ||
  22561. ((event.button) && (event.button === 1)));
  22562. },
  22563. /**
  22564. * @description 确定事件是否由鼠标右键单击引起。
  22565. * @param {Event} event - Event 对象。
  22566. * @returns {boolean} 是否点击鼠标右键。
  22567. */
  22568. isRightClick: function (event) {
  22569. return (((event.which) && (event.which === 3)) ||
  22570. ((event.button) && (event.button === 2)));
  22571. },
  22572. /**
  22573. * @description 阻止事件冒泡。
  22574. * @param {Event} event - Event 对象。
  22575. * @param {boolean} allowDefault - 默认为 false,表示阻止事件的默认行为。
  22576. */
  22577. stop: function (event, allowDefault) {
  22578. if (!allowDefault) {
  22579. if (event.preventDefault) {
  22580. event.preventDefault();
  22581. } else {
  22582. event.returnValue = false;
  22583. }
  22584. }
  22585. if (event.stopPropagation) {
  22586. event.stopPropagation();
  22587. } else {
  22588. event.cancelBubble = true;
  22589. }
  22590. },
  22591. /**
  22592. * @description 查询触发指定事件的 DOM 元素。
  22593. * @param {Event} event - Event 对象。
  22594. * @param {string} tagName - html 标签名。
  22595. * @returns {HTMLElement} DOM 元素。
  22596. */
  22597. findElement: function (event, tagName) {
  22598. var element = Event.element(event);
  22599. while (element.parentNode && (!element.tagName ||
  22600. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  22601. element = element.parentNode;
  22602. }
  22603. return element;
  22604. },
  22605. /**
  22606. * @description 监听事件,注册事件处理方法。
  22607. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  22608. * @param {string} name - 监听事件的类别名称。
  22609. * @param {function} observer - 注册的事件处理方法。
  22610. * @param {boolean} [useCapture=false] - 是否捕获。
  22611. */
  22612. observe: function (elementParam, name, observer, useCapture) {
  22613. var element = Util_Util.getElement(elementParam);
  22614. useCapture = useCapture || false;
  22615. if (name === 'keypress' &&
  22616. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  22617. || element.attachEvent)) {
  22618. name = 'keydown';
  22619. }
  22620. //if observers cache has not yet been created, create it
  22621. if (!this.observers) {
  22622. this.observers = {};
  22623. }
  22624. //if not already assigned, make a new unique cache ID
  22625. if (!element._eventCacheID) {
  22626. var idPrefix = "eventCacheID_";
  22627. if (element.id) {
  22628. idPrefix = element.id + "_" + idPrefix;
  22629. }
  22630. element._eventCacheID = Util_Util.createUniqueID(idPrefix);
  22631. }
  22632. var cacheID = element._eventCacheID;
  22633. //if there is not yet a hash entry for this element, add one
  22634. if (!this.observers[cacheID]) {
  22635. this.observers[cacheID] = [];
  22636. }
  22637. //add a new observer to this element's list
  22638. this.observers[cacheID].push({
  22639. 'element': element,
  22640. 'name': name,
  22641. 'observer': observer,
  22642. 'useCapture': useCapture
  22643. });
  22644. //add the actual browser event listener
  22645. if (element.addEventListener) {
  22646. if(name === 'mousewheel'){
  22647. // https://www.chromestatus.com/features/6662647093133312
  22648. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  22649. } else {
  22650. element.addEventListener(name, observer, useCapture);
  22651. }
  22652. } else if (element.attachEvent) {
  22653. element.attachEvent('on' + name, observer);
  22654. }
  22655. },
  22656. /**
  22657. * @description 移除给定 DOM 元素的监听事件。
  22658. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  22659. */
  22660. stopObservingElement: function (elementParam) {
  22661. var element = Util_Util.getElement(elementParam);
  22662. var cacheID = element._eventCacheID;
  22663. this._removeElementObservers(Event.observers[cacheID]);
  22664. },
  22665. _removeElementObservers: function (elementObservers) {
  22666. if (elementObservers) {
  22667. for (var i = elementObservers.length - 1; i >= 0; i--) {
  22668. var entry = elementObservers[i];
  22669. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  22670. Event.stopObserving.apply(this, args);
  22671. }
  22672. }
  22673. },
  22674. /**
  22675. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时保持一致才能确保事件移除成功。
  22676. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  22677. * @param {string} name - 需要移除的被监听事件名称。
  22678. * @param {function} observer - 需要移除的事件处理方法。
  22679. * @param {boolean} [useCapture=false] - 是否捕获。
  22680. * @returns {boolean} 监听事件是否被移除。
  22681. */
  22682. stopObserving: function (elementParam, name, observer, useCapture) {
  22683. useCapture = useCapture || false;
  22684. var element = Util_Util.getElement(elementParam);
  22685. var cacheID = element._eventCacheID;
  22686. if (name === 'keypress') {
  22687. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  22688. element.detachEvent) {
  22689. name = 'keydown';
  22690. }
  22691. }
  22692. // find element's entry in this.observers cache and remove it
  22693. var foundEntry = false;
  22694. var elementObservers = Event.observers[cacheID];
  22695. if (elementObservers) {
  22696. // find the specific event type in the element's list
  22697. var i = 0;
  22698. while (!foundEntry && i < elementObservers.length) {
  22699. var cacheEntry = elementObservers[i];
  22700. if ((cacheEntry.name === name) &&
  22701. (cacheEntry.observer === observer) &&
  22702. (cacheEntry.useCapture === useCapture)) {
  22703. elementObservers.splice(i, 1);
  22704. if (elementObservers.length == 0) {
  22705. delete Event.observers[cacheID];
  22706. }
  22707. foundEntry = true;
  22708. break;
  22709. }
  22710. i++;
  22711. }
  22712. }
  22713. //actually remove the event listener from browser
  22714. if (foundEntry) {
  22715. if (element.removeEventListener) {
  22716. element.removeEventListener(name, observer, useCapture);
  22717. } else if (element && element.detachEvent) {
  22718. element.detachEvent('on' + name, observer);
  22719. }
  22720. }
  22721. return foundEntry;
  22722. },
  22723. /**
  22724. * @description 移除缓存中的监听事件。
  22725. */
  22726. unloadCache: function () {
  22727. // check for Event before checking for observers, because
  22728. // Event may be undefined in IE if no map instance was
  22729. // created
  22730. if (Event && Event.observers) {
  22731. for (var cacheID in Event.observers) {
  22732. var elementObservers = Event.observers[cacheID];
  22733. Event._removeElementObservers.apply(this,
  22734. [elementObservers]);
  22735. }
  22736. Event.observers = false;
  22737. }
  22738. },
  22739. CLASS_NAME: "SuperMap.Event"
  22740. };
  22741. /* prevent memory leaks in IE */
  22742. Event.observe(window, 'resize', Event.unloadCache, false);
  22743. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  22744. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22745. * This program are made available under the terms of the Apache License, Version 2.0
  22746. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22747. /**
  22748. * @class Events
  22749. * @deprecatedclass SuperMap.Events
  22750. * @classdesc 事件类。
  22751. * @category BaseTypes Events
  22752. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  22753. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  22754. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  22755. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  22756. * @param {Object} options - 事件对象选项。
  22757. * @usage
  22758. */
  22759. class Events {
  22760. constructor(object, element, eventTypes, fallThrough, options) {
  22761. /**
  22762. * @member {Array.<string>} Events.prototype.BROWSER_EVENTS
  22763. * @description 支持的事件。
  22764. * @constant
  22765. * @default [
  22766. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  22767. "click", "dblclick", "rightclick", "dblrightclick","resize",
  22768. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  22769. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  22770. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  22771. ]
  22772. */
  22773. this.BROWSER_EVENTS = [
  22774. "mouseover", "mouseout",
  22775. "mousedown", "mouseup", "mousemove",
  22776. "click", "dblclick", "rightclick", "dblrightclick",
  22777. "resize", "focus", "blur",
  22778. "touchstart", "touchmove", "touchend",
  22779. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  22780. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  22781. "contextmenu"
  22782. ];
  22783. /**
  22784. * @member {Object} Events.prototype.listeners
  22785. * @description 事件监听器函数。
  22786. */
  22787. this.listeners = {};
  22788. /**
  22789. * @member {Object} Events.prototype.object
  22790. * @description 发布应用程序事件的对象。
  22791. */
  22792. this.object = object;
  22793. /**
  22794. * @member {HTMLElement} Events.prototype.element
  22795. * @description 接受浏览器事件的 DOM 节点。
  22796. */
  22797. this.element = null;
  22798. /**
  22799. * @member {Array.<string>} Events.prototype.eventTypes
  22800. * @description 支持的事件类型列表。
  22801. */
  22802. this.eventTypes = [];
  22803. /**
  22804. * @member {function} Events.prototype.eventHandler
  22805. * @description 绑定在元素上的事件处理器对象。
  22806. */
  22807. this.eventHandler = null;
  22808. /**
  22809. * @member {boolean} [Events.prototype.fallThrough=false]
  22810. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  22811. */
  22812. this.fallThrough = fallThrough;
  22813. /**
  22814. * @member {boolean} [Events.prototype.includeXY=false]
  22815. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  22816. * @example
  22817. * function named(evt) {
  22818. * this.xy = this.object.events.getMousePosition(evt);
  22819. * }
  22820. */
  22821. this.includeXY = false;
  22822. /**
  22823. * @member {Object} Events.prototype.extensions
  22824. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  22825. */
  22826. this.extensions = {};
  22827. /**
  22828. * @member {Object} Events.prototype.extensionCount
  22829. * @description 事件扩展数量。
  22830. */
  22831. this.extensionCount = {};
  22832. /**
  22833. * @member {Object} Events.prototype.clearMouseListener
  22834. * @description 待移除的鼠标监听事件。
  22835. */
  22836. this.clearMouseListener = null;
  22837. Util_Util.extend(this, options);
  22838. if (eventTypes != null) {
  22839. for (var i = 0, len = eventTypes.length; i < len; i++) {
  22840. this.addEventType(eventTypes[i]);
  22841. }
  22842. }
  22843. if (element != null) {
  22844. this.attachToElement(element);
  22845. }
  22846. this.CLASS_NAME = "SuperMap.Events";
  22847. }
  22848. /**
  22849. * @function Events.prototype.destroy
  22850. * @description 移除当前要素 element 上的所有事件监听和处理。
  22851. */
  22852. destroy() {
  22853. for (var e in this.extensions) {
  22854. if (typeof this.extensions[e] !== "boolean") {
  22855. this.extensions[e].destroy();
  22856. }
  22857. }
  22858. this.extensions = null;
  22859. if (this.element) {
  22860. Event.stopObservingElement(this.element);
  22861. if (this.element.hasScrollEvent) {
  22862. Event.stopObserving(
  22863. window, "scroll", this.clearMouseListener
  22864. );
  22865. }
  22866. }
  22867. this.element = null;
  22868. this.listeners = null;
  22869. this.object = null;
  22870. this.eventTypes = null;
  22871. this.fallThrough = null;
  22872. this.eventHandler = null;
  22873. }
  22874. /**
  22875. * @function Events.prototype.addEventType
  22876. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  22877. * @param {string} eventName - 事件名。
  22878. */
  22879. addEventType(eventName) {
  22880. if (!this.listeners[eventName]) {
  22881. this.eventTypes.push(eventName);
  22882. this.listeners[eventName] = [];
  22883. }
  22884. }
  22885. /**
  22886. * @function Events.prototype.attachToElement
  22887. * @description 给 DOM 元素绑定浏览器事件。
  22888. * @param {HTMLElement} element - 绑定浏览器事件的 DOM 元素。
  22889. */
  22890. attachToElement(element) {
  22891. if (this.element) {
  22892. Event.stopObservingElement(this.element);
  22893. } else {
  22894. // keep a bound copy of handleBrowserEvent() so that we can
  22895. // pass the same function to both Event.observe() and .stopObserving()
  22896. this.eventHandler = FunctionExt.bindAsEventListener(
  22897. this.handleBrowserEvent, this
  22898. );
  22899. // to be used with observe and stopObserving
  22900. this.clearMouseListener = FunctionExt.bind(
  22901. this.clearMouseCache, this
  22902. );
  22903. }
  22904. this.element = element;
  22905. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  22906. var eventType = this.BROWSER_EVENTS[i];
  22907. // every browser event has a corresponding application event
  22908. // (whether it's listened for or not).
  22909. this.addEventType(eventType);
  22910. // use Prototype to register the event cross-browser
  22911. Event.observe(element, eventType, this.eventHandler);
  22912. }
  22913. // disable dragstart in IE so that mousedown/move/up works normally
  22914. Event.observe(element, "dragstart", Event.stop);
  22915. }
  22916. /**
  22917. * @function Events.prototype.on
  22918. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  22919. * @example
  22920. * // 注册一个 "loadstart" 监听事件
  22921. * events.on({"loadstart": loadStartListener});
  22922. *
  22923. * // 同样注册一个 "loadstart" 监听事件
  22924. * events.register("loadstart", undefined, loadStartListener);
  22925. *
  22926. * // 同时为对象注册多个监听事件
  22927. * events.on({
  22928. * "loadstart": loadStartListener,
  22929. * "loadend": loadEndListener,
  22930. * scope: object
  22931. * });
  22932. *
  22933. * // 同时为对象注册多个监听事件,多次调用 register 方法
  22934. * events.register("loadstart", object, loadStartListener);
  22935. * events.register("loadend", object, loadEndListener);
  22936. *
  22937. *
  22938. * @param {Object} object - 添加监听的对象。
  22939. */
  22940. on(object) {
  22941. for (var type in object) {
  22942. if (type !== "scope" && object.hasOwnProperty(type)) {
  22943. this.register(type, object.scope, object[type]);
  22944. }
  22945. }
  22946. }
  22947. /**
  22948. * @function Events.prototype.register
  22949. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  22950. * 指定 Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  22951. * @param {string} type - 事件注册者的名字。
  22952. * @param {Object} [obj=this.object] - 对象绑定的回调。
  22953. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  22954. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  22955. */
  22956. register(type, obj, func, priority) {
  22957. if (type in Events && !this.extensions[type]) {
  22958. this.extensions[type] = new Events[type](this);
  22959. }
  22960. if ((func != null) &&
  22961. (Util_Util.indexOf(this.eventTypes, type) !== -1)) {
  22962. if (obj == null) {
  22963. obj = this.object;
  22964. }
  22965. var listeners = this.listeners[type];
  22966. if (!listeners) {
  22967. listeners = [];
  22968. this.listeners[type] = listeners;
  22969. this.extensionCount[type] = 0;
  22970. }
  22971. var listener = {obj: obj, func: func};
  22972. if (priority) {
  22973. listeners.splice(this.extensionCount[type], 0, listener);
  22974. if (typeof priority === "object" && priority.extension) {
  22975. this.extensionCount[type]++;
  22976. }
  22977. } else {
  22978. listeners.push(listener);
  22979. }
  22980. }
  22981. }
  22982. /**
  22983. * @function Events.prototype.registerPriority
  22984. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  22985. * @param {string} type - 事件注册者的名字。
  22986. * @param {Object} [obj=this.object] - 对象绑定的回调。
  22987. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  22988. */
  22989. registerPriority(type, obj, func) {
  22990. this.register(type, obj, func, true);
  22991. }
  22992. /**
  22993. * @function Events.prototype.un
  22994. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  22995. * @example
  22996. * // 移除 "loadstart" 事件监听
  22997. * events.un({"loadstart": loadStartListener});
  22998. *
  22999. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  23000. * events.unregister("loadstart", undefined, loadStartListener);
  23001. *
  23002. * // 取消对象多个事件监听
  23003. * events.un({
  23004. * "loadstart": loadStartListener,
  23005. * "loadend": loadEndListener,
  23006. * scope: object
  23007. * });
  23008. *
  23009. * // 取消对象多个事件监听,多次调用unregister方法。
  23010. * events.unregister("loadstart", object, loadStartListener);
  23011. * events.unregister("loadend", object, loadEndListener);
  23012. *
  23013. * @param {Object} object - 移除监听的对象。
  23014. */
  23015. un(object) {
  23016. for (var type in object) {
  23017. if (type !== "scope" && object.hasOwnProperty(type)) {
  23018. this.unregister(type, object.scope, object[type]);
  23019. }
  23020. }
  23021. }
  23022. /**
  23023. * @function Events.prototype.unregister
  23024. * @description 取消注册。
  23025. * @param {string} type - 事件类型。
  23026. * @param {Object} [obj=this.object] - 对象绑定的回调。
  23027. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  23028. */
  23029. unregister(type, obj, func) {
  23030. if (obj == null) {
  23031. obj = this.object;
  23032. }
  23033. var listeners = this.listeners[type];
  23034. if (listeners != null) {
  23035. for (var i = 0, len = listeners.length; i < len; i++) {
  23036. if (listeners[i].obj === obj && listeners[i].func === func) {
  23037. listeners.splice(i, 1);
  23038. break;
  23039. }
  23040. }
  23041. }
  23042. }
  23043. /**
  23044. * @function Events.prototype.remove
  23045. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  23046. * @param {string} type - 事件类型。
  23047. */
  23048. remove(type) {
  23049. if (this.listeners[type] != null) {
  23050. this.listeners[type] = [];
  23051. }
  23052. }
  23053. /**
  23054. * @function Events.prototype.triggerEvent
  23055. * @description 触发一个特定的注册事件。
  23056. * @param {string} type - 触发事件类型。
  23057. * @param {Event} evt - 事件对象。
  23058. * @returns {Event|boolean} 监听对象,如果返回是 false,则停止监听。
  23059. */
  23060. triggerEvent(type, evt) {
  23061. var listeners = this.listeners[type];
  23062. // fast path
  23063. if (!listeners || listeners.length == 0) {
  23064. return undefined;
  23065. }
  23066. // prep evt object with object & div references
  23067. if (evt == null) {
  23068. evt = {};
  23069. }
  23070. evt.object = this.object;
  23071. evt.element = this.element;
  23072. if (!evt.type) {
  23073. evt.type = type;
  23074. }
  23075. // execute all callbacks registered for specified type
  23076. // get a clone of the listeners array to
  23077. // allow for splicing during callbacks
  23078. listeners = listeners.slice();
  23079. var continueChain;
  23080. for (var i = 0, len = listeners.length; i < len; i++) {
  23081. var callback = listeners[i];
  23082. // bind the context to callback.obj
  23083. continueChain = callback.func.apply(callback.obj, [evt]);
  23084. if ((continueChain != undefined) && (continueChain === false)) {
  23085. // if callback returns false, execute no more callbacks.
  23086. break;
  23087. }
  23088. }
  23089. // don't fall through to other DOM elements
  23090. if (!this.fallThrough) {
  23091. Event.stop(evt, true);
  23092. }
  23093. return continueChain;
  23094. }
  23095. /**
  23096. * @function Events.prototype.handleBrowserEvent
  23097. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  23098. * @param {Event} evt - 事件对象。
  23099. */
  23100. handleBrowserEvent(evt) {
  23101. var type = evt.type, listeners = this.listeners[type];
  23102. if (!listeners || listeners.length == 0) {
  23103. // noone's listening, bail out
  23104. return;
  23105. }
  23106. // add clientX & clientY to all events - corresponds to average x, y
  23107. var touches = evt.touches;
  23108. if (touches && touches[0]) {
  23109. var x = 0;
  23110. var y = 0;
  23111. var num = touches.length;
  23112. var touch;
  23113. for (var i = 0; i < num; ++i) {
  23114. touch = touches[i];
  23115. x += touch.clientX;
  23116. y += touch.clientY;
  23117. }
  23118. evt.clientX = x / num;
  23119. evt.clientY = y / num;
  23120. }
  23121. if (this.includeXY) {
  23122. evt.xy = this.getMousePosition(evt);
  23123. }
  23124. this.triggerEvent(type, evt);
  23125. }
  23126. /**
  23127. * @function Events.prototype.clearMouseCache
  23128. * @description 清除鼠标缓存。
  23129. */
  23130. clearMouseCache() {
  23131. this.element.scrolls = null;
  23132. this.element.lefttop = null;
  23133. var body = document.body;
  23134. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  23135. navigator.userAgent.match(/iPhone/i))) {
  23136. this.element.offsets = null;
  23137. }
  23138. }
  23139. /**
  23140. * @function Events.prototype.getMousePosition
  23141. * @description 获取当前鼠标的位置。
  23142. * @param {Event} evt - 事件对象。
  23143. * @returns {Pixel} 当前的鼠标的 xy 坐标点。
  23144. */
  23145. getMousePosition(evt) {
  23146. if (!this.includeXY) {
  23147. this.clearMouseCache();
  23148. } else if (!this.element.hasScrollEvent) {
  23149. Event.observe(window, "scroll", this.clearMouseListener);
  23150. this.element.hasScrollEvent = true;
  23151. }
  23152. if (!this.element.scrolls) {
  23153. var viewportElement = Util_Util.getViewportElement();
  23154. this.element.scrolls = [
  23155. viewportElement.scrollLeft,
  23156. viewportElement.scrollTop
  23157. ];
  23158. }
  23159. if (!this.element.lefttop) {
  23160. this.element.lefttop = [
  23161. (document.documentElement.clientLeft || 0),
  23162. (document.documentElement.clientTop || 0)
  23163. ];
  23164. }
  23165. if (!this.element.offsets) {
  23166. this.element.offsets = Util_Util.pagePosition(this.element);
  23167. }
  23168. return new Pixel(
  23169. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  23170. - this.element.lefttop[0],
  23171. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  23172. - this.element.lefttop[1]
  23173. );
  23174. }
  23175. }
  23176. Events.prototype.BROWSER_EVENTS = [
  23177. "mouseover", "mouseout",
  23178. "mousedown", "mouseup", "mousemove",
  23179. "click", "dblclick", "rightclick", "dblrightclick",
  23180. "resize", "focus", "blur",
  23181. "touchstart", "touchmove", "touchend",
  23182. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  23183. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  23184. "contextmenu"
  23185. ];
  23186. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  23187. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23188. * This program are made available under the terms of the Apache License, Version 2.0
  23189. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23190. /**
  23191. * @class Feature
  23192. * @deprecatedclass SuperMap.Feature
  23193. * @category BaseTypes Geometry
  23194. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  23195. * @param {SuperMap.Layer} layer - 图层。
  23196. * @param {LonLat} lonlat - 经纬度。
  23197. * @param {Object} data - 数据对象。
  23198. * @usage
  23199. */
  23200. class Feature_Feature {
  23201. constructor(layer, lonlat, data) {
  23202. this.CLASS_NAME = "SuperMap.Feature";
  23203. /**
  23204. * @deprecated
  23205. * @member {SuperMap.Layer} Feature.prototype.layer
  23206. * @description 图层。
  23207. */
  23208. this.layer = layer;
  23209. /**
  23210. * @member {string} Feature.prototype.id
  23211. * @description 要素 ID。
  23212. */
  23213. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  23214. /**
  23215. * @member {LonLat} Feature.prototype.lonlat
  23216. * @description 经纬度。
  23217. *
  23218. */
  23219. this.lonlat = lonlat;
  23220. /**
  23221. * @member {Object} Feature.prototype.data
  23222. * @description 数据对象。
  23223. */
  23224. this.data = (data != null) ? data : {};
  23225. }
  23226. /**
  23227. * @function Feature.prototype.destroy
  23228. * @description 释放相关资源。
  23229. */
  23230. destroy() {
  23231. this.id = null;
  23232. this.lonlat = null;
  23233. this.data = null;
  23234. }
  23235. }
  23236. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  23237. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23238. * This program are made available under the terms of the Apache License, Version 2.0
  23239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23240. /**
  23241. * @class FeatureVector
  23242. * @aliasclass Feature.Vector
  23243. * @deprecatedclass SuperMap.Feature.Vector
  23244. * @category BaseTypes Geometry
  23245. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  23246. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  23247. * 其中,默认的样式在 {@link FeatureVector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  23248. * @extends {Feature}
  23249. * @param {Geometry} geometry - 要素的几何信息。
  23250. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  23251. * @param {Object} [style] - 样式对象。
  23252. * @example
  23253. * var geometry = new GeometryPoint(-115,10);
  23254. * var style = {
  23255. * strokeColor:"#339933",
  23256. * strokeOpacity:1,
  23257. * strokeWidth:3,
  23258. * pointRadius:6
  23259. * }
  23260. * var pointFeature = new FeatureVector(geometry,null,style);
  23261. * vectorLayer.addFeatures(pointFeature);
  23262. * @usage
  23263. */
  23264. // TRASH THIS
  23265. const State = {
  23266. /** states */
  23267. UNKNOWN: 'Unknown',
  23268. INSERT: 'Insert',
  23269. UPDATE: 'Update',
  23270. DELETE: 'Delete'
  23271. };
  23272. class Vector extends Feature_Feature {
  23273. constructor(geometry, attributes, style) {
  23274. super(null, null, attributes);
  23275. /**
  23276. * @member {string} FeatureVector.prototype.fid
  23277. * @description fid。
  23278. */
  23279. this.fid = null;
  23280. /**
  23281. * @member {Geometry} FeatureVector.prototype.geometry
  23282. * @description 存放几何信息。
  23283. */
  23284. this.geometry = geometry ? geometry : null;
  23285. /**
  23286. * @member {Object} FeatureVector.prototype.attributes
  23287. * @description 描述要素的任意的可序列化属性。
  23288. */
  23289. this.attributes = {};
  23290. if (attributes) {
  23291. this.attributes = Util_Util.extend(this.attributes, attributes);
  23292. }
  23293. /**
  23294. * @member {Bounds} FeatureVector.prototype.bounds
  23295. * @description 限制要素几何的边界。
  23296. */
  23297. this.bounds = null;
  23298. /**
  23299. * @member {string} FeatureVector.prototype.state
  23300. * @description state。
  23301. */
  23302. this.state = null;
  23303. /**
  23304. * @member {Object} FeatureVector.prototype.style
  23305. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  23306. */
  23307. this.style = style ? style : null;
  23308. /**
  23309. * @member {string} FeatureVector.prototype.url
  23310. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link HTTP} 。
  23311. */
  23312. this.url = null;
  23313. this.lonlat = null;
  23314. this.CLASS_NAME = "SuperMap.Feature.Vector";
  23315. Vector.style = {
  23316. 'default': {
  23317. fillColor: "#ee9900",
  23318. fillOpacity: 0.4,
  23319. hoverFillColor: "white",
  23320. hoverFillOpacity: 0.8,
  23321. strokeColor: "#ee9900",
  23322. strokeOpacity: 1,
  23323. strokeWidth: 1,
  23324. strokeLinecap: "round",
  23325. strokeDashstyle: "solid",
  23326. hoverStrokeColor: "red",
  23327. hoverStrokeOpacity: 1,
  23328. hoverStrokeWidth: 0.2,
  23329. pointRadius: 6,
  23330. hoverPointRadius: 1,
  23331. hoverPointUnit: "%",
  23332. pointerEvents: "visiblePainted",
  23333. cursor: "inherit",
  23334. fontColor: "#000000",
  23335. labelAlign: "cm",
  23336. labelOutlineColor: "white",
  23337. labelOutlineWidth: 3
  23338. },
  23339. 'select': {
  23340. fillColor: "blue",
  23341. fillOpacity: 0.4,
  23342. hoverFillColor: "white",
  23343. hoverFillOpacity: 0.8,
  23344. strokeColor: "blue",
  23345. strokeOpacity: 1,
  23346. strokeWidth: 2,
  23347. strokeLinecap: "round",
  23348. strokeDashstyle: "solid",
  23349. hoverStrokeColor: "red",
  23350. hoverStrokeOpacity: 1,
  23351. hoverStrokeWidth: 0.2,
  23352. pointRadius: 6,
  23353. hoverPointRadius: 1,
  23354. hoverPointUnit: "%",
  23355. pointerEvents: "visiblePainted",
  23356. cursor: "pointer",
  23357. fontColor: "#000000",
  23358. labelAlign: "cm",
  23359. labelOutlineColor: "white",
  23360. labelOutlineWidth: 3
  23361. },
  23362. 'temporary': {
  23363. fillColor: "#66cccc",
  23364. fillOpacity: 0.2,
  23365. hoverFillColor: "white",
  23366. hoverFillOpacity: 0.8,
  23367. strokeColor: "#66cccc",
  23368. strokeOpacity: 1,
  23369. strokeLinecap: "round",
  23370. strokeWidth: 2,
  23371. strokeDashstyle: "solid",
  23372. hoverStrokeColor: "red",
  23373. hoverStrokeOpacity: 1,
  23374. hoverStrokeWidth: 0.2,
  23375. pointRadius: 6,
  23376. hoverPointRadius: 1,
  23377. hoverPointUnit: "%",
  23378. pointerEvents: "visiblePainted",
  23379. //cursor:"inherit",
  23380. cursor: "default",
  23381. fontColor: "#000000",
  23382. labelAlign: "cm",
  23383. labelOutlineColor: "white",
  23384. labelOutlineWidth: 3
  23385. },
  23386. 'delete': {
  23387. display: "none"
  23388. }
  23389. };
  23390. }
  23391. /**
  23392. * @function FeatureVector.prototype.destroy
  23393. * @description 释放资源,将引用资源的属性置空。
  23394. */
  23395. destroy() {
  23396. if (this.layer) {
  23397. this.layer.removeFeatures(this);
  23398. this.layer = null;
  23399. }
  23400. this.geometry = null;
  23401. super.destroy();
  23402. }
  23403. /**
  23404. * @function FeatureVector.prototype.clone
  23405. * @description 复制矢量要素,并返回复制后的新对象。
  23406. * @returns {FeatureVector} 相同要素的新的矢量要素。
  23407. */
  23408. clone() {
  23409. return new Vector(
  23410. this.geometry ? this.geometry.clone() : null,
  23411. this.attributes,
  23412. this.style);
  23413. }
  23414. /**
  23415. * @function FeatureVector.prototype.toState
  23416. * @description 设置新状态。
  23417. * @param {string} state - 状态。
  23418. */
  23419. toState(state) {
  23420. if (state === State.UPDATE) {
  23421. switch (this.state) {
  23422. case State.UNKNOWN:
  23423. case State.DELETE:
  23424. this.state = state;
  23425. break;
  23426. case State.UPDATE:
  23427. case State.INSERT:
  23428. break;
  23429. }
  23430. } else if (state === State.INSERT) {
  23431. switch (this.state) {
  23432. case State.UNKNOWN:
  23433. break;
  23434. default:
  23435. this.state = state;
  23436. break;
  23437. }
  23438. } else if (state === State.DELETE) {
  23439. switch (this.state) {
  23440. case State.INSERT:
  23441. // the feature should be destroyed
  23442. break;
  23443. case State.DELETE:
  23444. break;
  23445. case State.UNKNOWN:
  23446. case State.UPDATE:
  23447. this.state = state;
  23448. break;
  23449. }
  23450. } else if (state === State.UNKNOWN) {
  23451. this.state = state;
  23452. }
  23453. }
  23454. }
  23455. /**
  23456. *
  23457. * @typedef {Object} FeatureVector.style
  23458. * @description Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  23459. * 大部分样式通过 SVG 标准定义属性。
  23460. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  23461. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  23462. * @property {boolean} [fill] - 不需要填充则设置为 false。
  23463. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  23464. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  23465. * @property {boolean} [stroke] - 不需要描边则设为 false。
  23466. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  23467. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  23468. * @property {number} [strokeWidth=1] - 像素描边宽度。
  23469. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  23470. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  23471. * @property {boolean} [graphic] - 不需要则设置为 false。
  23472. * @property {number} [pointRadius=6] - 像素点半径。
  23473. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  23474. * @property {string} [cursor] - cursor。
  23475. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  23476. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  23477. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  23478. * @property {number} [graphicHeight] - 外部图表的像素高度。
  23479. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  23480. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  23481. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量。
  23482. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  23483. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  23484. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  23485. * @property {string} [graphicTitle] - 外部图表的提示框。
  23486. * @property {string} [backgroundGraphic] - 外部图表的背景。
  23487. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  23488. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  23489. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  23490. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  23491. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  23492. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  23493. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  23494. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  23495. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  23496. * @property {string} [label] - 可选的标签文本。
  23497. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  23498. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  23499. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  23500. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  23501. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  23502. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  23503. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  23504. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  23505. * @property {string} [fontFamily] - 标签的字体类型。
  23506. * @property {string} [fontSize] - 标签的字体大小。
  23507. * @property {string} [fontStyle] - 标签的字体样式。
  23508. * @property {string} [fontWeight] - 标签的字体粗细。
  23509. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  23510. * @example
  23511. * // label的用法如下:
  23512. * function addGeoTest(){
  23513. * var geometry = new GeometryPoint(105, 35);
  23514. * var pointFeature = new FeatureVector(geometry);
  23515. * var styleTest = {
  23516. * label:"supermap",
  23517. * fontColor:"#0000ff",
  23518. * fontOpacity:"0.5",
  23519. * fontFamily:"隶书",
  23520. * fontSize:"8em",
  23521. * fontWeight:"bold",
  23522. * fontStyle:"italic",
  23523. * labelSelect:"true",
  23524. * }
  23525. * pointFeature.style = styleTest;
  23526. * vectorLayer.addFeatures([pointFeature]);
  23527. * }
  23528. */
  23529. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  23530. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23531. * This program are made available under the terms of the Apache License, Version 2.0
  23532. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23533. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  23534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23535. * This program are made available under the terms of the Apache License, Version 2.0
  23536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23537. /**
  23538. * @class Format
  23539. * @deprecatedclass SuperMap.Format
  23540. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  23541. * @category BaseTypes Format
  23542. * @param {Object} options - 可选参数。
  23543. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  23544. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  23545. * @usage
  23546. */
  23547. class Format {
  23548. constructor(options) {
  23549. /**
  23550. * @member {Object} Format.prototype.data
  23551. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  23552. */
  23553. this.data = null;
  23554. /**
  23555. * @member {Object} [Format.prototype.keepData=false]
  23556. * @description 保持最近读到的数据的引用(通过 data 属性)。
  23557. */
  23558. this.keepData = false;
  23559. Util_Util.extend(this, options);
  23560. this.options = options;
  23561. this.CLASS_NAME = "SuperMap.Format";
  23562. }
  23563. /**
  23564. * @function Format.prototype.destroy
  23565. * @description 销毁该格式类,释放相关资源。
  23566. */
  23567. destroy() {
  23568. //用来销毁该格式类,释放相关资源
  23569. }
  23570. /**
  23571. * @function Format.prototype.read
  23572. * @description 来从字符串中读取数据。
  23573. * @param {string} data - 读取的数据。
  23574. */
  23575. read(data) { // eslint-disable-line no-unused-vars
  23576. //用来从字符串中读取数据
  23577. }
  23578. /**
  23579. * @function Format.prototype.write
  23580. * @description 将对象写成字符串。
  23581. * @param {Object} object - 可序列化的对象。
  23582. * @returns {string} 对象转化后的字符串。
  23583. */
  23584. write(object) { // eslint-disable-line no-unused-vars
  23585. //用来写字符串
  23586. }
  23587. }
  23588. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  23589. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23590. * This program are made available under the terms of the Apache License, Version 2.0
  23591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23592. /**
  23593. * @class JSONFormat
  23594. * @aliasclass Format.JSON
  23595. * @deprecatedclass SuperMap.Format.JSON
  23596. * @classdesc 安全的读写 JSON 的解析类。使用 {@link JSONFormat} 构造函数创建新实例。
  23597. * @category BaseTypes Format
  23598. * @param {Object} [options] - 可选参数。
  23599. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  23600. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  23601. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  23602. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  23603. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  23604. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  23605. * @extends {Format}
  23606. * @usage
  23607. */
  23608. class JSONFormat extends Format {
  23609. constructor(options) {
  23610. super(options);
  23611. /**
  23612. * @member {string} [JSONFormat.prototype.indent=" "]
  23613. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  23614. */
  23615. this.indent = " ";
  23616. /**
  23617. * @member {string} [JSONFormat.prototype.space=" "]
  23618. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  23619. */
  23620. this.space = " ";
  23621. /**
  23622. * @member {string} [JSONFormat.prototype.newline="\n"]
  23623. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  23624. */
  23625. this.newline = "\n";
  23626. /**
  23627. * @member {number} [JSONFormat.prototype.level=0]
  23628. * @description 用于格式化输出, 表示的是缩进级别。
  23629. */
  23630. this.level = 0;
  23631. /**
  23632. * @member {boolean} [JSONFormat.prototype.pretty=false]
  23633. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  23634. */
  23635. this.pretty = false;
  23636. /**
  23637. * @member {boolean} JSONFormat.prototype.nativeJSON
  23638. * @description 判断浏览器是否原生支持 JSON 格式数据。
  23639. */
  23640. this.nativeJSON = (function () {
  23641. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  23642. })();
  23643. this.CLASS_NAME = "SuperMap.Format.JSON";
  23644. /**
  23645. * @member JSONFormat.prototype.serialize
  23646. * @description 提供一些类型对象转 JSON 字符串的方法。
  23647. */
  23648. this.serialize = {
  23649. /**
  23650. * @function JSONFormat.serialize.object
  23651. * @description 把对象转换为 JSON 字符串。
  23652. * @param {Object} object - 可序列化的对象。
  23653. * @returns {string} JSON 字符串。
  23654. */
  23655. 'object': function (object) {
  23656. // three special objects that we want to treat differently
  23657. if (object == null) {
  23658. return "null";
  23659. }
  23660. if (object.constructor === Date) {
  23661. return this.serialize.date.apply(this, [object]);
  23662. }
  23663. if (object.constructor === Array) {
  23664. return this.serialize.array.apply(this, [object]);
  23665. }
  23666. var pieces = ['{'];
  23667. this.level += 1;
  23668. var key, keyJSON, valueJSON;
  23669. var addComma = false;
  23670. for (key in object) {
  23671. if (object.hasOwnProperty(key)) {
  23672. // recursive calls need to allow for sub-classing
  23673. keyJSON = this.write.apply(this,
  23674. [key, this.pretty]);
  23675. valueJSON = this.write.apply(this,
  23676. [object[key], this.pretty]);
  23677. if (keyJSON != null && valueJSON != null) {
  23678. if (addComma) {
  23679. pieces.push(',');
  23680. }
  23681. pieces.push(this.writeNewline(), this.writeIndent(),
  23682. keyJSON, ':', this.writeSpace(), valueJSON);
  23683. addComma = true;
  23684. }
  23685. }
  23686. }
  23687. this.level -= 1;
  23688. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  23689. return pieces.join('');
  23690. },
  23691. /**
  23692. * @function JSONFormat.serialize.array
  23693. * @description 把数组转换成 JSON 字符串。
  23694. * @param {Array} array - 可序列化的数组。
  23695. * @returns {string} JSON 字符串。
  23696. */
  23697. 'array': function (array) {
  23698. var json;
  23699. var pieces = ['['];
  23700. this.level += 1;
  23701. for (var i = 0, len = array.length; i < len; ++i) {
  23702. // recursive calls need to allow for sub-classing
  23703. json = this.write.apply(this,
  23704. [array[i], this.pretty]);
  23705. if (json != null) {
  23706. if (i > 0) {
  23707. pieces.push(',');
  23708. }
  23709. pieces.push(this.writeNewline(), this.writeIndent(), json);
  23710. }
  23711. }
  23712. this.level -= 1;
  23713. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  23714. return pieces.join('');
  23715. },
  23716. /**
  23717. * @function JSONFormat.serialize.string
  23718. * @description 把字符串转换成 JSON 字符串。
  23719. * @param {string} string - 可序列化的字符串。
  23720. * @returns {string} JSON 字符串。
  23721. */
  23722. 'string': function (string) {
  23723. // If the string contains no control characters, no quote characters, and no
  23724. // backslash characters, then we can simply slap some quotes around it.
  23725. // Otherwise we must also replace the offending characters with safe
  23726. // sequences.
  23727. var m = {
  23728. '\b': '\\b',
  23729. '\t': '\\t',
  23730. '\n': '\\n',
  23731. '\f': '\\f',
  23732. '\r': '\\r',
  23733. '"': '\\"',
  23734. '\\': '\\\\'
  23735. };
  23736. /*eslint-disable no-control-regex*/
  23737. if (/["\\\x00-\x1f]/.test(string)) {
  23738. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  23739. var c = m[b];
  23740. if (c) {
  23741. return c;
  23742. }
  23743. c = b.charCodeAt();
  23744. return '\\u00' +
  23745. Math.floor(c / 16).toString(16) +
  23746. (c % 16).toString(16);
  23747. }) + '"';
  23748. }
  23749. return '"' + string + '"';
  23750. },
  23751. /**
  23752. * @function JSONFormat.serialize.number
  23753. * @description 把数字转换成 JSON 字符串。
  23754. * @param {number} number - 可序列化的数字。
  23755. * @returns {string} JSON 字符串。
  23756. */
  23757. 'number': function (number) {
  23758. return isFinite(number) ? String(number) : "null";
  23759. },
  23760. /**
  23761. * @function JSONFormat.serialize.boolean
  23762. * @description Transform a boolean into a JSON string.
  23763. * @param {boolean} bool - The boolean to be serialized.
  23764. * @returns {string} A JSON string representing the boolean.
  23765. */
  23766. 'boolean': function (bool) {
  23767. return String(bool);
  23768. },
  23769. /**
  23770. * @function JSONFormat.serialize.object
  23771. * @description 将日期对象转换成 JSON 字符串。
  23772. * @param {Date} date - 可序列化的日期对象。
  23773. * @returns {string} JSON 字符串。
  23774. */
  23775. 'date': function (date) {
  23776. function format(number) {
  23777. // Format integers to have at least two digits.
  23778. return (number < 10) ? '0' + number : number;
  23779. }
  23780. return '"' + date.getFullYear() + '-' +
  23781. format(date.getMonth() + 1) + '-' +
  23782. format(date.getDate()) + 'T' +
  23783. format(date.getHours()) + ':' +
  23784. format(date.getMinutes()) + ':' +
  23785. format(date.getSeconds()) + '"';
  23786. }
  23787. };
  23788. }
  23789. /**
  23790. * @function JSONFormat.prototype.read
  23791. * @description 将一个符合 JSON 结构的字符串进行解析。
  23792. * @param {string} json - 符合 JSON 结构的字符串。
  23793. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  23794. * @returns {(Object|string|Array|number|boolean)} 对象,数组,字符串或数字。
  23795. */
  23796. read(json, filter) {
  23797. var object;
  23798. if (this.nativeJSON) {
  23799. try {
  23800. object = JSON.parse(json, filter);
  23801. } catch (e) {
  23802. // Fall through if the regexp test fails.
  23803. return { data: json}
  23804. }
  23805. }
  23806. if (this.keepData) {
  23807. this.data = object;
  23808. }
  23809. return object;
  23810. }
  23811. /**
  23812. * @function JSONFormat.prototype.write
  23813. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  23814. * @param {Object|string|Array|number|boolean} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  23815. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  23816. * @returns {string} 符合 JSON 格式的字符串。
  23817. *
  23818. */
  23819. write(value, pretty) {
  23820. this.pretty = !!pretty;
  23821. var json = null;
  23822. var type = typeof value;
  23823. if (this.serialize[type]) {
  23824. try {
  23825. json = (!this.pretty && this.nativeJSON) ?
  23826. JSON.stringify(value) :
  23827. this.serialize[type].apply(this, [value]);
  23828. } catch (err) {
  23829. //console.error("Trouble serializing: " + err);
  23830. }
  23831. }
  23832. return json;
  23833. }
  23834. /**
  23835. * @function JSONFormat.prototype.writeIndent
  23836. * @description 根据缩进级别输出一个缩进字符串。
  23837. * @private
  23838. * @returns {string} 一个适当的缩进字符串。
  23839. */
  23840. writeIndent() {
  23841. var pieces = [];
  23842. if (this.pretty) {
  23843. for (var i = 0; i < this.level; ++i) {
  23844. pieces.push(this.indent);
  23845. }
  23846. }
  23847. return pieces.join('');
  23848. }
  23849. /**
  23850. * @function JSONFormat.prototype.writeNewline
  23851. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  23852. * @private
  23853. * @returns {string} 代表新的一行的字符串。
  23854. */
  23855. writeNewline() {
  23856. return (this.pretty) ? this.newline : '';
  23857. }
  23858. /**
  23859. * @function JSONFormat.prototype.writeSpace
  23860. * @private
  23861. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  23862. * @returns {string} 空格字符串。
  23863. */
  23864. writeSpace() {
  23865. return (this.pretty) ? this.space : '';
  23866. }
  23867. }
  23868. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  23869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23870. * This program are made available under the terms of the Apache License, Version 2.0
  23871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23872. /**
  23873. * @class ServerColor
  23874. * @deprecatedclass SuperMap.ServerColor
  23875. * @category iServer Map Theme
  23876. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  23877. * @param {Object} options - 可选参数。
  23878. * @param {number} [options.red=255] - 获取或设置红色值。
  23879. * @param {number} [options.green=0] - 获取或设置绿色值。
  23880. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  23881. * @usage
  23882. */
  23883. class ServerColor {
  23884. constructor(red, green, blue) {
  23885. /**
  23886. * @member {number} [ServerColor.prototype.red=255]
  23887. * @description 获取或设置红色值。
  23888. */
  23889. this.red = (!red && red != 0)?255:red;
  23890. /**
  23891. * @member {number} [ServerColor.prototype.green=0]
  23892. * @description 获取或设置绿色值。
  23893. */
  23894. this.green = green||0;
  23895. /**
  23896. * @member {number} [ServerColor.prototype.blue=0]
  23897. * @description 获取或设置蓝色值。
  23898. */
  23899. this.blue = blue||0;
  23900. this.CLASS_NAME = "SuperMap.ServerColor";
  23901. }
  23902. /**
  23903. * @function ServerColor.prototype.destroy
  23904. * @description 释放资源,将引用资源的属性置空。
  23905. */
  23906. destroy() {
  23907. var me = this;
  23908. me.red = null;
  23909. me.green = null;
  23910. me.blue = null;
  23911. }
  23912. /**
  23913. * @function ServerColor.formJson
  23914. * @description 将 JSON 对象转化为 ServerColor 对象。
  23915. * @param {Object} jsonObject - 要转换的 JSON 对象。
  23916. * @returns {ServerColor} 转化后的 ServerColor 对象。
  23917. */
  23918. static fromJson(jsonObject) {
  23919. if (!jsonObject) {
  23920. return;
  23921. }
  23922. var color = new ServerColor();
  23923. var red = 255;
  23924. if (jsonObject.red !== null) {
  23925. red = Number(jsonObject.red);
  23926. }
  23927. color.red = red;
  23928. var green = 0;
  23929. if (jsonObject.green !== null) {
  23930. green = Number(jsonObject.green);
  23931. }
  23932. color.green = green;
  23933. var blue = 0;
  23934. if (jsonObject.blue !== null) {
  23935. blue = Number(jsonObject.blue);
  23936. }
  23937. color.blue = blue;
  23938. return color;
  23939. }
  23940. }
  23941. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  23942. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23943. * This program are made available under the terms of the Apache License, Version 2.0
  23944. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23945. /**
  23946. * @class ServerStyle
  23947. * @deprecatedclass SuperMap.ServerStyle
  23948. * @category iServer Map Theme
  23949. * @classdesc 服务端矢量要素风格类。该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  23950. * @param {Object} options - 参数。
  23951. * @param {FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  23952. * @param {ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  23953. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  23954. * @param {ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  23955. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  23956. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  23957. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  23958. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  23959. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  23960. * @param {ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  23961. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  23962. * @param {number} [options.lineWidth=1] - 边线的宽度。
  23963. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  23964. * @param {number} [options.markerSize=1] - 点状符号的大小。
  23965. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  23966. * @usage
  23967. */
  23968. class ServerStyle {
  23969. constructor(options) {
  23970. /**
  23971. * @member {ServerColor} ServerStyle.prototype.fillBackColor
  23972. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  23973. */
  23974. this.fillBackColor = new ServerColor(255, 255, 255);
  23975. /**
  23976. * @member {boolean} [ServerStyle.prototype.fillBackOpaque=false]
  23977. * @description 背景是否不透明。false 表示透明。
  23978. */
  23979. this.fillBackOpaque = false;
  23980. /**
  23981. * @member {ServerColor} ServerStyle.prototype.fillForeColor
  23982. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  23983. */
  23984. this.fillForeColor = new ServerColor(255, 0, 0);
  23985. /**
  23986. * @member {FillGradientMode} ServerStyle.prototype.fillGradientMode
  23987. * @description 渐变填充风格的渐变类型。
  23988. */
  23989. this.fillGradientMode = null;
  23990. /**
  23991. * @member {number} ServerStyle.prototype.fillGradientAngle -
  23992. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  23993. */
  23994. this.fillGradientAngle = 0;
  23995. /**
  23996. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioX
  23997. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  23998. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  23999. */
  24000. this.fillGradientOffsetRatioX = 0;
  24001. /**
  24002. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioY
  24003. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  24004. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  24005. */
  24006. this.fillGradientOffsetRatioY = 0;
  24007. /**
  24008. * @member {number} [ServerStyle.prototype.fillOpaqueRate=100]
  24009. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  24010. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  24011. */
  24012. this.fillOpaqueRate = 100;
  24013. /**
  24014. * @member {number} ServerStyle.prototype.fillSymbolID
  24015. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  24016. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  24017. */
  24018. this.fillSymbolID = 0;
  24019. /**
  24020. * @member {ServerColor} ServerStyle.prototype.lineColor
  24021. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  24022. */
  24023. this.lineColor = new ServerColor(0, 0, 0);
  24024. /**
  24025. * @member {number} [ServerStyle.prototype.lineSymbolID=0]
  24026. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  24027. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  24028. */
  24029. this.lineSymbolID = 0;
  24030. /**
  24031. * @member {number} [ServerStyle.prototype.lineWidth=1.0]
  24032. * @description 边线的宽度。单位为毫米,精度到 0.1。
  24033. */
  24034. this.lineWidth = 1;
  24035. /**
  24036. * @member {number} [ServerStyle.prototype.markerAngle=0]
  24037. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  24038. */
  24039. this.markerAngle = 0;
  24040. /**
  24041. * @member {number} [ServerStyle.prototype.markerSize=1.0]
  24042. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  24043. * 当该属性设置为非法值时,交由服务器默认处理。
  24044. */
  24045. this.markerSize = 1;
  24046. /**
  24047. * @member {number} [ServerStyle.prototype.markerSymbolID=-1]
  24048. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  24049. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  24050. */
  24051. this.markerSymbolID = -1;
  24052. if (options) {
  24053. Util_Util.extend(this, options);
  24054. }
  24055. this.CLASS_NAME = "SuperMap.ServerStyle";
  24056. }
  24057. /**
  24058. * @function ServerStyle.prototype.destroy
  24059. * @description 释放资源,将引用资源的属性置空。
  24060. */
  24061. destroy() {
  24062. var me = this;
  24063. if (me.fillBackColor) {
  24064. me.fillBackColor.destroy();
  24065. me.fillBackColor = null;
  24066. }
  24067. me.fillBackOpaque = null;
  24068. if (me.fillForeColor) {
  24069. me.fillForeColor.destroy();
  24070. me.fillForeColor = null;
  24071. }
  24072. me.fillGradientMode = null;
  24073. me.fillGradientAngle = null;
  24074. me.fillGradientOffsetRatioX = null;
  24075. me.fillGradientOffsetRatioY = null;
  24076. me.fillOpaqueRate = null;
  24077. me.fillSymbolID = null;
  24078. if (me.lineColor) {
  24079. me.lineColor.destroy();
  24080. me.lineColor = null;
  24081. }
  24082. me.lineSymbolID = null;
  24083. me.lineWidth = null;
  24084. me.markerAngle = null;
  24085. me.markerSize = null;
  24086. me.markerSymbolID = null;
  24087. }
  24088. /**
  24089. * @function ServerStyle.prototype.toServerJSONObject
  24090. * @description 转换成对应的 JSON 格式对象。
  24091. * @returns {Object} 对应的 JSON 格式对象.
  24092. */
  24093. toServerJSONObject() {
  24094. var styleObj = {};
  24095. styleObj = Util_Util.copyAttributes(styleObj, this);
  24096. //暂时先忽略serverColor往Json的转换
  24097. return styleObj;
  24098. }
  24099. /**
  24100. * @function ServerStyle.fromJson
  24101. * @description 将JSON对象转换为 ServerStyle 对象。
  24102. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24103. * @returns {ServerStyle} 转化后的 ServerStyle 对象。
  24104. */
  24105. static fromJson(jsonObject) {
  24106. if (!jsonObject) {
  24107. return;
  24108. }
  24109. return new ServerStyle({
  24110. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  24111. fillBackOpaque: jsonObject.fillBackOpaque,
  24112. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  24113. fillGradientMode: jsonObject.fillGradientMode,
  24114. fillGradientAngle: jsonObject.fillGradientAngle,
  24115. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  24116. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  24117. fillOpaqueRate: jsonObject.fillOpaqueRate,
  24118. fillSymbolID: jsonObject.fillSymbolID,
  24119. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  24120. lineSymbolID: jsonObject.lineSymbolID,
  24121. lineWidth: jsonObject.lineWidth,
  24122. markerAngle: jsonObject.markerAngle,
  24123. markerSize: jsonObject.markerSize,
  24124. markerSymbolID: jsonObject.markerSymbolID
  24125. });
  24126. }
  24127. }
  24128. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  24129. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24130. * This program are made available under the terms of the Apache License, Version 2.0
  24131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24132. /**
  24133. * @class PointWithMeasure
  24134. * @deprecatedclass SuperMap.PointWithMeasure
  24135. * @category iServer SpatialAnalyst RouteLocator
  24136. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  24137. * @param {Object} options - 参数。
  24138. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  24139. * @param {number} options.x - 地理坐标系下的 X 坐标值。
  24140. * @param {number} options.y - 地理坐标系下的 Y 坐标值。
  24141. * @extends {GeometryPoint}
  24142. * @usage
  24143. */
  24144. class PointWithMeasure extends Point {
  24145. constructor(options) {
  24146. super(options);
  24147. /**
  24148. * @member {number} PointWithMeasure.prototype.measure
  24149. * @description 度量值,即路由对象属性值 M。
  24150. */
  24151. this.measure = null;
  24152. if (options) {
  24153. Util_Util.extend(this, options);
  24154. }
  24155. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  24156. }
  24157. /**
  24158. * @function PointWithMeasure.prototype.equals
  24159. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  24160. * @param {PointWithMeasure} geom - 需要判断的路由点对象。
  24161. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  24162. */
  24163. equals(geom) {
  24164. var equals = false;
  24165. if (geom != null) {
  24166. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  24167. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  24168. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  24169. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  24170. }
  24171. return equals;
  24172. }
  24173. /**
  24174. * @function PointWithMeasure.prototype.toJson
  24175. * @description 转换为 JSON 对象。
  24176. * */
  24177. toJson() {
  24178. var result = "{";
  24179. if (this.measure != null && this.measure != undefined) {
  24180. result += "\"measure\":" + this.measure + ",";
  24181. }
  24182. result += "\"x\":" + this.x + ",";
  24183. result += "\"y\":" + this.y;
  24184. result += "}";
  24185. return result;
  24186. }
  24187. /**
  24188. * @function PointWithMeasure.prototype.destroy
  24189. * @description 释放资源,将引用资源的属性置空。
  24190. */
  24191. destroy() {
  24192. var me = this;
  24193. me.measure = null;
  24194. me.x = null;
  24195. me.y = null;
  24196. }
  24197. /**
  24198. * @function PointWithMeasure.fromJson
  24199. * @description 将 JSON 对象转换为{@link PointWithMeasure} 对象。
  24200. * @param {Object} jsonObject - JSON 对象表示的路由点。
  24201. * @returns {PointWithMeasure} 转化后的 PointWithMeasure 对象。
  24202. */
  24203. static fromJson(jsonObject) {
  24204. if (!jsonObject) {
  24205. return;
  24206. }
  24207. return new PointWithMeasure({
  24208. x: jsonObject.x,
  24209. y: jsonObject.y,
  24210. measure: jsonObject.measure
  24211. });
  24212. }
  24213. }
  24214. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  24215. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24216. * This program are made available under the terms of the Apache License, Version 2.0
  24217. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24218. /**
  24219. * @class Route
  24220. * @deprecatedclass SuperMap.Route
  24221. * @category iServer SpatialAnalyst RouteCalculateMeasure
  24222. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  24223. * @param {Array.<Geometry>} points - 形成路由对象的线数组。
  24224. * @param {Object} options - 参数。
  24225. * @param {number} options.id - 路由对象在数据库中的 ID。
  24226. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  24227. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  24228. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  24229. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  24230. * @extends GeometryCollection
  24231. * @usage
  24232. */
  24233. class Route extends Collection {
  24234. constructor(points, options) {
  24235. super(points, options);
  24236. /**
  24237. * @member {number} Route.prototype.id
  24238. * @description 路由对象在数据库中的 ID。
  24239. */
  24240. this.id = null;
  24241. /**
  24242. * @member {number} Route.prototype.center
  24243. * @description 路由对象的中心点。
  24244. */
  24245. this.center = null;
  24246. /**
  24247. * @member {string} Route.prototype.style
  24248. * @description 路由对象的样式。
  24249. */
  24250. this.style = null;
  24251. /**
  24252. * @member {number} Route.prototype.length
  24253. * @description 路由对象的长度。单位与数据集的单位相同。
  24254. */
  24255. this.length = null;
  24256. /**
  24257. * @member {number} Route.prototype.maxM
  24258. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  24259. */
  24260. this.maxM = null;
  24261. /**
  24262. * @member {number} Route.prototype.minM
  24263. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  24264. */
  24265. this.minM = null;
  24266. /**
  24267. * @member {Array.<number>} Route.prototype.parts
  24268. * @description 服务端几何对象中各个子对象所包含的节点个数。
  24269. */
  24270. this.parts = null;
  24271. /**
  24272. * @member {Array.<Object>} Route.prototype.points
  24273. * @description 路由对象的所有路由点。
  24274. * @example
  24275. * (start code)
  24276. * [
  24277. * {
  24278. * "measure": 0,
  24279. * "y": -4377.027184298267,
  24280. * "x": 4020.0045221720466
  24281. * },
  24282. * {
  24283. * "measure": 37.33288381391519,
  24284. * "y": -4381.569363260499,
  24285. * "x": 4057.0600591960642
  24286. * }
  24287. * ]
  24288. * (end)
  24289. */
  24290. this.points = null;
  24291. /**
  24292. * @member {string} Route.prototype.type
  24293. * @description 服务端几何对象类型。
  24294. */
  24295. this.type = null;
  24296. /**
  24297. * @member {Array.<string>} [Route.prototype.componentTypes=LineString]
  24298. * @description components 存储的几何对象所支持的几何类型数组。
  24299. */
  24300. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  24301. if (options) {
  24302. Util_Util.extend(this, options);
  24303. }
  24304. this.CLASS_NAME = "SuperMap.Route";
  24305. this.geometryType = "LINEM";
  24306. }
  24307. /**
  24308. *
  24309. * @function Route.prototype.toJson
  24310. * @description 转换为 JSON 对象。
  24311. * @returns {Object} JSON 对象。
  24312. */
  24313. toJson() {
  24314. var result = "{";
  24315. if (this.id != null && this.id != undefined) {
  24316. result += "\"id\":" + this.id + ",";
  24317. }
  24318. if (this.center != null && this.center != undefined) {
  24319. result += "\"center\":" + this.center + ",";
  24320. }
  24321. if (this.style != null && this.style != undefined) {
  24322. result += "\"style\":" + this.style + ",";
  24323. }
  24324. if (this.length != null && this.length != undefined) {
  24325. result += "\"length\":" + this.length + ",";
  24326. }
  24327. if (this.maxM != null && this.maxM != undefined) {
  24328. result += "\"maxM\":" + this.maxM + ",";
  24329. }
  24330. if (this.minM != null && this.minM != undefined) {
  24331. result += "\"minM\":" + this.minM + ",";
  24332. }
  24333. if (this.type != null && this.type != undefined) {
  24334. result += "\"type\":\"" + this.type + "\",";
  24335. }
  24336. if (this.parts != null && this.parts != undefined) {
  24337. result += "\"parts\":[" + this.parts[0];
  24338. for (var i = 1; i < this.parts.length; i++) {
  24339. result += "," + this.parts[i];
  24340. }
  24341. result += "],";
  24342. }
  24343. if (this.components != null && this.components.length > 0) {
  24344. result += "\"points\":[";
  24345. for (var j = 0, len = this.components.length; j < len; j++) {
  24346. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  24347. result += this.components[j].components[k].toJson() + ",";
  24348. }
  24349. }
  24350. result = result.replace(/,$/g, '');
  24351. result += "]";
  24352. }
  24353. result = result.replace(/,$/g, '');
  24354. result += "}";
  24355. return result;
  24356. }
  24357. /**
  24358. * @function Route.prototype.destroy
  24359. * @override
  24360. */
  24361. destroy() {
  24362. var me = this;
  24363. me.id = null;
  24364. me.center = null;
  24365. me.style = null;
  24366. me.length = null;
  24367. me.maxM = null;
  24368. me.minM = null;
  24369. me.type = null;
  24370. me.parts = null;
  24371. me.components.length = 0;
  24372. me.components = null;
  24373. me.componentTypes = null;
  24374. }
  24375. /**
  24376. * @function Route.fromJson
  24377. * @description 将 JSON 对象转换为 Route 对象。
  24378. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  24379. * @returns {Route} 转化后的 Route 对象。
  24380. */
  24381. static fromJson(jsonObject) {
  24382. if (!jsonObject) {
  24383. return;
  24384. }
  24385. var geoParts = jsonObject.parts || [],
  24386. geoPoints = jsonObject.points || [],
  24387. len = geoParts.length,
  24388. lineList = [];
  24389. if (len > 0) {
  24390. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  24391. for (var j = 0; j < geoParts[i]; j++) {
  24392. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  24393. }
  24394. pointIndex += geoParts[i];
  24395. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  24396. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  24397. lineList.push(new LinearRing_LinearRing(pointList));
  24398. } else {
  24399. lineList.push(new LineString(pointList));
  24400. }
  24401. pointList = [];
  24402. }
  24403. } else {
  24404. return null;
  24405. }
  24406. return new Route(lineList, {
  24407. id: jsonObject.id,
  24408. center: jsonObject.center,
  24409. style: jsonObject.style,
  24410. length: jsonObject.length,
  24411. maxM: jsonObject.maxM,
  24412. minM: jsonObject.minM,
  24413. type: jsonObject.type,
  24414. parts: jsonObject.parts
  24415. });
  24416. }
  24417. }
  24418. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  24419. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24420. * This program are made available under the terms of the Apache License, Version 2.0
  24421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24422. /**
  24423. * @class ServerGeometry
  24424. * @deprecatedclass SuperMap.ServerGeometry
  24425. * @category iServer Data Feature
  24426. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  24427. * @param {Object} options - 参数。
  24428. * @param {string} options.id - 服务端几何对象唯一标识符。
  24429. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  24430. * @param {Array.<GeometryPoint>} options.points - 组成几何对象的节点的坐标对数组。
  24431. * @param {GeometryType} options.type - 几何对象的类型。
  24432. * @param {ServerStyle} [options.style] - 服务端几何对象的风格。
  24433. * @usage
  24434. */
  24435. class ServerGeometry {
  24436. constructor(options) {
  24437. /**
  24438. * @member {string} ServerGeometry.prototype.id
  24439. * @description 服务端几何对象唯一标识符。
  24440. */
  24441. this.id = 0;
  24442. /**
  24443. * @member {ServerStyle} [ServerGeometry.prototype.style]
  24444. * @description 服务端几何对象的风格(ServerStyle)。
  24445. */
  24446. this.style = null;
  24447. /**
  24448. * @member {Array.<number>} ServerGeometry.prototype.parts
  24449. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  24450. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  24451. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  24452. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  24453. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  24454. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  24455. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  24456. * 该字段的值就是这个简单对象节点的个数。
  24457. * 如果一个几何对象是由几个简单对象组合而成的,
  24458. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  24459. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  24460. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  24461. */
  24462. this.parts = null;
  24463. /**
  24464. * @member {Array.<GeometryPoint>} ServerGeometry.prototype.points
  24465. * @description 组成几何对象的节点的坐标对数组。<br>
  24466. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  24467. * 该字段存放了组成几何对象的点坐标的数组。
  24468. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  24469. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  24470. * 从而确定 Points 字段中坐标对的分配归属问题。
  24471. */
  24472. this.points = null;
  24473. /**
  24474. * @member {GeometryType} ServerGeometry.prototype.type
  24475. * @description 几何对象的类型(GeometryType)。
  24476. */
  24477. this.type = null;
  24478. /**
  24479. * @member {Object} ServerGeometry.prototype.prjCoordSys
  24480. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  24481. */
  24482. this.prjCoordSys = null;
  24483. if (options) {
  24484. Util_Util.extend(this, options);
  24485. }
  24486. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  24487. }
  24488. /**
  24489. * @function ServerGeometry.prototype.destroy
  24490. * @description 释放资源,将引用资源的属性置空。
  24491. */
  24492. destroy() {
  24493. var me = this;
  24494. me.id = null;
  24495. me.style = null;
  24496. me.parts = null;
  24497. me.partTopo = null;
  24498. me.points = null;
  24499. me.type = null;
  24500. me.prjCoordSys = null;
  24501. }
  24502. /**
  24503. * @function ServerGeometry.prototype.toGeometry
  24504. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  24505. * @returns {Geometry} 转换后的客户端几何对象。
  24506. */
  24507. toGeometry() {
  24508. var me = this,
  24509. geoType = me.type;
  24510. switch (geoType.toUpperCase()) {
  24511. case REST_GeometryType.POINT:
  24512. return me.toGeoPoint();
  24513. case REST_GeometryType.LINE:
  24514. return me.toGeoLine();
  24515. case REST_GeometryType.LINEM:
  24516. return me.toGeoLinem();
  24517. case REST_GeometryType.REGION:
  24518. return me.toGeoRegion();
  24519. case REST_GeometryType.POINTEPS:
  24520. return me.toGeoPoint();
  24521. case REST_GeometryType.LINEEPS:
  24522. return me.toGeoLineEPS();
  24523. case REST_GeometryType.REGIONEPS:
  24524. return me.toGeoRegionEPS();
  24525. case REST_GeometryType.GEOCOMPOUND:
  24526. return me.transformGeoCompound();
  24527. }
  24528. }
  24529. /**
  24530. * @function ServerGeometry.prototype.toGeoPoint
  24531. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  24532. * @returns {Geometry} 转换后的客户端几何对象。
  24533. */
  24534. toGeoPoint() {
  24535. var me = this,
  24536. geoParts = me.parts || [],
  24537. geoPoints = me.points || [],
  24538. len = geoParts.length;
  24539. if (len > 0) {
  24540. if (len === 1) {
  24541. return new Point(geoPoints[0].x, geoPoints[0].y);
  24542. } else {
  24543. var pointList = [];
  24544. for (let i = 0; i < len; i++) {
  24545. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  24546. }
  24547. return new MultiPoint(pointList);
  24548. }
  24549. } else {
  24550. return null;
  24551. }
  24552. }
  24553. /**
  24554. * @function ServerGeometry.prototype.toGeoLine
  24555. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  24556. * @returns {Geometry} 转换后的客户端几何对象。
  24557. */
  24558. toGeoLine() {
  24559. var me = this,
  24560. geoParts = me.parts || [],
  24561. geoPoints = me.points || [],
  24562. len = geoParts.length;
  24563. if (len > 0) {
  24564. if (len === 1) {
  24565. let pointList = [];
  24566. for (let i = 0; i < geoParts[0]; i++) {
  24567. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  24568. }
  24569. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  24570. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  24571. return new LinearRing_LinearRing(pointList);
  24572. } else {
  24573. return new LineString(pointList);
  24574. }
  24575. } else {
  24576. let lineList = [];
  24577. for (let i = 0; i < len; i++) {
  24578. let pointList = [];
  24579. for (let j = 0; j < geoParts[i]; j++) {
  24580. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  24581. }
  24582. lineList.push(new LineString(pointList));
  24583. geoPoints.splice(0, geoParts[i]);
  24584. }
  24585. return new MultiLineString(lineList);
  24586. }
  24587. } else {
  24588. return null;
  24589. }
  24590. }
  24591. /**
  24592. * @function ServerGeometry.prototype.toGeoLineEPS
  24593. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  24594. * @returns {Geometry} 转换后的客户端几何对象。
  24595. */
  24596. toGeoLineEPS() {
  24597. var me = this,
  24598. geoParts = me.parts || [],
  24599. geoPoints = me.points || [],
  24600. i,
  24601. j,
  24602. pointList,
  24603. lineList,
  24604. lineEPS,
  24605. len = geoParts.length;
  24606. if (len > 0) {
  24607. if (len === 1) {
  24608. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  24609. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  24610. }
  24611. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  24612. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  24613. lineEPS = LineString.createLineEPS(pointList);
  24614. return new LinearRing_LinearRing(lineEPS);
  24615. } else {
  24616. lineEPS = LineString.createLineEPS(pointList);
  24617. return new LineString(lineEPS);
  24618. }
  24619. } else {
  24620. for (i = 0, lineList = []; i < len; i++) {
  24621. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  24622. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  24623. }
  24624. lineEPS = LineString.createLineEPS(pointList);
  24625. lineList.push(new LineString(lineEPS));
  24626. geoPoints.splice(0, geoParts[i]);
  24627. }
  24628. return new MultiLineString(lineList);
  24629. }
  24630. } else {
  24631. return null;
  24632. }
  24633. }
  24634. /**
  24635. * @function ServerGeometry.prototype.toGeoLinem
  24636. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  24637. * @returns {Geometry} 转换后的客户端几何对象。
  24638. */
  24639. toGeoLinem() {
  24640. var me = this;
  24641. return Route.fromJson(me);
  24642. }
  24643. /**
  24644. * @function ServerGeometry.prototype.toGeoRegion
  24645. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 GeometryPolygon。
  24646. * @returns {Geometry} 转换后的客户端几何对象。
  24647. */
  24648. toGeoRegion() {
  24649. var me = this,
  24650. geoParts = me.parts || [],
  24651. geoTopo = me.partTopo || [],
  24652. geoPoints = me.points || [],
  24653. len = geoParts.length;
  24654. if (len <= 0) {
  24655. return null;
  24656. }
  24657. var polygonArray = [];
  24658. var pointList = [];
  24659. if (len == 1) {
  24660. for (let i = 0; i < geoPoints.length; i++) {
  24661. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  24662. }
  24663. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(pointList)]));
  24664. return new MultiPolygon(polygonArray);
  24665. }
  24666. //处理复杂面
  24667. var CCWArray = [];
  24668. var areaArray = [];
  24669. var polygonArrayTemp = [];
  24670. var polygonBounds = [];
  24671. //polyon岛洞标识数组,初始都是岛。
  24672. var CCWIdent = [];
  24673. for (let i = 0, pointIndex = 0; i < len; i++) {
  24674. for (let j = 0; j < geoParts[i]; j++) {
  24675. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  24676. }
  24677. pointIndex += geoParts[i];
  24678. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(pointList)]);
  24679. pointList = [];
  24680. polygonArrayTemp.push(polygon);
  24681. if (geoTopo.length === 0) {
  24682. polygonBounds.push(polygon.getBounds());
  24683. }
  24684. CCWIdent.push(1);
  24685. areaArray.push(polygon.getArea());
  24686. }
  24687. //iServer 9D新增字段
  24688. if (geoTopo.length === 0) {
  24689. //根据面积排序
  24690. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  24691. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  24692. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  24693. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  24694. //目标polygon索引列表 -1标示没有被任何polygon包含,
  24695. var targetArray = [];
  24696. for (let i = 1; i < polygonArrayTemp.length; i++) {
  24697. for (let j = i - 1; j >= 0; j--) {
  24698. targetArray[i] = -1;
  24699. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  24700. CCWIdent[i] = CCWIdent[j] * -1;
  24701. if (CCWIdent[i] < 0) {
  24702. targetArray[i] = j;
  24703. }
  24704. break;
  24705. }
  24706. }
  24707. }
  24708. for (let i = 0; i < polygonArrayTemp.length; i++) {
  24709. if (CCWIdent[i] > 0) {
  24710. polygonArray.push(polygonArrayTemp[i]);
  24711. } else {
  24712. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  24713. polygonArrayTemp[i].components
  24714. );
  24715. //占位
  24716. polygonArray.push('');
  24717. }
  24718. }
  24719. } else {
  24720. polygonArray = new Array();
  24721. for (let i = 0; i < polygonArrayTemp.length; i++) {
  24722. if (geoTopo[i] && geoTopo[i] == -1) {
  24723. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  24724. } else {
  24725. if (CCWArray.length > 0 && polygonArray.length > 0) {
  24726. polygonArray[polygonArray.length - 1].components =
  24727. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  24728. CCWArray = [];
  24729. }
  24730. polygonArray.push(polygonArrayTemp[i]);
  24731. }
  24732. if (i == len - 1) {
  24733. var polyLength = polygonArray.length;
  24734. if (polyLength) {
  24735. polygonArray[polyLength - 1].components =
  24736. polygonArray[polyLength - 1].components.concat(CCWArray);
  24737. } else {
  24738. for (let k = 0, length = CCWArray.length; k < length; k++) {
  24739. polygonArray.push(new Polygon_Polygon(CCWArray));
  24740. }
  24741. }
  24742. }
  24743. }
  24744. }
  24745. return new MultiPolygon(polygonArray);
  24746. }
  24747. /**
  24748. * @function ServerGeometry.prototype.toGeoRegionEPS
  24749. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  24750. * @returns {Geometry} 转换后的客户端几何对象。
  24751. */
  24752. toGeoRegionEPS() {
  24753. var me = this,
  24754. geoParts = me.parts || [],
  24755. geoTopo = me.partTopo || [],
  24756. geoPoints = me.points || [],
  24757. len = geoParts.length;
  24758. if (len <= 0) {
  24759. return null;
  24760. }
  24761. var polygonArray = [];
  24762. var pointList = [];
  24763. var lineEPS;
  24764. if (len == 1) {
  24765. for (var i = 0; i < geoPoints.length; i++) {
  24766. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  24767. }
  24768. lineEPS = LineString.createLineEPS(pointList);
  24769. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]));
  24770. return new MultiPolygon(polygonArray);
  24771. }
  24772. //处理复杂面
  24773. var CCWArray = [];
  24774. var areaArray = [];
  24775. var polygonArrayTemp = [];
  24776. var polygonBounds = [];
  24777. //polyon岛洞标识数组,初始都是岛。
  24778. var CCWIdent = [];
  24779. for (let i = 0, pointIndex = 0; i < len; i++) {
  24780. for (let j = 0; j < geoParts[i]; j++) {
  24781. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  24782. }
  24783. pointIndex += geoParts[i];
  24784. lineEPS = LineString.createLineEPS(pointList);
  24785. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]);
  24786. pointList = [];
  24787. polygonArrayTemp.push(polygon);
  24788. if (geoTopo.length === 0) {
  24789. polygonBounds.push(polygon.getBounds());
  24790. }
  24791. CCWIdent.push(1);
  24792. areaArray.push(polygon.getArea());
  24793. }
  24794. //iServer 9D新增字段
  24795. if (geoTopo.length === 0) {
  24796. //根据面积排序
  24797. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  24798. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  24799. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  24800. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  24801. //目标polygon索引列表 -1标示没有被任何polygon包含,
  24802. var targetArray = [];
  24803. for (let i = 1; i < polygonArrayTemp.length; i++) {
  24804. for (let j = i - 1; j >= 0; j--) {
  24805. targetArray[i] = -1;
  24806. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  24807. CCWIdent[i] = CCWIdent[j] * -1;
  24808. if (CCWIdent[i] < 0) {
  24809. targetArray[i] = j;
  24810. }
  24811. break;
  24812. }
  24813. }
  24814. }
  24815. for (let i = 0; i < polygonArrayTemp.length; i++) {
  24816. if (CCWIdent[i] > 0) {
  24817. polygonArray.push(polygonArrayTemp[i]);
  24818. } else {
  24819. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  24820. polygonArrayTemp[i].components
  24821. );
  24822. //占位
  24823. polygonArray.push('');
  24824. }
  24825. }
  24826. } else {
  24827. polygonArray = new Array();
  24828. for (let i = 0; i < polygonArrayTemp.length; i++) {
  24829. if (geoTopo[i] && geoTopo[i] == -1) {
  24830. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  24831. } else {
  24832. if (CCWArray.length > 0 && polygonArray.length > 0) {
  24833. polygonArray[polygonArray.length - 1].components =
  24834. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  24835. CCWArray = [];
  24836. }
  24837. polygonArray.push(polygonArrayTemp[i]);
  24838. }
  24839. if (i == len - 1) {
  24840. var polyLength = polygonArray.length;
  24841. if (polyLength) {
  24842. polygonArray[polyLength - 1].components =
  24843. polygonArray[polyLength - 1].components.concat(CCWArray);
  24844. } else {
  24845. for (let k = 0, length = CCWArray.length; k < length; k++) {
  24846. polygonArray.push(new Polygon_Polygon(CCWArray));
  24847. }
  24848. }
  24849. }
  24850. }
  24851. }
  24852. return new MultiPolygon(polygonArray);
  24853. }
  24854. transformGeoCompound() {
  24855. const me = this,
  24856. geoParts = me.geoParts || [],
  24857. len = geoParts.length;
  24858. if (len <= 0) {
  24859. return null;
  24860. }
  24861. const geometryList = [];
  24862. for (let index = 0; index < len; index++) {
  24863. const geometry = geoParts[index];
  24864. geometryList.push(new ServerGeometry(geometry).toGeometry());
  24865. }
  24866. return new Collection(geometryList);
  24867. }
  24868. /**
  24869. * @function ServerGeometry.prototype.fromJson
  24870. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  24871. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24872. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  24873. */
  24874. static fromJson(jsonObject) {
  24875. if (!jsonObject) {
  24876. return;
  24877. }
  24878. return new ServerGeometry({
  24879. id: jsonObject.id,
  24880. style: ServerStyle.fromJson(jsonObject.style),
  24881. parts: jsonObject.parts,
  24882. partTopo: jsonObject.partTopo,
  24883. points: jsonObject.points,
  24884. center: jsonObject.center,
  24885. length: jsonObject.length,
  24886. maxM: jsonObject.maxM,
  24887. minM: jsonObject.minM,
  24888. type: jsonObject.type
  24889. });
  24890. }
  24891. /**
  24892. * @function ServerGeometry.prototype.fromGeometry
  24893. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  24894. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  24895. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  24896. */
  24897. static fromGeometry(geometry) {
  24898. if (!geometry) {
  24899. return;
  24900. }
  24901. var id = 0,
  24902. parts = [],
  24903. points = [],
  24904. type = null,
  24905. icomponents = geometry.components,
  24906. className = geometry.CLASS_NAME,
  24907. prjCoordSys = { epsgCode: geometry.SRID };
  24908. if (!isNaN(geometry.id)) {
  24909. id = geometry.id;
  24910. }
  24911. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  24912. if (
  24913. className != 'SuperMap.Geometry.LinearRing' &&
  24914. className != 'SuperMap.Geometry.LineString' &&
  24915. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  24916. ) {
  24917. let ilen = icomponents.length;
  24918. for (let i = 0; i < ilen; i++) {
  24919. const vertices = icomponents[i].getVertices();
  24920. let partPointsCount = vertices.length;
  24921. parts.push(partPointsCount);
  24922. for (let j = 0; j < partPointsCount; j++) {
  24923. points.push(new Point(vertices[j].x, vertices[j].y));
  24924. }
  24925. }
  24926. //这里className不是多点就全部是算线
  24927. type = className == 'SuperMap.Geometry.MultiPoint' ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  24928. } else if (geometry instanceof MultiPolygon) {
  24929. let ilen = icomponents.length;
  24930. for (let i = 0; i < ilen; i++) {
  24931. let polygon = icomponents[i],
  24932. linearRingOfPolygon = polygon.components,
  24933. linearRingOfPolygonLen = linearRingOfPolygon.length;
  24934. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  24935. const vertices = linearRingOfPolygon[j].getVertices();
  24936. const partPointsCount = vertices.length + 1;
  24937. parts.push(partPointsCount);
  24938. for (let k = 0; k < partPointsCount - 1; k++) {
  24939. points.push(new Point(vertices[k].x, vertices[k].y));
  24940. }
  24941. points.push(
  24942. new Point(vertices[0].x, vertices[0].y)
  24943. );
  24944. }
  24945. }
  24946. type = REST_GeometryType.REGION;
  24947. } else if (geometry instanceof Polygon_Polygon) {
  24948. let ilen = icomponents.length;
  24949. for (let i = 0; i < ilen; i++) {
  24950. const vertices = icomponents[i].getVertices();
  24951. let partPointsCount = vertices.length + 1;
  24952. parts.push(partPointsCount);
  24953. for (let j = 0; j < partPointsCount - 1; j++) {
  24954. points.push(new Point(vertices[j].x, vertices[j].y));
  24955. }
  24956. points.push(new Point(vertices[0].x, vertices[0].y));
  24957. }
  24958. type = REST_GeometryType.REGION;
  24959. } else {
  24960. const vertices = geometry.getVertices();
  24961. let geometryVerticesCount = vertices.length;
  24962. for (let j = 0; j < geometryVerticesCount; j++) {
  24963. points.push(new Point(vertices[j].x, vertices[j].y));
  24964. }
  24965. if (geometry instanceof LinearRing_LinearRing) {
  24966. points.push(new Point(vertices[0].x, vertices[0].y));
  24967. geometryVerticesCount++;
  24968. }
  24969. parts.push(geometryVerticesCount);
  24970. type = geometry instanceof Point ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  24971. }
  24972. return new ServerGeometry({
  24973. id: id,
  24974. style: null,
  24975. parts: parts,
  24976. points: points,
  24977. type: type,
  24978. prjCoordSys: prjCoordSys
  24979. });
  24980. }
  24981. /**
  24982. * @function ServerGeometry.prototype.IsClockWise
  24983. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  24984. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  24985. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  24986. */
  24987. static IsClockWise(points) {
  24988. var length = points.length;
  24989. if (length < 3) {
  24990. return 0.0;
  24991. }
  24992. var s = points[0].y * (points[length - 1].x - points[1].x);
  24993. points.push(points[0]);
  24994. for (var i = 1; i < length; i++) {
  24995. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  24996. }
  24997. return s * 0.5;
  24998. }
  24999. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  25000. for (var i = 0; i < areaArray.length; i++) {
  25001. for (var j = 0; j < areaArray.length; j++) {
  25002. if (areaArray[i] > areaArray[j]) {
  25003. var d = areaArray[j];
  25004. areaArray[j] = areaArray[i];
  25005. areaArray[i] = d;
  25006. var b = pointList[j];
  25007. pointList[j] = pointList[i];
  25008. pointList[i] = b;
  25009. if (geoTopo && geoTopo.length > 0) {
  25010. var c = geoTopo[j];
  25011. geoTopo[j] = geoTopo[i];
  25012. geoTopo[i] = c;
  25013. }
  25014. if (polygonBounds && polygonBounds.length > 0) {
  25015. var f = polygonBounds[j];
  25016. polygonBounds[j] = polygonBounds[i];
  25017. polygonBounds[i] = f;
  25018. }
  25019. }
  25020. }
  25021. }
  25022. }
  25023. }
  25024. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  25025. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25026. * This program are made available under the terms of the Apache License, Version 2.0
  25027. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25028. /**
  25029. * @class GeoJSONFormat
  25030. * @aliasclass Format.GeoJSON
  25031. * @deprecatedclass SuperMap.Format.GeoJSON
  25032. * @classdesc GeoJSON 的读和写。使用 {@link GeoJSONObject} 构造器创建一个 GeoJSON 解析器。
  25033. * @category BaseTypes Format
  25034. * @param {Object} [options] - 可选参数。
  25035. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  25036. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  25037. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  25038. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  25039. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  25040. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  25041. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  25042. * @extends {JSONFormat}
  25043. * @usage
  25044. */
  25045. class GeoJSON extends JSONFormat {
  25046. constructor(options) {
  25047. super(options);
  25048. /**
  25049. * @member {boolean} [GeoJSONFormat.prototype.ignoreExtraDims=true]
  25050. * @description 忽略维度超过 2 的几何要素。
  25051. */
  25052. this.ignoreExtraDims = true;
  25053. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  25054. /**
  25055. * @member {Object} GeoJSONFormat.prototype.parseCoords
  25056. * @private
  25057. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  25058. */
  25059. this.parseCoords = {
  25060. /**
  25061. * @function GeoJSONFormat.parseCoords.point
  25062. * @description 将一组坐标转成一个 {@link Geometry} 对象。
  25063. * @param {Object} array - GeoJSON 片段中的一组坐标。
  25064. * @returns {Geometry} 一个几何对象。
  25065. */
  25066. "point": function (array) {
  25067. if (this.ignoreExtraDims === false &&
  25068. array.length != 2) {
  25069. throw "Only 2D points are supported: " + array;
  25070. }
  25071. return new Point(array[0], array[1]);
  25072. },
  25073. /**
  25074. * @function GeoJSONFormat.parseCoords.multipoint
  25075. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25076. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  25077. * @returns {Geometry} 一个几何对象。
  25078. */
  25079. "multipoint": function (array) {
  25080. var points = [];
  25081. var p = null;
  25082. for (var i = 0, len = array.length; i < len; ++i) {
  25083. try {
  25084. p = this.parseCoords["point"].apply(this, [array[i]]);
  25085. } catch (err) {
  25086. throw err;
  25087. }
  25088. points.push(p);
  25089. }
  25090. return new MultiPoint(points);
  25091. },
  25092. /**
  25093. * @function GeoJSONFormat.parseCoords.linestring
  25094. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25095. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  25096. * @returns {Geometry} 一个几何对象。
  25097. */
  25098. "linestring": function (array) {
  25099. var points = [];
  25100. var p = null;
  25101. for (var i = 0, len = array.length; i < len; ++i) {
  25102. try {
  25103. p = this.parseCoords["point"].apply(this, [array[i]]);
  25104. } catch (err) {
  25105. throw err;
  25106. }
  25107. points.push(p);
  25108. }
  25109. return new LineString(points);
  25110. },
  25111. /**
  25112. * @function GeoJSONFormat.parseCoords.multilinestring
  25113. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25114. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  25115. * @returns {Geometry} 一个几何对象。
  25116. */
  25117. "multilinestring": function (array) {
  25118. var lines = [];
  25119. var l = null;
  25120. for (var i = 0, len = array.length; i < len; ++i) {
  25121. try {
  25122. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  25123. } catch (err) {
  25124. throw err;
  25125. }
  25126. lines.push(l);
  25127. }
  25128. return new MultiLineString(lines);
  25129. },
  25130. /**
  25131. * @function GeoJSONFormat.parseCoords.polygon
  25132. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25133. * @returns {Geometry} 一个几何对象。
  25134. */
  25135. "polygon": function (array) {
  25136. var rings = [];
  25137. var r, l;
  25138. for (var i = 0, len = array.length; i < len; ++i) {
  25139. try {
  25140. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  25141. } catch (err) {
  25142. throw err;
  25143. }
  25144. r = new LinearRing_LinearRing(l.components);
  25145. rings.push(r);
  25146. }
  25147. return new Polygon_Polygon(rings);
  25148. },
  25149. /**
  25150. * @function GeoJSONFormat.parseCoords.multipolygon
  25151. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25152. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  25153. * @returns {Geometry} 一个几何对象。
  25154. */
  25155. "multipolygon": function (array) {
  25156. var polys = [];
  25157. var p = null;
  25158. for (var i = 0, len = array.length; i < len; ++i) {
  25159. try {
  25160. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  25161. } catch (err) {
  25162. throw err;
  25163. }
  25164. polys.push(p);
  25165. }
  25166. return new MultiPolygon(polys);
  25167. },
  25168. /**
  25169. * @function GeoJSONFormat.parseCoords.box
  25170. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  25171. * @param {Array} array - GeoJSON 片段中的坐标组数组。
  25172. * @returns {Geometry} 一个几何对象。
  25173. */
  25174. "box": function (array) {
  25175. if (array.length != 2) {
  25176. throw "GeoJSON box coordinates must have 2 elements";
  25177. }
  25178. return new Polygon_Polygon([
  25179. new LinearRing_LinearRing([
  25180. new Point(array[0][0], array[0][1]),
  25181. new Point(array[1][0], array[0][1]),
  25182. new Point(array[1][0], array[1][1]),
  25183. new Point(array[0][0], array[1][1]),
  25184. new Point(array[0][0], array[0][1])
  25185. ])
  25186. ]);
  25187. }
  25188. };
  25189. /**
  25190. * @member {Object} GeoJSONFormat.prototype.extract
  25191. * @private
  25192. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  25193. */
  25194. this.extract = {
  25195. /**
  25196. * @function GeoJSONFormat.extract.feature
  25197. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  25198. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  25199. * @returns {Object} 一个表示点的对象。
  25200. */
  25201. 'feature': function (feature) {
  25202. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  25203. var json = {
  25204. "type": "Feature",
  25205. "properties": this.createAttributes(feature),
  25206. "geometry": geom
  25207. };
  25208. if (feature.geometry && feature.geometry.type === 'TEXT') {
  25209. json.properties.texts = feature.geometry.texts;
  25210. json.properties.textStyle = feature.geometry.textStyle;
  25211. }
  25212. if (feature.fid) {
  25213. json.id = feature.fid;
  25214. }
  25215. if (feature.ID) {
  25216. json.id = feature.ID;
  25217. }
  25218. return json;
  25219. },
  25220. /**
  25221. * @function GeoJSONFormat.extract.geometry
  25222. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  25223. * @param {Object} geometry - iServer 几何对象。
  25224. * @returns {Object} 一个表示几何体的对象。
  25225. */
  25226. 'geometry': function (geometry) {
  25227. if (geometry == null) {
  25228. return null;
  25229. }
  25230. if (!geometry.parts && geometry.points) {
  25231. geometry.parts = [geometry.points.length];
  25232. }
  25233. var geo = geometry.hasOwnProperty('geometryType')
  25234. ? geometry
  25235. : new ServerGeometry(geometry).toGeometry() || geometry;
  25236. var geometryType = geo.geometryType || geo.type;
  25237. var data;
  25238. if (geometryType === "LinearRing") {
  25239. geometryType = "LineString";
  25240. }
  25241. if (geometryType === "LINEM") {
  25242. geometryType = "MultiLineString";
  25243. }
  25244. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  25245. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  25246. var json;
  25247. if (geometryType === "Collection") {
  25248. json = {
  25249. "type": "GeometryCollection",
  25250. "geometries": data
  25251. };
  25252. } else {
  25253. json = {
  25254. "type": geometryType,
  25255. "coordinates": data
  25256. };
  25257. }
  25258. return json;
  25259. },
  25260. /**
  25261. * @function GeoJSONFormat.extract.point
  25262. * @description 从一个点对象中返回一个坐标组。
  25263. * @param {GeometryPoint} point - 一个点对象。
  25264. * @returns {Array} 一个表示一个点的坐标组。
  25265. */
  25266. 'point': function (point) {
  25267. var p = [point.x, point.y];
  25268. for (var name in point) {
  25269. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  25270. p.push(point[name]);
  25271. }
  25272. }
  25273. return p;
  25274. },
  25275. /**
  25276. * @function GeoJSONFormat.extract.point
  25277. * @description 从一个文本对象中返回一个坐标组。
  25278. * @param {Object} geo - 一个文本对象。
  25279. * @returns {Array} 一个表示一个点的坐标组。
  25280. */
  25281. 'text': function (geo) {
  25282. return [geo.points[0].x, geo.points[0].y];
  25283. },
  25284. /**
  25285. * @function GeoJSONFormat.extract.multipoint
  25286. * @description 从一个多点对象中返一个坐标组数组。
  25287. * @param {GeometryMultiPoint} multipoint - 多点对象。
  25288. * @returns {Array} 一个表示多点的坐标组数组。
  25289. */
  25290. 'multipoint': function (multipoint) {
  25291. var array = [];
  25292. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  25293. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  25294. }
  25295. return array;
  25296. },
  25297. /**
  25298. * @function GeoJSONFormat.extract.linestring
  25299. * @description 从一个线对象中返回一个坐标组数组。
  25300. * @param {Linestring} linestring - 线对象。
  25301. * @returns {Array} 一个表示线对象的坐标组数组。
  25302. */
  25303. 'linestring': function (linestring) {
  25304. var array = [];
  25305. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  25306. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  25307. }
  25308. return array;
  25309. },
  25310. /**
  25311. * @function GeoJSONFormat.extract.multilinestring
  25312. * @description 从一个多线对象中返回一个线数组。
  25313. * @param {GeometryMultiLineString} multilinestring - 多线对象。
  25314. *
  25315. * @returns {Array} 一个表示多线的线数组。
  25316. */
  25317. 'multilinestring': function (multilinestring) {
  25318. var array = [];
  25319. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  25320. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  25321. }
  25322. return array;
  25323. },
  25324. /**
  25325. * @function GeoJSONFormat.extract.polygon
  25326. * @description 从一个面对象中返回一组线环。
  25327. * @param {GeometryPolygon} polygon - 面对象。
  25328. * @returns {Array} 一组表示面的线环。
  25329. */
  25330. 'polygon': function (polygon) {
  25331. var array = [];
  25332. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  25333. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  25334. }
  25335. return array;
  25336. },
  25337. /**
  25338. * @function GeoJSONFormat.extract.multipolygon
  25339. * @description 从一个多面对象中返回一组面。
  25340. * @param {GeometryMultiPolygon} multipolygon - 多面对象。
  25341. * @returns {Array} 一组表示多面的面。
  25342. */
  25343. 'multipolygon': function (multipolygon) {
  25344. var array = [];
  25345. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  25346. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  25347. }
  25348. return array;
  25349. },
  25350. /**
  25351. * @function GeoJSONFormat.extract.collection
  25352. * @description 从一个几何要素集合中一组几何要素数组。
  25353. * @param {GeometryCollection} collection - 几何要素集合。
  25354. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  25355. */
  25356. 'collection': function (collection) {
  25357. var len = collection.components.length;
  25358. var array = new Array(len);
  25359. for (var i = 0; i < len; ++i) {
  25360. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  25361. }
  25362. return array;
  25363. }
  25364. };
  25365. }
  25366. /**
  25367. * @function GeoJSONFormat.prototype.read
  25368. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  25369. * @param {GeoJSONObject} json - GeoJSON 对象。
  25370. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  25371. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  25372. * @returns {Object} 返回值依赖于 type 参数的值。
  25373. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link FeatureVector} 数组。
  25374. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link Geometry}。
  25375. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link FeatureVector}。
  25376. */
  25377. read(json, type, filter) {
  25378. type = (type) ? type : "FeatureCollection";
  25379. var results = null;
  25380. var obj = null;
  25381. if (typeof json == "string") {
  25382. obj = super.read(json, filter);
  25383. } else {
  25384. obj = json;
  25385. }
  25386. if (!obj) {
  25387. //console.error("Bad JSON: " + json);
  25388. } else if (typeof (obj.type) != "string") {
  25389. //console.error("Bad GeoJSON - no type: " + json);
  25390. } else if (this.isValidType(obj, type)) {
  25391. switch (type) {
  25392. case "Geometry":
  25393. try {
  25394. results = this.parseGeometry(obj);
  25395. } catch (err) {
  25396. //console.error(err);
  25397. }
  25398. break;
  25399. case "Feature":
  25400. try {
  25401. results = this.parseFeature(obj);
  25402. results.type = "Feature";
  25403. } catch (err) {
  25404. //console.error(err);
  25405. }
  25406. break;
  25407. case "FeatureCollection":
  25408. // for type FeatureCollection, we allow input to be any type
  25409. results = [];
  25410. switch (obj.type) {
  25411. case "Feature":
  25412. try {
  25413. results.push(this.parseFeature(obj));
  25414. } catch (err) {
  25415. results = null;
  25416. //console.error(err);
  25417. }
  25418. break;
  25419. case "FeatureCollection":
  25420. for (var i = 0, len = obj.features.length; i < len; ++i) {
  25421. try {
  25422. results.push(this.parseFeature(obj.features[i]));
  25423. } catch (err) {
  25424. results = null;
  25425. // console.error(err);
  25426. }
  25427. }
  25428. break;
  25429. default:
  25430. try {
  25431. var geom = this.parseGeometry(obj);
  25432. results.push(new Vector(geom));
  25433. } catch (err) {
  25434. results = null;
  25435. //console.error(err);
  25436. }
  25437. }
  25438. break;
  25439. default:
  25440. break;
  25441. }
  25442. }
  25443. return results;
  25444. }
  25445. /**
  25446. * @function GeoJSONFormat.prototype.write
  25447. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  25448. * @param {Object} obj - iServer Geometry JSON 对象。
  25449. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  25450. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  25451. */
  25452. write(obj, pretty) {
  25453. return super.write(this.toGeoJSON(obj), pretty);
  25454. }
  25455. /**
  25456. * @function GeoJSONFormat.prototype.fromGeoJSON
  25457. * @version 9.1.1
  25458. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  25459. * @param {GeoJSONObject} json - GeoJSON 对象。
  25460. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  25461. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  25462. * @returns {Object} iServer Feature JSON。
  25463. */
  25464. fromGeoJSON(json, type, filter) {
  25465. let feature = this.read(json, type, filter);
  25466. if (!Util_Util.isArray(feature)) {
  25467. return this._toiSevrerFeature(feature);
  25468. }
  25469. return feature.map((element) => {
  25470. return this._toiSevrerFeature(element);
  25471. })
  25472. }
  25473. /**
  25474. * @function GeoJSONFormat.prototype.toGeoJSON
  25475. * @version 9.1.1
  25476. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  25477. * @param {Object} obj - iServer Feature JSON。
  25478. * @returns {GeoJSONObject} GeoJSON 对象。
  25479. */
  25480. toGeoJSON(obj) {
  25481. var geojson = {
  25482. "type": null
  25483. };
  25484. if (Util_Util.isArray(obj)) {
  25485. geojson.type = "FeatureCollection";
  25486. var numFeatures = obj.length;
  25487. geojson.features = new Array(numFeatures);
  25488. for (var i = 0; i < numFeatures; ++i) {
  25489. var element = obj[i];
  25490. if (isGeometry(element)) {
  25491. let feature = {};
  25492. feature.geometry = element;
  25493. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  25494. } else {
  25495. geojson.features[i] = this.extract.feature.apply(this, [element]);
  25496. }
  25497. }
  25498. } else if (isGeometry(obj)) {
  25499. let feature = {};
  25500. feature.geometry = obj;
  25501. geojson = this.extract.feature.apply(this, [feature]);
  25502. } else {
  25503. geojson = this.extract.feature.apply(this, [obj]);
  25504. }
  25505. function isGeometry(input) {
  25506. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  25507. }
  25508. return geojson;
  25509. }
  25510. /**
  25511. * @function GeoJSONFormat.prototype.isValidType
  25512. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  25513. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  25514. * @private
  25515. */
  25516. isValidType(obj, type) {
  25517. var valid = false;
  25518. switch (type) {
  25519. case "Geometry":
  25520. if (Util_Util.indexOf(
  25521. ["Point", "MultiPoint", "LineString", "MultiLineString",
  25522. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  25523. ],
  25524. obj.type) == -1) {
  25525. // unsupported geometry type
  25526. //console.error("Unsupported geometry type: " +
  25527. // obj.type);
  25528. } else {
  25529. valid = true;
  25530. }
  25531. break;
  25532. case "FeatureCollection":
  25533. // allow for any type to be converted to a feature collection
  25534. valid = true;
  25535. break;
  25536. default:
  25537. // for Feature types must match
  25538. if (obj.type == type) {
  25539. valid = true;
  25540. } else {
  25541. //console.error("Cannot convert types from " +
  25542. //obj.type + " to " + type);
  25543. }
  25544. }
  25545. return valid;
  25546. }
  25547. /**
  25548. * @function GeoJSONFormat.prototype.parseFeature
  25549. * @description 将一个 GeoJSON 中的 feature 转化成 {@link FeatureVector}> 对象。
  25550. * @private
  25551. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  25552. * @returns {FeatureVector} 一个要素。
  25553. */
  25554. parseFeature(obj) {
  25555. var feature, geometry, attributes, bbox;
  25556. attributes = (obj.properties) ? obj.properties : {};
  25557. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  25558. try {
  25559. geometry = this.parseGeometry(obj.geometry);
  25560. } catch (err) {
  25561. // deal with bad geometries
  25562. throw err;
  25563. }
  25564. feature = new Vector(geometry, attributes);
  25565. if (bbox) {
  25566. feature.bounds = Bounds.fromArray(bbox);
  25567. }
  25568. if (obj.id) {
  25569. feature.geometry.id = obj.id;
  25570. feature.fid = obj.id;
  25571. }
  25572. return feature;
  25573. }
  25574. /**
  25575. * @function GeoJSONFormat.prototype.parseGeometry
  25576. * @description 将一个 GeoJSON 中的几何要素转化成 {@link Geometry} 对象。
  25577. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  25578. * @returns {Geometry} 一个几何要素。
  25579. * @private
  25580. */
  25581. parseGeometry(obj) {
  25582. if (obj == null) {
  25583. return null;
  25584. }
  25585. var geometry;
  25586. if (obj.type == "GeometryCollection") {
  25587. if (!(Util_Util.isArray(obj.geometries))) {
  25588. throw "GeometryCollection must have geometries array: " + obj;
  25589. }
  25590. var numGeom = obj.geometries.length;
  25591. var components = new Array(numGeom);
  25592. for (var i = 0; i < numGeom; ++i) {
  25593. components[i] = this.parseGeometry.apply(
  25594. this, [obj.geometries[i]]
  25595. );
  25596. }
  25597. geometry = new Collection(components);
  25598. } else {
  25599. if (!(Util_Util.isArray(obj.coordinates))) {
  25600. throw "Geometry must have coordinates array: " + obj;
  25601. }
  25602. if (!this.parseCoords[obj.type.toLowerCase()]) {
  25603. throw "Unsupported geometry type: " + obj.type;
  25604. }
  25605. try {
  25606. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  25607. this, [obj.coordinates]
  25608. );
  25609. } catch (err) {
  25610. // deal with bad coordinates
  25611. throw err;
  25612. }
  25613. }
  25614. return geometry;
  25615. }
  25616. /**
  25617. * @function GeoJSONFormat.prototype.createCRSObject
  25618. * @description 从一个要素对象中创建一个坐标参考系对象。
  25619. * @param {FeatureVector} object - 要素对象。
  25620. * @private
  25621. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  25622. */
  25623. createCRSObject(object) {
  25624. var proj = object.layer.projection.toString();
  25625. var crs = {};
  25626. if (proj.match(/epsg:/i)) {
  25627. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  25628. if (code == 4326) {
  25629. crs = {
  25630. "type": "name",
  25631. "properties": {
  25632. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  25633. }
  25634. };
  25635. } else {
  25636. crs = {
  25637. "type": "name",
  25638. "properties": {
  25639. "name": "EPSG:" + code
  25640. }
  25641. };
  25642. }
  25643. }
  25644. return crs;
  25645. }
  25646. _toiSevrerFeature(feature) {
  25647. const attributes = feature.attributes;
  25648. const attrNames = [];
  25649. const attrValues = [];
  25650. for (var attr in attributes) {
  25651. attrNames.push(attr);
  25652. attrValues.push(attributes[attr]);
  25653. }
  25654. const newFeature = {
  25655. fieldNames: attrNames,
  25656. fieldValues: attrValues,
  25657. geometry: ServerGeometry.fromGeometry(feature.geometry)
  25658. };
  25659. newFeature.geometry.id = feature.fid;
  25660. return newFeature;
  25661. }
  25662. createAttributes(feature) {
  25663. if (!feature) {
  25664. return null;
  25665. }
  25666. var attr = {};
  25667. processFieldsAttributes(feature, attr);
  25668. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  25669. for (var key in feature) {
  25670. if (exceptKeys.indexOf(key) > -1) {
  25671. continue;
  25672. }
  25673. attr[key] = feature[key];
  25674. }
  25675. function processFieldsAttributes(feature, attributes) {
  25676. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  25677. return;
  25678. }
  25679. var names = feature.fieldNames,
  25680. values = feature.fieldValues;
  25681. for (var i in names) {
  25682. attributes[names[i]] = values[i];
  25683. }
  25684. }
  25685. return attr;
  25686. }
  25687. }
  25688. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  25689. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25690. * This program are made available under the terms of the Apache License, Version 2.0
  25691. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25692. /**
  25693. * @class WKTFormat
  25694. * @aliasclass Format.WKT
  25695. * @deprecatedclass SuperMap.Format.WKT
  25696. * @classdesc 用于读写常见文本的类。通过 {@link WKTFormat} 构造器来创建一个新的实例。
  25697. * @category BaseTypes Format
  25698. * @extends {Format}
  25699. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link Format}。
  25700. * @usage
  25701. */
  25702. class WKT extends Format {
  25703. constructor(options) {
  25704. super(options);
  25705. this.regExes = {
  25706. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  25707. 'spaces': /\s+/,
  25708. 'parenComma': /\)\s*,\s*\(/,
  25709. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  25710. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  25711. };
  25712. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  25713. * @private
  25714. * @description Object with properties corresponding to the geometry types.
  25715. * Property values are functions that do the actual data extraction.
  25716. */
  25717. this.extract = {
  25718. /**
  25719. * @description Return a space delimited string of point coordinates.
  25720. * @param {GeometryPoint} point
  25721. * @returns {string} A string of coordinates representing the point
  25722. */
  25723. 'point': function (point) {
  25724. return point.x + ' ' + point.y;
  25725. },
  25726. /**
  25727. * @description Return a comma delimited string of point coordinates from a multipoint.
  25728. * @param {GeometryMultiPoint} multipoint
  25729. * @returns {string} A string of point coordinate strings representing
  25730. * the multipoint
  25731. */
  25732. 'multipoint'(multipoint) {
  25733. var array = [];
  25734. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  25735. array.push('(' +
  25736. this.extract.point.apply(this, [multipoint.components[i]]) +
  25737. ')');
  25738. }
  25739. return array.join(',');
  25740. },
  25741. /**
  25742. * @description Return a comma delimited string of point coordinates from a line.
  25743. * @param {GeometryLineString} linestring
  25744. * @returns {string} A string of point coordinate strings representing
  25745. * the linestring
  25746. */
  25747. 'linestring'(linestring) {
  25748. var array = [];
  25749. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  25750. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  25751. }
  25752. return array.join(',');
  25753. },
  25754. /**
  25755. * @description Return a comma delimited string of linestring strings from a multilinestring.
  25756. * @param {GeometryMultiLineString} multilinestring
  25757. * @returns {string} A string of of linestring strings representing
  25758. * the multilinestring
  25759. */
  25760. 'multilinestring'(multilinestring) {
  25761. var array = [];
  25762. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  25763. array.push('(' +
  25764. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  25765. ')');
  25766. }
  25767. return array.join(',');
  25768. },
  25769. /**
  25770. * @description Return a comma delimited string of linear ring arrays from a polygon.
  25771. * @param {GeometryPolygon} polygon
  25772. * @returns {string} An array of linear ring arrays representing the polygon
  25773. */
  25774. 'polygon'(polygon) {
  25775. var array = [];
  25776. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  25777. array.push('(' +
  25778. this.extract.linestring.apply(this, [polygon.components[i]]) +
  25779. ')');
  25780. }
  25781. return array.join(',');
  25782. },
  25783. /**
  25784. * @description Return an array of polygon arrays from a multipolygon.
  25785. * @param {GeometryMultiPolygon} multipolygon
  25786. * @returns {string} An array of polygon arrays representing
  25787. * the multipolygon
  25788. */
  25789. 'multipolygon'(multipolygon) {
  25790. var array = [];
  25791. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  25792. array.push('(' +
  25793. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  25794. ')');
  25795. }
  25796. return array.join(',');
  25797. },
  25798. /**
  25799. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <GeometryCollection>
  25800. * @param {GeometryCollection} collection
  25801. * @returns {string} internal WKT representation of the collection
  25802. */
  25803. 'collection'(collection) {
  25804. var array = [];
  25805. for (var i = 0, len = collection.components.length; i < len; ++i) {
  25806. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  25807. }
  25808. return array.join(',');
  25809. }
  25810. };
  25811. /**
  25812. * @private
  25813. * @description Object with properties corresponding to the geometry types.
  25814. * Property values are functions that do the actual parsing.
  25815. */
  25816. this.parse = {
  25817. /**
  25818. * @private
  25819. * @description Return point feature given a point WKT fragment.
  25820. * @param {string} str A WKT fragment representing the point
  25821. * @returns {FeatureVector} A point feature
  25822. *
  25823. */
  25824. 'point': function (str) {
  25825. var coords = StringExt.trim(str).split(this.regExes.spaces);
  25826. return new Vector(new Point(coords[0], coords[1])
  25827. );
  25828. },
  25829. /**
  25830. * @description Return a multipoint feature given a multipoint WKT fragment.
  25831. * @param {string} A WKT fragment representing the multipoint
  25832. * @returns {FeatureVector} A multipoint feature
  25833. * @private
  25834. */
  25835. 'multipoint': function (str) {
  25836. var point;
  25837. var points = StringExt.trim(str).split(',');
  25838. var components = [];
  25839. for (var i = 0, len = points.length; i < len; ++i) {
  25840. point = points[i].replace(this.regExes.trimParens, '$1');
  25841. components.push(this.parse.point.apply(this, [point]).geometry);
  25842. }
  25843. return new Vector(
  25844. new MultiPoint(components)
  25845. );
  25846. },
  25847. /**
  25848. * @description Return a linestring feature given a linestring WKT fragment.
  25849. * @param {string} A WKT fragment representing the linestring
  25850. * @returns {FeatureVector} A linestring feature
  25851. * @private
  25852. */
  25853. 'linestring': function (str) {
  25854. var points = StringExt.trim(str).split(',');
  25855. var components = [];
  25856. for (var i = 0, len = points.length; i < len; ++i) {
  25857. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  25858. }
  25859. return new Vector(
  25860. new LineString(components)
  25861. );
  25862. },
  25863. /**
  25864. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  25865. * @param {string} A WKT fragment representing the multilinestring
  25866. * @returns {FeatureVector} A multilinestring feature
  25867. * @private
  25868. */
  25869. 'multilinestring': function (str) {
  25870. var line;
  25871. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  25872. var components = [];
  25873. for (var i = 0, len = lines.length; i < len; ++i) {
  25874. line = lines[i].replace(this.regExes.trimParens, '$1');
  25875. components.push(this.parse.linestring.apply(this, [line]).geometry);
  25876. }
  25877. return new Vector(
  25878. new MultiLineString(components)
  25879. );
  25880. },
  25881. /**
  25882. * @description Return a polygon feature given a polygon WKT fragment.
  25883. * @param {string} A WKT fragment representing the polygon
  25884. * @returns {FeatureVector} A polygon feature
  25885. * @private
  25886. */
  25887. 'polygon': function (str) {
  25888. var ring, linestring, linearring;
  25889. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  25890. var components = [];
  25891. for (var i = 0, len = rings.length; i < len; ++i) {
  25892. ring = rings[i].replace(this.regExes.trimParens, '$1');
  25893. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  25894. linearring = new LinearRing_LinearRing(linestring.components);
  25895. components.push(linearring);
  25896. }
  25897. return new Vector(
  25898. new Polygon_Polygon(components)
  25899. );
  25900. },
  25901. /**
  25902. * @private
  25903. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  25904. * @param {string} A WKT fragment representing the multipolygon
  25905. * @returns {FeatureVector} A multipolygon feature
  25906. *
  25907. */
  25908. 'multipolygon': function (str) {
  25909. var polygon;
  25910. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  25911. var components = [];
  25912. for (var i = 0, len = polygons.length; i < len; ++i) {
  25913. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  25914. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  25915. }
  25916. return new Vector(
  25917. new MultiPolygon(components)
  25918. );
  25919. },
  25920. /**
  25921. * @description Return an array of features given a geometrycollection WKT fragment.
  25922. * @param {string} A WKT fragment representing the geometrycollection
  25923. * @returns {Array} An array of FeatureVector
  25924. * @private
  25925. */
  25926. 'geometrycollection': function (str) {
  25927. // separate components of the collection with |
  25928. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  25929. var wktArray = StringExt.trim(str).split('|');
  25930. var components = [];
  25931. for (var i = 0, len = wktArray.length; i < len; ++i) {
  25932. components.push(this.read(wktArray[i]));
  25933. }
  25934. return components;
  25935. }
  25936. };
  25937. }
  25938. /**
  25939. * @function WKTFormat.prototype.read
  25940. * @description 反序列化 WKT 字符串并返回向量特征或向量特征数组。支持 POINT、MULTIPOINT、LINESTRING、MULTILINESTRING、POLYGON、MULTIPOLYGON 和 GEOMETRYCOLLECTION 的 WKT。
  25941. * @param {string} wkt - WKT 字符串。
  25942. * @returns {FeatureVector|Array} GEOMETRYCOLLECTION WKT 的矢量要素或者矢量要素数组。
  25943. */
  25944. read(wkt) {
  25945. var features, type, str;
  25946. wkt = wkt.replace(/[\n\r]/g, " ");
  25947. var matches = this.regExes.typeStr.exec(wkt);
  25948. if (matches) {
  25949. type = matches[1].toLowerCase();
  25950. str = matches[2];
  25951. if (this.parse[type]) {
  25952. features = this.parse[type].apply(this, [str]);
  25953. }
  25954. }
  25955. return features;
  25956. }
  25957. /**
  25958. * @function WKTFormat.prototype.write
  25959. * @description 将矢量要素或矢量要素数组序列化为 WKT 字符串。
  25960. * @param {(FeatureVector|Array)} features - 矢量要素或矢量要素数组。
  25961. * @returns {string} 表示几何的 WKT 字符串。
  25962. */
  25963. write(features) {
  25964. var collection, geometry, isCollection;
  25965. if (features.constructor === Array) {
  25966. collection = features;
  25967. isCollection = true;
  25968. } else {
  25969. collection = [features];
  25970. isCollection = false;
  25971. }
  25972. var pieces = [];
  25973. if (isCollection) {
  25974. pieces.push('GEOMETRYCOLLECTION(');
  25975. }
  25976. for (var i = 0, len = collection.length; i < len; ++i) {
  25977. if (isCollection && i > 0) {
  25978. pieces.push(',');
  25979. }
  25980. geometry = collection[i].geometry;
  25981. pieces.push(this.extractGeometry(geometry));
  25982. }
  25983. if (isCollection) {
  25984. pieces.push(')');
  25985. }
  25986. return pieces.join('');
  25987. }
  25988. /**
  25989. * @function WKTFormat.prototype.extractGeometry
  25990. * @description 为单个 Geometry 对象构造 WKT 的入口点。
  25991. * @param {Geometry} geometry - Geometry 对象。
  25992. * @returns {string} 表示几何的 WKT 字符串。
  25993. */
  25994. extractGeometry(geometry) {
  25995. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  25996. if (!this.extract[type]) {
  25997. return null;
  25998. }
  25999. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  26000. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  26001. return data;
  26002. }
  26003. }
  26004. ;// CONCATENATED MODULE: ./src/common/format/index.js
  26005. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26006. * This program are made available under the terms of the Apache License, Version 2.0
  26007. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26008. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  26009. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26010. * This program are made available under the terms of the Apache License, Version 2.0
  26011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26012. /**
  26013. * @class TimeControlBase
  26014. * @deprecatedclass SuperMap.TimeControlBase
  26015. * @classdesc 时间控制基类。
  26016. * @modulecategory Control
  26017. * @category Control
  26018. * @param {Object} options - 可选参数。
  26019. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  26020. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  26021. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  26022. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  26023. * @param {boolean} [options.repeat=true] - 是否重复循环。
  26024. * @param {boolean} [options.reverse=false] - 是否反向。
  26025. * @usage
  26026. */
  26027. class TimeControlBase {
  26028. constructor(options) {
  26029. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  26030. var me = this;
  26031. options = options || {};
  26032. /**
  26033. * @member {number} [TimeControlBase.prototype.speed=1]
  26034. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)。
  26035. */
  26036. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  26037. /**
  26038. * @member {number} [TimeControlBase.prototype.frequency=1000]
  26039. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  26040. */
  26041. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  26042. /**
  26043. * @member {number} [TimeControlBase.prototype.startTime=0]
  26044. * @description 记录的起始时间,必须为数字,
  26045. * 如果不设置,初始化时为0,建议设置。
  26046. */
  26047. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  26048. /**
  26049. * @member {number} TimeControlBase.prototype.endTime
  26050. * @description 记录的结束时间,必须为数字,
  26051. * 如果不设置,初始化时以当前时间进行设置,建议设置。
  26052. */
  26053. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  26054. /**
  26055. * @member {boolean} [TimeControlBase.prototype.repeat=true]
  26056. * @description 是否重复循环。
  26057. */
  26058. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  26059. /**
  26060. * @member {boolean} [TimeControlBase.prototype.reverse=false]
  26061. * @description 是否反向。
  26062. */
  26063. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  26064. /**
  26065. * @member {number} TimeControlBase.prototype.currentTime
  26066. * @description 记录近期的时间,也就是当前帧运行到的时间。
  26067. */
  26068. this.currentTime = null;
  26069. /**
  26070. * @member {number} TimeControlBase.prototype.oldTime
  26071. * @description 记录上一帧的时间,也就是之前运行到的时间。
  26072. */
  26073. this.oldTime = null;
  26074. /**
  26075. * @member {boolean} [TimeControlBase.prototype.running=false]
  26076. * @description 记录当前是否处于运行中。
  26077. */
  26078. this.running = false;
  26079. /**
  26080. * @private
  26081. * @member {Array.<string>} TimeControlBase.prototype.EVENT_TYPES
  26082. * @description 此类支持的事件类型。
  26083. *
  26084. */
  26085. this.EVENT_TYPES = ["start", "pause", "stop"];
  26086. /**
  26087. * @private
  26088. * @member {Events} TimeControlBase.prototype.events
  26089. * @description 事件
  26090. */
  26091. me.events = new Events(this, null, this.EVENT_TYPES);
  26092. me.speed = Number(me.speed);
  26093. me.frequency = Number(me.frequency);
  26094. me.startTime = Number(me.startTime);
  26095. me.endTime = Number(me.endTime);
  26096. me.startTime = Date.parse(new Date(me.startTime));
  26097. me.endTime = Date.parse(new Date(me.endTime));
  26098. //初始化当前时间
  26099. me.currentTime = me.startTime;
  26100. this.CLASS_NAME = "SuperMap.TimeControlBase";
  26101. }
  26102. /**
  26103. * @function TimeControlBase.prototype.updateOptions
  26104. * @description 更新参数。
  26105. * @param {Object} options - 设置参数的可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  26106. */
  26107. updateOptions(options) {
  26108. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  26109. var me = this;
  26110. options = options || {};
  26111. if (options.speed && options.speed >= 0) {
  26112. me.speed = options.speed;
  26113. me.speed = Number(me.speed);
  26114. }
  26115. if (options.speed && options.frequency >= 0) {
  26116. me.frequency = options.frequency;
  26117. me.frequency = Number(me.frequency);
  26118. }
  26119. if (options.startTime && options.startTime != null) {
  26120. me.startTime = options.startTime;
  26121. me.startTime = Date.parse(new Date(me.startTime));
  26122. }
  26123. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  26124. me.endTime = options.endTime;
  26125. me.endTime = Date.parse(new Date(me.endTime));
  26126. }
  26127. if (options.repeat != null) {
  26128. me.repeat = options.repeat;
  26129. }
  26130. if (options.reverse != null) {
  26131. me.reverse = options.reverse;
  26132. }
  26133. }
  26134. /**
  26135. * @function TimeControlBase.prototype.start
  26136. * @description 开始。
  26137. */
  26138. start() {
  26139. var me = this;
  26140. if (!me.running) {
  26141. me.running = true;
  26142. me.tick();
  26143. me.events.triggerEvent('start', me.currentTime);
  26144. }
  26145. }
  26146. /**
  26147. * @function TimeControlBase.prototype.pause
  26148. * @description 暂停。
  26149. */
  26150. pause() {
  26151. var me = this;
  26152. me.running = false;
  26153. me.events.triggerEvent('pause', me.currentTime);
  26154. }
  26155. /**
  26156. * @function TimeControlBase.prototype.stop
  26157. * @description 停止,停止后返回起始状态。
  26158. */
  26159. stop() {
  26160. var me = this;
  26161. //停止时 时间设置为开始时间
  26162. me.currentTime = me.startTime;
  26163. //如果正在运行,修改为初始时间即可绘制一帧
  26164. if (me.running) {
  26165. me.running = false;
  26166. }
  26167. me.events.triggerEvent('stop', me.currentTime);
  26168. }
  26169. /**
  26170. * @function TimeControlBase.prototype.toggle
  26171. * @description 开关切换,切换的是开始和暂停。
  26172. */
  26173. toggle() {
  26174. var me = this;
  26175. if (me.running) {
  26176. me.pause();
  26177. } else {
  26178. me.start();
  26179. }
  26180. }
  26181. /**
  26182. * @function TimeControlBase.prototype.setSpeed
  26183. * @description 设置步长。
  26184. * @param {number} [speed=1] - 步长,必须为非负数。
  26185. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  26186. */
  26187. setSpeed(speed) {
  26188. var me = this;
  26189. if (speed >= 0) {
  26190. me.speed = speed;
  26191. return true;
  26192. }
  26193. return false;
  26194. }
  26195. /**
  26196. * @function TimeControlBase.prototype.getSpeed
  26197. * @description 获取步长。
  26198. * @returns {number} 返回当前的步长。
  26199. */
  26200. getSpeed() {
  26201. return this.speed;
  26202. }
  26203. /**
  26204. * @function TimeControlBase.prototype.setFrequency
  26205. * @description 设置刷新频率。
  26206. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  26207. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  26208. */
  26209. setFrequency(frequency) {
  26210. var me = this;
  26211. if (frequency >= 0) {
  26212. me.frequency = frequency;
  26213. return true;
  26214. }
  26215. return false;
  26216. }
  26217. /**
  26218. * @function TimeControlBase.prototype.getFrequency
  26219. * @description 获取刷新频率。
  26220. * @returns {number} 返回当前的刷新频率。
  26221. */
  26222. getFrequency() {
  26223. return this.frequency;
  26224. }
  26225. /**
  26226. * @function TimeControlBase.prototype.setStartTime
  26227. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  26228. * @param {number} startTime - 需要设置的起始时间。
  26229. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  26230. */
  26231. setStartTime(startTime) {
  26232. var me = this;
  26233. startTime = Date.parse(new Date(startTime));
  26234. //起始时间不得大于结束时间
  26235. if (startTime > me.endTime) {
  26236. return false;
  26237. }
  26238. me.startTime = startTime;
  26239. //如果当前时间小于了起始时间,则从当前起始时间开始
  26240. if (me.currentTime < me.startTime) {
  26241. me.currentTime = me.startTime;
  26242. me.tick();
  26243. }
  26244. return true;
  26245. }
  26246. /**
  26247. * @function TimeControlBase.prototype.getStartTime
  26248. * @description 获取起始时间。
  26249. * @returns {number} 返回当前的起始时间。
  26250. */
  26251. getStartTime() {
  26252. return this.startTime;
  26253. }
  26254. /**
  26255. * @function TimeControlBase.prototype.setEndTime
  26256. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  26257. * @param {number} endTime - 需要设置的结束时间。
  26258. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  26259. */
  26260. setEndTime(endTime) {
  26261. var me = this;
  26262. me.endTime = Date.parse(new Date(me.endTime));
  26263. //结束时间不得小于开始时间
  26264. if (endTime < me.startTime) {
  26265. return false;
  26266. }
  26267. me.endTime = endTime;
  26268. //如果当前时间大于了结束时间,则从起始时间开始
  26269. if (me.currentTime >= me.endTime) {
  26270. me.currentTime = me.startTime;
  26271. me.tick();
  26272. }
  26273. return true;
  26274. }
  26275. /**
  26276. * @function TimeControlBase.prototype.getEndTime
  26277. * @description 获取结束时间。
  26278. * @returns {number} 返回当前的结束时间。
  26279. */
  26280. getEndTime() {
  26281. return this.endTime;
  26282. }
  26283. /**
  26284. * @function TimeControlBase.prototype.setCurrentTime
  26285. * @description 设置当前时间。
  26286. * @param {number} currentTime - 需要设置的当前时间。
  26287. * @returns {boolean} true 代表设置成功,false 设置失败。
  26288. */
  26289. setCurrentTime(currentTime) {
  26290. var me = this;
  26291. me.currentTime = Date.parse(new Date(me.currentTime));
  26292. //结束时间不得小于开始时间
  26293. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  26294. me.currentTime = currentTime;
  26295. me.startTime = me.currentTime;
  26296. me.tick();
  26297. return true;
  26298. }
  26299. return false;
  26300. }
  26301. /**
  26302. * @function TimeControlBase.prototype.getCurrentTime
  26303. * @description 获取当前时间。
  26304. * @returns {number} 返回当前时间。
  26305. */
  26306. getCurrentTime() {
  26307. return this.currentTime;
  26308. }
  26309. /**
  26310. * @function TimeControlBase.prototype.setRepeat
  26311. * @description 设置是否重复循环。
  26312. * @param {boolean} [repeat=true] - 是否重复循环。
  26313. */
  26314. setRepeat(repeat) {
  26315. this.repeat = repeat;
  26316. }
  26317. /**
  26318. * @function TimeControlBase.prototype.getRepeat
  26319. * @description 获取是否重复循环,默认是 true。
  26320. * @returns {boolean} 返回是否重复循环。
  26321. */
  26322. getRepeat() {
  26323. return this.repeat;
  26324. }
  26325. /**
  26326. * @function TimeControlBase.prototype.setReverse
  26327. * @description 设置是否反向。
  26328. * @param {boolean} [reverse=false] - 是否反向。
  26329. */
  26330. setReverse(reverse) {
  26331. this.reverse = reverse;
  26332. }
  26333. /**
  26334. * @function TimeControlBase.prototype.getReverse
  26335. * @description 获取是否反向,默认是false。
  26336. * @returns {boolean} 返回是否反向。
  26337. */
  26338. getReverse() {
  26339. return this.reverse;
  26340. }
  26341. /**
  26342. * @function TimeControlBase.prototype.getRunning
  26343. * @description 获取运行状态。
  26344. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  26345. */
  26346. getRunning() {
  26347. return this.running;
  26348. }
  26349. /**
  26350. * @function TimeControlBase.prototype.destroy
  26351. * @description 销毁 Animator 对象,释放资源。
  26352. */
  26353. destroy() {
  26354. var me = this;
  26355. me.speed = null;
  26356. me.frequency = null;
  26357. me.startTime = null;
  26358. me.endTime = null;
  26359. me.currentTime = null;
  26360. me.repeat = null;
  26361. me.running = false;
  26362. me.reverse = null;
  26363. }
  26364. tick() {
  26365. //TODO 每次刷新执行的操作。子类实现
  26366. }
  26367. }
  26368. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  26369. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26370. * This program are made available under the terms of the Apache License, Version 2.0
  26371. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26372. /**
  26373. * @class TimeFlowControl
  26374. * @deprecatedclass SuperMap.TimeFlowControl
  26375. * @category Control
  26376. * @classdesc 时间管理类。此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  26377. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  26378. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会变化 1 次(通过 setFrequency 修改)
  26379. * @modulecategory Control
  26380. * @extends {TimeControlBase}
  26381. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  26382. * @param {Object} options - 可选参数。
  26383. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  26384. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  26385. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  26386. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  26387. * @param {boolean} [options.repeat=true] - 是否重复循环。
  26388. * @param {boolean} [options.reverse=false] - 是否反向。
  26389. * @usage
  26390. */
  26391. class TimeFlowControl extends TimeControlBase {
  26392. constructor(callback, options) {
  26393. super(options);
  26394. var me = this;
  26395. /**
  26396. * @member TimeFlowControl.prototype.callback -{function}
  26397. * @description 每次刷新执行的回调函数。
  26398. */
  26399. me.callback = callback;
  26400. //先让IE下支持bind方法
  26401. if (!Function.prototype.bind) {
  26402. Function.prototype.bind = function (oThis) {
  26403. if (typeof this !== "function") {
  26404. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  26405. }
  26406. var aArgs = Array.prototype.slice.call(arguments, 1),
  26407. fToBind = this,
  26408. fNOP = function () {
  26409. //empty Function
  26410. },
  26411. fBound = function () {
  26412. return fToBind.apply(this instanceof fNOP && oThis
  26413. ? this
  26414. : oThis,
  26415. aArgs.concat(Array.prototype.slice.call(arguments)));
  26416. };
  26417. fNOP.prototype = this.prototype;
  26418. fBound.prototype = new fNOP();
  26419. return fBound;
  26420. };
  26421. }
  26422. //保证 this.tick 的上下文还是 TimeControl 这个对象
  26423. me.update = me.update.bind(me);
  26424. me.oldTime = me.currentTime;
  26425. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  26426. }
  26427. /**
  26428. * @function TimeFlowControl.prototype.updateOptions
  26429. * @override
  26430. */
  26431. updateOptions(options) {
  26432. options = options || {};
  26433. super.updateOptions(options);
  26434. }
  26435. /**
  26436. * @function TimeFlowControl.prototype.start
  26437. * @override
  26438. */
  26439. start() {
  26440. var me = this;
  26441. if (me.running) {
  26442. return;
  26443. }
  26444. me.running = true;
  26445. if (me.reverse) {
  26446. if (me.currentTime === me.startTime) {
  26447. me.oldTime = me.endTime;
  26448. me.currentTime = me.oldTime;
  26449. }
  26450. } else {
  26451. if (me.oldTime === me.endTime) {
  26452. me.currentTime = me.startTime;
  26453. me.oldTime = me.currentTime;
  26454. }
  26455. }
  26456. me.tick();
  26457. }
  26458. /**
  26459. * @function TimeFlowControl.prototype.stop
  26460. * @override
  26461. */
  26462. stop() {
  26463. super.stop();
  26464. var me = this;
  26465. me.oldTime = me.currentTime;
  26466. if (me.running) {
  26467. me.running = false;
  26468. }
  26469. //清除定时tick
  26470. me.intervalId && window.clearTimeout(me.intervalId);
  26471. }
  26472. /**
  26473. * @function TimeFlowControl.prototype.destroy
  26474. * @override
  26475. */
  26476. destroy() {
  26477. super.destroy();
  26478. var me = this;
  26479. me.oldTime = null;
  26480. me.callback = null;
  26481. }
  26482. /**
  26483. * @function TimeFlowControl.prototype.tick
  26484. * @description 定时刷新。
  26485. */
  26486. tick() {
  26487. var me = this;
  26488. me.intervalId && window.clearInterval(me.intervalId);
  26489. me.intervalId = null;
  26490. me.update();
  26491. me.intervalId = window.setInterval(me.update, me.frequency);
  26492. }
  26493. /**
  26494. * @function TimeFlowControl.prototype.update
  26495. * @description 更新控件。
  26496. */
  26497. update() {
  26498. var me = this;
  26499. //判定是否还需要继续
  26500. if (!me.running) {
  26501. return;
  26502. }
  26503. //调用回调函数
  26504. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  26505. if (!me.reverse) {
  26506. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  26507. if (me.currentTime === me.endTime) {
  26508. //不循环时
  26509. if (!me.repeat) {
  26510. me.running = false;
  26511. me.stop();
  26512. return null;
  26513. }
  26514. me.stop();
  26515. me.currentTime = me.startTime;
  26516. me.oldTime = me.currentTime;
  26517. me.start();
  26518. } else {//否则时间递增
  26519. me.oldTime = me.currentTime;
  26520. me.currentTime += me.speed;
  26521. }
  26522. if (me.currentTime >= me.endTime) {
  26523. me.currentTime = me.endTime;
  26524. }
  26525. } else {
  26526. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  26527. if (me.currentTime === me.startTime) {
  26528. //不循环时
  26529. if (!me.repeat) {
  26530. me.running = false;
  26531. return null;
  26532. }
  26533. me.oldTime = me.endTime;
  26534. me.currentTime = me.oldTime;
  26535. } else {//否则时间递减
  26536. me.currentTime = me.oldTime;
  26537. me.oldTime -= me.speed;
  26538. }
  26539. if (me.oldTime <= me.startTime) {
  26540. me.oldTime = me.startTime;
  26541. }
  26542. }
  26543. }
  26544. }
  26545. ;// CONCATENATED MODULE: ./src/common/control/index.js
  26546. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26547. * This program are made available under the terms of the Apache License, Version 2.0
  26548. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26549. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  26550. var polyfill = __webpack_require__(107);
  26551. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  26552. var fetch_ie8_fetch = __webpack_require__(693);
  26553. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  26554. var fetch_jsonp = __webpack_require__(144);
  26555. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  26556. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  26557. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26558. * This program are made available under the terms of the Apache License, Version 2.0
  26559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26560. let FetchRequest_fetch = window.fetch;
  26561. var setFetch = function (newFetch) {
  26562. FetchRequest_fetch = newFetch;
  26563. }
  26564. var RequestJSONPPromise = {
  26565. limitLength: 1500,
  26566. queryKeys: [],
  26567. queryValues: [],
  26568. supermap_callbacks: {},
  26569. addQueryStrings: function (values) {
  26570. var me = this;
  26571. for (var key in values) {
  26572. me.queryKeys.push(key);
  26573. if (typeof values[key] !== 'string') {
  26574. values[key] = Util_Util.toJSON(values[key]);
  26575. }
  26576. var tempValue = encodeURIComponent(values[key]);
  26577. me.queryValues.push(tempValue);
  26578. }
  26579. },
  26580. issue: function (config) {
  26581. var me = this,
  26582. uid = me.getUid(),
  26583. url = config.url,
  26584. splitQuestUrl = [];
  26585. // me.addQueryStrings({
  26586. // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  26587. // });
  26588. var sectionURL = url,
  26589. keysCount = 0; //此次sectionURL中有多少个key
  26590. var length = me.queryKeys ? me.queryKeys.length : 0;
  26591. for (var i = 0; i < length; i++) {
  26592. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  26593. //+2 for ("&"or"?")and"="
  26594. if (keysCount == 0) {
  26595. return false;
  26596. }
  26597. splitQuestUrl.push(sectionURL);
  26598. sectionURL = url;
  26599. keysCount = 0;
  26600. i--;
  26601. } else {
  26602. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  26603. var leftValue = me.queryValues[i];
  26604. while (leftValue.length > 0) {
  26605. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  26606. if (sectionURL.indexOf('?') > -1) {
  26607. sectionURL += '&';
  26608. } else {
  26609. sectionURL += '?';
  26610. }
  26611. var tempLeftValue = leftValue.substring(0, leftLength);
  26612. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  26613. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  26614. leftLength -= 1;
  26615. tempLeftValue = leftValue.substring(0, leftLength);
  26616. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  26617. leftLength -= 2;
  26618. tempLeftValue = leftValue.substring(0, leftLength);
  26619. }
  26620. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  26621. leftValue = leftValue.substring(leftLength);
  26622. if (tempLeftValue.length > 0) {
  26623. splitQuestUrl.push(sectionURL);
  26624. sectionURL = url;
  26625. keysCount = 0;
  26626. }
  26627. }
  26628. } else {
  26629. keysCount++;
  26630. if (sectionURL.indexOf('?') > -1) {
  26631. sectionURL += '&';
  26632. } else {
  26633. sectionURL += '?';
  26634. }
  26635. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  26636. }
  26637. }
  26638. }
  26639. splitQuestUrl.push(sectionURL);
  26640. return me.send(
  26641. splitQuestUrl,
  26642. 'SuperMapJSONPCallbacks_' + uid,
  26643. config && config.proxy
  26644. );
  26645. },
  26646. getUid: function () {
  26647. var uid = new Date().getTime(),
  26648. random = Math.floor(Math.random() * 1e17);
  26649. return uid * 1000 + random;
  26650. },
  26651. send: function (splitQuestUrl, callback, proxy) {
  26652. var len = splitQuestUrl.length;
  26653. if (len > 0) {
  26654. return new Promise((resolve) => {
  26655. var jsonpUserID = new Date().getTime();
  26656. for (var i = 0; i < len; i++) {
  26657. var url = splitQuestUrl[i];
  26658. if (url.indexOf('?') > -1) {
  26659. url += '&';
  26660. } else {
  26661. url += '?';
  26662. }
  26663. url += 'sectionCount=' + len;
  26664. url += '&sectionIndex=' + i;
  26665. url += '&jsonpUserID=' + jsonpUserID;
  26666. if (proxy) {
  26667. url = decodeURIComponent(url);
  26668. url = proxy + encodeURIComponent(url);
  26669. }
  26670. fetch_jsonp_default()(url, {
  26671. jsonpCallbackFunction: callback,
  26672. timeout: 30000
  26673. }).then((result) => {
  26674. resolve(result.json());
  26675. });
  26676. }
  26677. })
  26678. }
  26679. },
  26680. GET: function (config) {
  26681. var me = this;
  26682. me.queryKeys.length = 0;
  26683. me.queryValues.length = 0;
  26684. me.addQueryStrings(config.params);
  26685. return me.issue(config);
  26686. },
  26687. POST: function (config) {
  26688. var me = this;
  26689. me.queryKeys.length = 0;
  26690. me.queryValues.length = 0;
  26691. me.addQueryStrings({
  26692. requestEntity: config.data
  26693. });
  26694. return me.issue(config);
  26695. },
  26696. PUT: function (config) {
  26697. var me = this;
  26698. me.queryKeys.length = 0;
  26699. me.queryValues.length = 0;
  26700. me.addQueryStrings({
  26701. requestEntity: config.data
  26702. });
  26703. return me.issue(config);
  26704. },
  26705. DELETE: function (config) {
  26706. var me = this;
  26707. me.queryKeys.length = 0;
  26708. me.queryValues.length = 0;
  26709. me.addQueryStrings({
  26710. requestEntity: config.data
  26711. });
  26712. return me.issue(config);
  26713. }
  26714. };
  26715. var CORS;
  26716. var RequestTimeout;
  26717. /**
  26718. * @function setCORS
  26719. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  26720. * @category BaseTypes Util
  26721. * @param {boolean} cors - 是否允许跨域请求。
  26722. * @usage
  26723. * ```
  26724. * // 浏览器
  26725. * <script type="text/javascript" src="{cdn}"></script>
  26726. * <script>
  26727. * {namespace}.setCORS(cors);
  26728. *
  26729. * // 弃用的写法
  26730. * SuperMap.setCORS(cors);
  26731. *
  26732. * </script>
  26733. *
  26734. * // ES6 Import
  26735. * import { setCORS } from '{npm}';
  26736. *
  26737. * setCORS(cors);
  26738. * ```
  26739. */
  26740. var setCORS = function (cors) {
  26741. CORS = cors;
  26742. }
  26743. /**
  26744. * @function isCORS
  26745. * @description 是是否允许跨域请求。
  26746. * @category BaseTypes Util
  26747. * @returns {boolean} 是否允许跨域请求。
  26748. * @usage
  26749. * ```
  26750. * // 浏览器
  26751. * <script type="text/javascript" src="{cdn}"></script>
  26752. * <script>
  26753. * const result = {namespace}.isCORS();
  26754. *
  26755. * // 弃用的写法
  26756. * const result = SuperMap.isCORS();
  26757. *
  26758. * </script>
  26759. *
  26760. * // ES6 Import
  26761. * import { isCORS } from '{npm}';
  26762. *
  26763. * const result = isCORS();
  26764. * ```
  26765. */
  26766. var isCORS = function () {
  26767. if (CORS != undefined) {
  26768. return CORS;
  26769. }
  26770. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  26771. }
  26772. /**
  26773. * @function setRequestTimeout
  26774. * @category BaseTypes Util
  26775. * @description 设置请求超时时间。
  26776. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  26777. * @usage
  26778. * ```
  26779. * // 浏览器
  26780. <script type="text/javascript" src="{cdn}"></script>
  26781. <script>
  26782. {namespace}.setRequestTimeout(timeout);
  26783. // 弃用的写法
  26784. SuperMap.setRequestTimeout(timeout);
  26785. </script>
  26786. // ES6 Import
  26787. import { setRequestTimeout } from '{npm}';
  26788. setRequestTimeout(timeout);
  26789. * ```
  26790. */
  26791. var setRequestTimeout = function (timeout) {
  26792. return RequestTimeout = timeout;
  26793. }
  26794. /**
  26795. * @function getRequestTimeout
  26796. * @category BaseTypes Util
  26797. * @description 获取请求超时时间。
  26798. * @returns {number} 请求超时时间。
  26799. * @usage
  26800. * ```
  26801. * // 浏览器
  26802. <script type="text/javascript" src="{cdn}"></script>
  26803. <script>
  26804. {namespace}.getRequestTimeout();
  26805. // 弃用的写法
  26806. SuperMap.getRequestTimeout();
  26807. </script>
  26808. // ES6 Import
  26809. import { getRequestTimeout } from '{npm}';
  26810. getRequestTimeout();
  26811. * ```
  26812. */
  26813. var getRequestTimeout = function () {
  26814. return RequestTimeout || 45000;
  26815. }
  26816. /**
  26817. * @name FetchRequest
  26818. * @namespace
  26819. * @category BaseTypes Util
  26820. * @description 获取请求。
  26821. * @usage
  26822. * ```
  26823. * // 浏览器
  26824. * <script type="text/javascript" src="{cdn}"></script>
  26825. * <script>
  26826. * const result = {namespace}.FetchRequest.commit(method, url, params, options);
  26827. *
  26828. * </script>
  26829. *
  26830. * // ES6 Import
  26831. * import { FetchRequest } from '{npm}';
  26832. *
  26833. * const result = FetchRequest.commit(method, url, params, options);
  26834. *
  26835. * ```
  26836. */
  26837. var FetchRequest = {
  26838. /**
  26839. * @function FetchRequest.commit
  26840. * @description commit 请求。
  26841. * @param {string} method - 请求方法。
  26842. * @param {string} url - 请求地址。
  26843. * @param {string} params - 请求参数。
  26844. * @param {Object} options - 请求的配置属性。
  26845. * @returns {Promise} Promise 对象。
  26846. */
  26847. commit: function (method, url, params, options) {
  26848. method = method ? method.toUpperCase() : method;
  26849. switch (method) {
  26850. case 'GET':
  26851. return this.get(url, params, options);
  26852. case 'POST':
  26853. return this.post(url, params, options);
  26854. case 'PUT':
  26855. return this.put(url, params, options);
  26856. case 'DELETE':
  26857. return this.delete(url, params, options);
  26858. default:
  26859. return this.get(url, params, options);
  26860. }
  26861. },
  26862. /**
  26863. * @function FetchRequest.supportDirectRequest
  26864. * @description supportDirectRequest 请求。
  26865. * @param {string} url - 请求地址。
  26866. * @param {Object} options - 请求的配置属性。
  26867. * @returns {boolean} 是否允许跨域请求。
  26868. */
  26869. supportDirectRequest: function (url, options) {
  26870. if (Util_Util.isInTheSameDomain(url)) {
  26871. return true;
  26872. }
  26873. if (options.crossOrigin != undefined) {
  26874. return options.crossOrigin;
  26875. } else {
  26876. return isCORS() || options.proxy;
  26877. }
  26878. },
  26879. /**
  26880. * @function FetchRequest.get
  26881. * @description get 请求。
  26882. * @param {string} url - 请求地址。
  26883. * @param {string} params - 请求参数。
  26884. * @param {Object} options - 请求的配置属性。
  26885. * @returns {Promise} Promise 对象。
  26886. */
  26887. get: function (url, params, options) {
  26888. options = options || {};
  26889. var type = 'GET';
  26890. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  26891. url = this._processUrl(url, options);
  26892. if (!this.supportDirectRequest(url, options)) {
  26893. url = url.replace('.json', '.jsonp');
  26894. var config = {
  26895. url: url,
  26896. data: params
  26897. };
  26898. return RequestJSONPPromise.GET(config);
  26899. }
  26900. if (!this.urlIsLong(url)) {
  26901. return this._fetch(url, params, options, type);
  26902. } else {
  26903. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  26904. }
  26905. },
  26906. /**
  26907. * @function FetchRequest.delete
  26908. * @description delete 请求。
  26909. * @param {string} url - 请求地址。
  26910. * @param {string} params - 请求参数。
  26911. * @param {Object} options -请求的配置属性。
  26912. * @returns {Promise} Promise 对象。
  26913. */
  26914. delete: function (url, params, options) {
  26915. options = options || {};
  26916. var type = 'DELETE';
  26917. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  26918. url = this._processUrl(url, options);
  26919. if (!this.supportDirectRequest(url, options)) {
  26920. url = url.replace('.json', '.jsonp');
  26921. var config = {
  26922. url: url += "&_method=DELETE",
  26923. data: params
  26924. };
  26925. return RequestJSONPPromise.DELETE(config);
  26926. }
  26927. if (this.urlIsLong(url)) {
  26928. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  26929. }
  26930. return this._fetch(url, params, options, type);
  26931. },
  26932. /**
  26933. * @function FetchRequest.post
  26934. * @description post 请求。
  26935. * @param {string} url - 请求地址。
  26936. * @param {string} params - 请求参数。
  26937. * @param {Object} options - 请求的配置属性。
  26938. * @returns {Promise} Promise 对象。
  26939. */
  26940. post: function (url, params, options) {
  26941. options = options || {};
  26942. url = this._processUrl(url, options);
  26943. if (!this.supportDirectRequest(url, options)) {
  26944. url = url.replace('.json', '.jsonp');
  26945. var config = {
  26946. url: Util_Util.urlAppend(url, "_method=POST"),
  26947. data: params
  26948. };
  26949. return RequestJSONPPromise.POST(config);
  26950. }
  26951. return this._fetch(url, params, options, 'POST');
  26952. },
  26953. /**
  26954. * @function FetchRequest.put
  26955. * @description put 请求。
  26956. * @param {string} url - 请求地址。
  26957. * @param {string} params - 请求参数。
  26958. * @param {Object} options - 请求的配置属性。
  26959. * @returns {Promise} Promise 对象。
  26960. */
  26961. put: function (url, params, options) {
  26962. options = options || {};
  26963. url = this._processUrl(url, options);
  26964. if (!this.supportDirectRequest(url, options)) {
  26965. url = url.replace('.json', '.jsonp');
  26966. var config = {
  26967. url: url += "&_method=PUT",
  26968. data: params
  26969. };
  26970. return RequestJSONPPromise.PUT(config);
  26971. }
  26972. return this._fetch(url, params, options, 'PUT');
  26973. },
  26974. /**
  26975. * @function FetchRequest.urlIsLong
  26976. * @description URL 的字节长度是否太长。
  26977. * @param {string} url - 请求地址。
  26978. * @returns {boolean} URL 的字节长度是否太长。
  26979. */
  26980. urlIsLong: function (url) {
  26981. //当前url的字节长度。
  26982. var totalLength = 0,
  26983. charCode = null;
  26984. for (var i = 0, len = url.length; i < len; i++) {
  26985. //转化为Unicode编码
  26986. charCode = url.charCodeAt(i);
  26987. if (charCode < 0x007f) {
  26988. totalLength++;
  26989. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  26990. totalLength += 2;
  26991. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  26992. totalLength += 3;
  26993. }
  26994. }
  26995. return totalLength < 2000 ? false : true;
  26996. },
  26997. _postSimulatie: function (type, url, params, options) {
  26998. var separator = url.indexOf('?') > -1 ? '&' : '?';
  26999. url += separator + '_method=' + type;
  27000. if (typeof params !== 'string') {
  27001. params = JSON.stringify(params);
  27002. }
  27003. return this.post(url, params, options);
  27004. },
  27005. _processUrl: function (url, options) {
  27006. if (this._isMVTRequest(url)) {
  27007. return url;
  27008. }
  27009. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  27010. if (url.indexOf('?') < 0) {
  27011. url += '.json';
  27012. } else {
  27013. var urlArrays = url.split('?');
  27014. if (urlArrays.length === 2) {
  27015. url = urlArrays[0] + '.json?' + urlArrays[1];
  27016. }
  27017. }
  27018. }
  27019. if (options && options.proxy) {
  27020. if (typeof options.proxy === 'function') {
  27021. url = options.proxy(url);
  27022. } else {
  27023. url = decodeURIComponent(url);
  27024. url = options.proxy + encodeURIComponent(url);
  27025. }
  27026. }
  27027. return url;
  27028. },
  27029. _fetch: function (url, params, options, type) {
  27030. options = options || {};
  27031. options.headers = options.headers || {};
  27032. if (!options.headers['Content-Type'] && !FormData.prototype.isPrototypeOf(params)) {
  27033. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  27034. }
  27035. if (options.timeout) {
  27036. return this._timeout(
  27037. options.timeout,
  27038. FetchRequest_fetch(url, {
  27039. method: type,
  27040. headers: options.headers,
  27041. body: type === 'PUT' || type === 'POST' ? params : undefined,
  27042. credentials: this._getWithCredentials(options),
  27043. mode: 'cors',
  27044. timeout: getRequestTimeout()
  27045. }).then(function (response) {
  27046. return response;
  27047. })
  27048. );
  27049. }
  27050. return FetchRequest_fetch(url, {
  27051. method: type,
  27052. body: type === 'PUT' || type === 'POST' ? params : undefined,
  27053. headers: options.headers,
  27054. credentials: this._getWithCredentials(options),
  27055. mode: 'cors',
  27056. timeout: getRequestTimeout()
  27057. }).then(function (response) {
  27058. return response;
  27059. });
  27060. },
  27061. _getWithCredentials: function (options) {
  27062. if (options.withCredentials === true) {
  27063. return 'include';
  27064. }
  27065. if (options.withCredentials === false) {
  27066. return 'omit';
  27067. }
  27068. return 'same-origin';
  27069. },
  27070. _fetchJsonp: function (url, options) {
  27071. options = options || {};
  27072. return fetch_jsonp_default()(url, {
  27073. method: 'GET',
  27074. timeout: options.timeout
  27075. }).then(function (response) {
  27076. return response;
  27077. });
  27078. },
  27079. _timeout: function (seconds, promise) {
  27080. return new Promise(function (resolve, reject) {
  27081. setTimeout(function () {
  27082. reject(new Error('timeout'));
  27083. }, seconds);
  27084. promise.then(resolve, reject);
  27085. });
  27086. },
  27087. _getParameterString: function (params) {
  27088. var paramsArray = [];
  27089. for (var key in params) {
  27090. var value = params[key];
  27091. if (value != null && typeof value !== 'function') {
  27092. var encodedValue;
  27093. if (Array.isArray(value) || value.toString() === '[object Object]') {
  27094. encodedValue = encodeURIComponent(JSON.stringify(value));
  27095. } else {
  27096. encodedValue = encodeURIComponent(value);
  27097. }
  27098. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  27099. }
  27100. }
  27101. return paramsArray.join('&');
  27102. },
  27103. _isMVTRequest: function (url) {
  27104. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  27105. }
  27106. }
  27107. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  27108. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27109. * This program are made available under the terms of the Apache License, Version 2.0
  27110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27111. /**
  27112. * @class SecurityManager
  27113. * @deprecatedclass SuperMap.SecurityManager
  27114. * @category Security
  27115. * @classdesc 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  27116. * > 使用说明:
  27117. * > 创建任何一个服务之前调用 {@link SecurityManager.registerToken}或
  27118. * > {@link SecurityManager.registerKey}注册凭据。
  27119. * > 发送请求时根据 URL 或者服务 ID 获取相应的 key 或者 token 并自动添加到服务地址中。
  27120. * @usage
  27121. */
  27122. class SecurityManager {
  27123. /**
  27124. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  27125. * @function SecurityManager.generateToken
  27126. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  27127. * @param {TokenServiceParameter} tokenParam - token 申请参数。
  27128. * @returns {Promise} 包含 token 信息的 Promise 对象。
  27129. */
  27130. static generateToken(url, tokenParam) {
  27131. var serverInfo = this.servers[url];
  27132. if (!serverInfo) {
  27133. return;
  27134. }
  27135. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function(
  27136. response
  27137. ) {
  27138. return response.text();
  27139. });
  27140. }
  27141. /**
  27142. * @description 注册安全服务器相关信息。
  27143. * @function SecurityManager.registerServers
  27144. * @param {ServerInfo} serverInfos - 服务器信息。
  27145. */
  27146. static registerServers(serverInfos) {
  27147. this.servers = this.servers || {};
  27148. if (!Util_Util.isArray(serverInfos)) {
  27149. serverInfos = [serverInfos];
  27150. }
  27151. for (var i = 0; i < serverInfos.length; i++) {
  27152. var serverInfo = serverInfos[i];
  27153. this.servers[serverInfo.server] = serverInfo;
  27154. }
  27155. }
  27156. /**
  27157. * @description 服务请求都会自动带上这个 token。
  27158. * @function SecurityManager.registerToken
  27159. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  27160. * @param {string} token - token。
  27161. */
  27162. static registerToken(url, token) {
  27163. this.tokens = this.tokens || {};
  27164. if (!url || !token) {
  27165. return;
  27166. }
  27167. var domain = this._getTokenStorageKey(url);
  27168. this.tokens[domain] = token;
  27169. }
  27170. /**
  27171. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  27172. * @function SecurityManager.registerKey
  27173. * @param {Array} ids - 可以是服务 ID 数组或者 URL 地址数组或者 webAPI 类型数组。
  27174. * @param {string} key - key。
  27175. */
  27176. static registerKey(ids, key) {
  27177. this.keys = this.keys || {};
  27178. if (!ids || ids.length < 1 || !key) {
  27179. return;
  27180. }
  27181. ids = Util_Util.isArray(ids) ? ids : [ids];
  27182. for (var i = 0; i < ids.length; i++) {
  27183. var id = this._getUrlRestString(ids[0]) || ids[0];
  27184. this.keys[id] = key;
  27185. }
  27186. }
  27187. /**
  27188. * @description 获取服务器信息。
  27189. * @function SecurityManager.getServerInfo
  27190. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  27191. * @returns {ServerInfo} 服务器信息。
  27192. */
  27193. static getServerInfo(url) {
  27194. this.servers = this.servers || {};
  27195. return this.servers[url];
  27196. }
  27197. /**
  27198. * @description 根据 URL 获取token。
  27199. * @function SecurityManager.getToken
  27200. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  27201. * @returns {string} token。
  27202. */
  27203. static getToken(url) {
  27204. if (!url) {
  27205. return;
  27206. }
  27207. this.tokens = this.tokens || {};
  27208. var domain = this._getTokenStorageKey(url);
  27209. return this.tokens[domain];
  27210. }
  27211. /**
  27212. * @description 根据 URL 获取 key。
  27213. * @function SecurityManager.getKey
  27214. * @param {string} id - ID。
  27215. * @returns {string} key。
  27216. */
  27217. static getKey(id) {
  27218. this.keys = this.keys || {};
  27219. var key = this._getUrlRestString(id) || id;
  27220. return this.keys[key];
  27221. }
  27222. /**
  27223. * @description iServer 登录验证。
  27224. * @function SecurityManager.loginiServer
  27225. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  27226. * @param {string} username - 用户名。
  27227. * @param {string} password - 密码。
  27228. * @param {boolean} [rememberme=false] - 是否记住。
  27229. * @returns {Promise} 包含 iServer 登录请求结果的 Promise 对象。
  27230. */
  27231. static loginiServer(url, username, password, rememberme) {
  27232. url = Util_Util.urlPathAppend(url, 'services/security/login');
  27233. var loginInfo = {
  27234. username: username && username.toString(),
  27235. password: password && password.toString(),
  27236. rememberme: rememberme
  27237. };
  27238. loginInfo = JSON.stringify(loginInfo);
  27239. var requestOptions = {
  27240. headers: {
  27241. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  27242. }
  27243. };
  27244. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  27245. return response.json();
  27246. });
  27247. }
  27248. /**
  27249. * @description iServer登出。
  27250. * @function SecurityManager.logoutiServer
  27251. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  27252. * @returns {Promise} 是否登出成功。
  27253. */
  27254. static logoutiServer(url) {
  27255. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  27256. var requestOptions = {
  27257. headers: {
  27258. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  27259. },
  27260. withoutFormatSuffix: true
  27261. };
  27262. return FetchRequest.get(url, '', requestOptions)
  27263. .then(function() {
  27264. return true;
  27265. })
  27266. .catch(function() {
  27267. return false;
  27268. });
  27269. }
  27270. /**
  27271. * @description Online 登录验证。
  27272. * @function SecurityManager.loginOnline
  27273. * @param {string} callbackLocation - 跳转位置。
  27274. * @param {boolean} [newTab=true] - 是否新窗口打开。
  27275. */
  27276. static loginOnline(callbackLocation, newTab) {
  27277. var loginUrl = SecurityManager.SSO + '/login?service=' + callbackLocation;
  27278. this._open(loginUrl, newTab);
  27279. }
  27280. /**
  27281. * @description iPortal登录验证。
  27282. * @function SecurityManager.loginiPortal
  27283. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  27284. * @param {string} username - 用户名。
  27285. * @param {string} password - 密码。
  27286. * @returns {Promise} 包含 iPortal 登录请求结果的 Promise 对象。
  27287. */
  27288. static loginiPortal(url, username, password) {
  27289. url = Util_Util.urlPathAppend(url, 'web/login');
  27290. var loginInfo = {
  27291. username: username && username.toString(),
  27292. password: password && password.toString()
  27293. };
  27294. loginInfo = JSON.stringify(loginInfo);
  27295. var requestOptions = {
  27296. headers: {
  27297. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  27298. },
  27299. withCredentials: true
  27300. };
  27301. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  27302. return response.json();
  27303. });
  27304. }
  27305. /**
  27306. * @description iPortal 登出。
  27307. * @function SecurityManager.logoutiPortal
  27308. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  27309. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  27310. */
  27311. static logoutiPortal(url) {
  27312. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  27313. var requestOptions = {
  27314. headers: {
  27315. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  27316. },
  27317. withCredentials: true,
  27318. withoutFormatSuffix: true
  27319. };
  27320. return FetchRequest.get(url, '', requestOptions)
  27321. .then(function() {
  27322. return true;
  27323. })
  27324. .catch(function() {
  27325. return false;
  27326. });
  27327. }
  27328. /**
  27329. * @description iManager 登录验证。
  27330. * @function SecurityManager.loginManager
  27331. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  27332. * @param {Object} [loginInfoParams] - iManager 登录参数。
  27333. * @param {string} loginInfoParams.userName - 用户名。
  27334. * @param {string} loginInfoParams.password - 密码。
  27335. * @param {Object} options
  27336. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  27337. * @returns {Promise} 包含 iManager 登录请求结果的 Promise 对象。
  27338. */
  27339. static loginManager(url, loginInfoParams, options) {
  27340. if (!Util_Util.isInTheSameDomain(url)) {
  27341. var isNewTab = options ? options.isNewTab : true;
  27342. this._open(url, isNewTab);
  27343. return;
  27344. }
  27345. var requestUrl = Util_Util.urlPathAppend(url, 'icloud/security/tokens');
  27346. var params = loginInfoParams || {};
  27347. var loginInfo = {
  27348. username: params.userName && params.userName.toString(),
  27349. password: params.password && params.password.toString()
  27350. };
  27351. loginInfo = JSON.stringify(loginInfo);
  27352. var requestOptions = {
  27353. headers: {
  27354. Accept: '*/*',
  27355. 'Content-Type': 'application/json'
  27356. }
  27357. };
  27358. var me = this;
  27359. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function(response) {
  27360. response.text().then(function(result) {
  27361. me.imanagerToken = result;
  27362. return result;
  27363. });
  27364. });
  27365. }
  27366. /**
  27367. * @description 清空全部验证信息。
  27368. * @function SecurityManager.destroyAllCredentials
  27369. */
  27370. static destroyAllCredentials() {
  27371. this.keys = null;
  27372. this.tokens = null;
  27373. this.servers = null;
  27374. }
  27375. /**
  27376. * @description 清空令牌信息。
  27377. * @function SecurityManager.destroyToken
  27378. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  27379. */
  27380. static destroyToken(url) {
  27381. if (!url) {
  27382. return;
  27383. }
  27384. var domain = this._getTokenStorageKey(url);
  27385. this.tokens = this.tokens || {};
  27386. if (this.tokens[domain]) {
  27387. delete this.tokens[domain];
  27388. }
  27389. }
  27390. /**
  27391. * @description 清空服务授权码。
  27392. * @function SecurityManager.destroyKey
  27393. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  27394. */
  27395. static destroyKey(url) {
  27396. if (!url) {
  27397. return;
  27398. }
  27399. this.keys = this.keys || {};
  27400. var key = this._getUrlRestString(url) || url;
  27401. if (this.keys[key]) {
  27402. delete this.keys[key];
  27403. }
  27404. }
  27405. /**
  27406. * @description 服务URL追加授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
  27407. * @version 10.1.2
  27408. * @function SecurityManager.appendCredential
  27409. * @param {string} url - 服务URL。
  27410. * @returns {string} 绑定了token或者key的服务URL。
  27411. */
  27412. static appendCredential(url) {
  27413. var newUrl = url;
  27414. var value = this.getToken(url);
  27415. var credential = value ? new Credential(value, 'token') : null;
  27416. if (!credential) {
  27417. value = this.getKey(url);
  27418. credential = value ? new Credential(value, 'key') : null;
  27419. }
  27420. if (credential) {
  27421. newUrl = Util_Util.urlAppend(newUrl, credential.getUrlParameters());
  27422. }
  27423. return newUrl;
  27424. }
  27425. static _open(url, newTab) {
  27426. newTab = newTab != null ? newTab : true;
  27427. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  27428. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  27429. var options =
  27430. 'height=' +
  27431. this.INNER_WINDOW_HEIGHT +
  27432. ', width=' +
  27433. this.INNER_WINDOW_WIDTH +
  27434. ',top=' +
  27435. offsetY +
  27436. ', left=' +
  27437. offsetX +
  27438. ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
  27439. if (newTab) {
  27440. window.open(url, 'login');
  27441. } else {
  27442. window.open(url, 'login', options);
  27443. }
  27444. }
  27445. static _getTokenStorageKey(url) {
  27446. var patten = /(.*?):\/\/([^\/]+)/i;
  27447. var result = url.match(patten);
  27448. if (!result) {
  27449. return url;
  27450. }
  27451. return result[0];
  27452. }
  27453. static _getUrlRestString(url) {
  27454. if (!url) {
  27455. return url;
  27456. }
  27457. // var patten = /http:\/\/(.*\/rest)/i;
  27458. var patten = /(http|https):\/\/(.*\/rest)/i;
  27459. var result = url.match(patten);
  27460. if (!result) {
  27461. return url;
  27462. }
  27463. return result[0];
  27464. }
  27465. }
  27466. SecurityManager.INNER_WINDOW_WIDTH = 600;
  27467. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  27468. SecurityManager.SSO = 'https://sso.supermap.com';
  27469. SecurityManager.ONLINE = 'https://www.supermapol.com';
  27470. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  27471. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27472. * This program are made available under the terms of the Apache License, Version 2.0
  27473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27474. /**
  27475. * @class IManagerServiceBase
  27476. * @aliasclass iManagerServiceBase
  27477. * @deprecatedclass SuperMap.iManagerServiceBase
  27478. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  27479. * @category iManager
  27480. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  27481. * @param {Object} options - 可选参数。
  27482. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27483. * @param {Object} [options.headers] - 请求头。
  27484. * @usage
  27485. */
  27486. class IManagerServiceBase {
  27487. constructor(url,options) {
  27488. if (url) {
  27489. var end = url.substr(url.length - 1, 1);
  27490. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  27491. }
  27492. this.options = options || {};
  27493. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  27494. }
  27495. /**
  27496. * @function IManagerServiceBase.prototype.request
  27497. * @description 子类统一通过该方法发送请求。
  27498. * @param {string} url - 请求 URL。
  27499. * @param {string} [method='GET'] - 请求类型。
  27500. * @param {Object} [requestOptions] - 请求选项。
  27501. * @param {Object} param - 请求参数。
  27502. * @description 发送请求。
  27503. * @returns {Promise} Promise 对象。
  27504. */
  27505. request(method, url, param, requestOptions) {
  27506. requestOptions = requestOptions || {
  27507. headers: {
  27508. 'Accept': '*/*',
  27509. 'Content-Type': 'application/json'
  27510. }
  27511. };
  27512. if (!requestOptions.hasOwnProperty("withCredentials")) {
  27513. requestOptions['withCredentials'] = true;
  27514. }
  27515. requestOptions['crossOrigin'] = this.options.crossOrigin;
  27516. requestOptions['headers'] = this.options.headers;
  27517. var token = SecurityManager.imanagerToken;
  27518. if (token) {
  27519. if (!requestOptions.headers) {
  27520. requestOptions.headers = [];
  27521. }
  27522. requestOptions.headers['X-Auth-Token'] = token;
  27523. }
  27524. if (param) {
  27525. param = JSON.stringify(param);
  27526. }
  27527. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  27528. return response.json();
  27529. });
  27530. }
  27531. }
  27532. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  27533. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27534. * This program are made available under the terms of the Apache License, Version 2.0
  27535. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27536. /**
  27537. * @class IManagerCreateNodeParam
  27538. * @aliasclass iManagerCreateNodeParam
  27539. * @deprecatedclass SuperMap.iManagerCreateNodeParam
  27540. * @classdesc iManager 创建节点参数。
  27541. * @category iManager
  27542. * @param {Object} [params] - 节点参数。
  27543. * @usage
  27544. */
  27545. class IManagerCreateNodeParam {
  27546. constructor(params) {
  27547. params = params || {};
  27548. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  27549. this.nodeCount = 1; //要创建vm的个数
  27550. this.nodeName = ''; //vm名称
  27551. this.password = ''; //vm的密码,空表示随机分配
  27552. this.description = ''; //描述信息
  27553. this.physicalMachineName = ''; //vm所属的物理机名称.
  27554. this.ips = []; //vm的ip,空数组表示随机分配
  27555. this.userName = ''; //vm所属用户
  27556. Util_Util.extend(this, params);
  27557. }
  27558. }
  27559. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  27560. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27561. * This program are made available under the terms of the Apache License, Version 2.0
  27562. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27563. /**
  27564. * @class IManager
  27565. * @aliasclass iManager
  27566. * @deprecatedclass SuperMap.iManager
  27567. * @classdesc iManager 服务类。
  27568. * @category iManager
  27569. * @modulecategory Services
  27570. * @param {string} serviceUrl - iManager 首页地址。
  27571. * @usage
  27572. */
  27573. class IManager extends IManagerServiceBase {
  27574. constructor(iManagerUrl) {
  27575. super(iManagerUrl);
  27576. }
  27577. /**
  27578. * @function IManager.prototype.load
  27579. * @description 获取所有服务接口,验证是否已登录授权。
  27580. * @returns {Promise} Promise 对象。
  27581. */
  27582. load() {
  27583. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  27584. }
  27585. /**
  27586. * @function IManager.prototype.createIServer
  27587. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  27588. * @description 创建 iServer。
  27589. * @returns {Promise} Promise 对象。
  27590. */
  27591. createIServer(createParam) {
  27592. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  27593. }
  27594. /**
  27595. * @function IManager.prototype.createIPortal
  27596. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  27597. * @description 创建 iPortal。
  27598. * @returns {Promise} Promise 对象。
  27599. */
  27600. createIPortal(createParam) {
  27601. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  27602. }
  27603. /**
  27604. * @function IManager.prototype.iServerList
  27605. * @description 获取所有创建的 iServer。
  27606. * @returns {Promise} Promise 对象。
  27607. */
  27608. iServerList() {
  27609. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  27610. }
  27611. /**
  27612. * @function IManager.prototype.iPortalList
  27613. * @description 获取所有创建的 iPortal。
  27614. * @returns {Promise} Promise 对象。
  27615. */
  27616. iPortalList() {
  27617. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  27618. }
  27619. /**
  27620. * @function IManager.prototype.startNodes
  27621. * @param {Array.<string>} ids - 需要启动节点的 ID 数组。e.g:['1']。
  27622. * @description 启动节点。
  27623. * @returns {Promise} Promise 对象。
  27624. */
  27625. startNodes(ids) {
  27626. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  27627. }
  27628. /**
  27629. * @function IManager.prototype.stopNodes
  27630. * @param {Array.<string>} ids - 需要停止节点的 ID 数组。e.g:['1']。
  27631. * @description 停止节点。
  27632. * @returns {Promise} Promise 对象。
  27633. */
  27634. stopNodes(ids) {
  27635. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  27636. }
  27637. }
  27638. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  27639. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27640. * This program are made available under the terms of the Apache License, Version 2.0
  27641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27642. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  27643. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27644. * This program are made available under the terms of the Apache License, Version 2.0
  27645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27646. /**
  27647. * @class IPortalServiceBase
  27648. * @aliasclass iPortalServiceBase
  27649. * @deprecatedclass SuperMap.iPortalServiceBase
  27650. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  27651. * @category iPortal/Online Core
  27652. * @param {string} url - 服务地址。
  27653. * @param {Object} options - 可选参数。
  27654. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  27655. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27656. * @param {Object} [options.headers] - 请求头。
  27657. * @usage
  27658. */
  27659. class IPortalServiceBase {
  27660. constructor(url, options) {
  27661. options = options || {};
  27662. this.serviceUrl = url;
  27663. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  27664. this.withCredentials = options.withCredentials || false;
  27665. this.crossOrigin = options.crossOrigin
  27666. this.headers = options.headers
  27667. }
  27668. /**
  27669. * @function IPortalServiceBase.prototype.request
  27670. * @description 子类统一通过该方法发送请求。
  27671. * @param {string} [method='GET'] - 请求类型。
  27672. * @param {string} url - 服务地址。
  27673. * @param {Object} param - 请求参数。
  27674. * @param {Object} [requestOptions] - fetch 请求配置项。
  27675. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  27676. */
  27677. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  27678. url = SecurityManager.appendCredential(url);
  27679. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  27680. return response.json();
  27681. });
  27682. }
  27683. }
  27684. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  27685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27686. * This program are made available under the terms of the Apache License, Version 2.0
  27687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27688. /**
  27689. * @class IPortalQueryParam
  27690. * @aliasclass iPortalQueryParam
  27691. * @deprecatedclass SuperMap.iPortalQueryParam
  27692. * @classdesc iPortal 资源查询参数。
  27693. * @version 10.0.1
  27694. * @category iPortal/Online Resources ResourcesQuery
  27695. * @param {Object} params - 可选参数。
  27696. * @param {ResourceType} [params.resourceType] - 资源类型。
  27697. * @param {number} [params.pageSize] - 分页中每页大小。
  27698. * @param {number} [params.currentPage] - 分页页码。
  27699. * @param {OrderBy} [params.orderBy] - 排序字段。
  27700. * @param {OrderType} [params.orderType] - 根据升序还是降序过滤。
  27701. * @param {SearchType} [params.searchType] - 根据查询的范围进行过滤。
  27702. * @param {Array} [params.tags] - 标签。
  27703. * @param {Array} [params.dirIds] - 目录 ID。
  27704. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  27705. * @param {AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  27706. * @param {string} [params.text] - 搜索的关键词。
  27707. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  27708. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  27709. * @usage
  27710. */
  27711. class IPortalQueryParam {
  27712. constructor(params) {
  27713. params = params || {};
  27714. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  27715. this.pageSize = 12; // 每页多少条
  27716. this.currentPage = 1; // 第几页
  27717. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  27718. this.orderType = "DESC"; // DESC ASC
  27719. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  27720. this.tags = []; // 标签
  27721. this.dirIds = []; // 类别
  27722. this.resourceSubTypes = []; // 类型
  27723. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  27724. this.text = ""; // 搜索字段
  27725. this.groupIds = []; // 群组Id过滤
  27726. this.departmentIds = []; // 部门Id过滤
  27727. Util_Util.extend(this, params);
  27728. }
  27729. }
  27730. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  27731. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27732. * This program are made available under the terms of the Apache License, Version 2.0
  27733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27734. /**
  27735. * @class IPortalQueryResult
  27736. * @aliasclass iPortalQueryResult
  27737. * @deprecatedclass SuperMap.iPortalQueryResult
  27738. * @classdesc iPortal 资源结果集封装类。
  27739. * @version 10.0.1
  27740. * @category iPortal/Online Resources ResourcesQuery
  27741. * @param {Object} queryResult - 可选参数。
  27742. * @param {Array} [queryResult.content] - 页面内容。
  27743. * @param {number} [queryResult.total] - 总记录数。
  27744. * @param {number} [queryResult.currentPage] - 当前第几页。
  27745. * @param {number} [queryResult.pageSize] - 每页大小。
  27746. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  27747. * @usage
  27748. */
  27749. class IPortalQueryResult {
  27750. constructor(queryResult) {
  27751. queryResult = queryResult || {};
  27752. this.content = [];
  27753. this.total = 0;
  27754. this.currentPage = 1;
  27755. this.pageSize = 12;
  27756. this.aggregations = null;
  27757. Util_Util.extend(this, queryResult);
  27758. }
  27759. }
  27760. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  27761. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27762. * This program are made available under the terms of the Apache License, Version 2.0
  27763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27764. /**
  27765. * @class IPortalResource
  27766. * @aliasclass iPortalResource
  27767. * @deprecatedclass SuperMap.iPortalResource
  27768. * @classdesc iPortal 资源详情类。
  27769. * @version 10.0.1
  27770. * @category iPortal/Online Resources
  27771. * @param {string} portalUrl - 服务地址。
  27772. * @param {Object} resourceInfo - 可选参数。
  27773. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息。
  27774. * @param {string} [resourceInfo.bounds] - 资源的坐标范围。
  27775. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  27776. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED。
  27777. * @param {Date} [resourceInfo.createTime] - 资源的创建时间。
  27778. * @param {string} [resourceInfo.description] - 资源描述。
  27779. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的ID。
  27780. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  27781. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  27782. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档ID。
  27783. * @param {string} [resourceInfo.name] - 资源名称。
  27784. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的ID。
  27785. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的ID。
  27786. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  27787. * @param {ResourceType} [resourceInfo.resourceType] - 资源类型。
  27788. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID。
  27789. * @param {Array} [resourceInfo.tags] - 资源的标签。
  27790. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图。
  27791. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间。
  27792. * @param {string} [resourceInfo.userName] - 搜索的关键词。
  27793. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  27794. * @extends {IPortalServiceBase}
  27795. * @usage
  27796. */
  27797. class IPortalResource extends IPortalServiceBase {
  27798. constructor(portalUrl, resourceInfo) {
  27799. super(portalUrl);
  27800. resourceInfo = resourceInfo || {};
  27801. this.authorizeSetting = [];
  27802. this.bounds = "";
  27803. this.bounds4326 = "";
  27804. this.checkStatus = "";
  27805. this.createTime = 0;
  27806. this.description = null;
  27807. this.dirId = null;
  27808. this.epsgCode = 0;
  27809. this.heatLevel = 0;
  27810. this.id = 0;
  27811. this.name = "";
  27812. this.personalDirId = null;
  27813. this.resourceId = 0;
  27814. this.resourceSubType = null;
  27815. this.resourceType = null;
  27816. this.serviceRootUrlId = null;
  27817. this.tags = null;
  27818. this.thumbnail = null;
  27819. this.updateTime = 0;
  27820. this.userName = "";
  27821. this.sourceJSON = {};//返回门户资源详细信息
  27822. Util_Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  27823. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  27824. if (this.withCredentials) {
  27825. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  27826. }
  27827. // if (this.id) {
  27828. // this.mapUrl = mapUrl + "/" + this.id;
  27829. // }
  27830. }
  27831. /**
  27832. * @function IPortalResource.prototype.load
  27833. * @description 加载资源信息。
  27834. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  27835. */
  27836. load() {
  27837. var me = this;
  27838. return me.request("GET", me.resourceUrl + ".json")
  27839. .then(function (resourceInfo) {
  27840. if (resourceInfo.error) {
  27841. return resourceInfo;
  27842. }
  27843. me.sourceJSON = resourceInfo;
  27844. });
  27845. }
  27846. /**
  27847. * @function IPortalResource.prototype.update
  27848. * @description 更新资源属性信息。
  27849. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  27850. */
  27851. update() {
  27852. var resourceName = this.resourceType.replace("_","").toLowerCase();
  27853. var options = {
  27854. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  27855. };
  27856. if( resourceName === 'data') {
  27857. this.resourceUrl = this.resourceUrl + "/attributes.json";
  27858. }
  27859. var entity = JSON.stringify(this.sourceJSON);
  27860. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  27861. if( resourceName === 'service') {
  27862. var serviceInfo = {
  27863. authorizeSetting:this.sourceJSON.authorizeSetting,
  27864. metadata:this.sourceJSON.metadata,
  27865. tags:this.sourceJSON.tags,
  27866. thumbnail:this.sourceJSON.thumbnail,
  27867. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  27868. };
  27869. entity = JSON.stringify(serviceInfo);
  27870. }
  27871. return this.request("PUT", this.resourceUrl, entity, options);
  27872. }
  27873. }
  27874. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  27875. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27876. * This program are made available under the terms of the Apache License, Version 2.0
  27877. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27878. /**
  27879. * @class IPortalShareParam
  27880. * @aliasclass iPortalShareParam
  27881. * @deprecatedclass SuperMap.iPortalShareParam
  27882. * @classdesc iPortal 资源共享参数。
  27883. * @version 10.0.1
  27884. * @category iPortal/Online Resources ResourcesShare
  27885. * @param {Object} params - 可选参数。
  27886. * @param {ResourceType} [params.resourceType] - 资源类型。
  27887. * @param {Array} [params.ids] - 资源的ID数组。
  27888. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  27889. * @usage
  27890. */
  27891. class IPortalShareParam {
  27892. constructor(params) {
  27893. params = params || {};
  27894. this.ids = [];
  27895. this.entities = [];
  27896. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  27897. Util_Util.extend(this, params);
  27898. }
  27899. }
  27900. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  27901. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27902. * This program are made available under the terms of the Apache License, Version 2.0
  27903. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27904. /**
  27905. * @class IPortal
  27906. * @aliasclass iPortal
  27907. * @deprecatedclass SuperMap.iPortal
  27908. * @classdesc 对接 SuperMap iPortal 基础服务。
  27909. * @category iPortal/Online Resources
  27910. * @modulecategory Services
  27911. * @extends {IPortalServiceBase}
  27912. * @param {string} iportalUrl - 服务地址。
  27913. * @param {Object} options - 可选参数。
  27914. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  27915. * @usage
  27916. */
  27917. class IPortal extends IPortalServiceBase {
  27918. constructor(iportalUrl, options) {
  27919. super(iportalUrl, options);
  27920. this.iportalUrl = iportalUrl;
  27921. options = options || {};
  27922. this.withCredentials = options.withCredentials || false;
  27923. }
  27924. /**
  27925. * @function IPortal.prototype.load
  27926. * @description 加载页面。
  27927. * @returns {Promise} 包含 iportal web 资源信息的 Promise 对象。
  27928. */
  27929. load() {
  27930. return FetchRequest.get(this.iportalUrl + "/web");
  27931. }
  27932. /**
  27933. * @function IPortal.prototype.queryResources
  27934. * @description 查询资源。
  27935. * @version 10.0.1
  27936. * @param {IPortalQueryParam} queryParams - 查询参数。
  27937. * @returns {Promise} 包含所有资源结果的 Promise 对象。
  27938. */
  27939. queryResources(queryParams) {
  27940. if (!(queryParams instanceof IPortalQueryParam)) {
  27941. return new Promise( function(resolve){
  27942. resolve(
  27943. "queryParams is not instanceof iPortalQueryParam !"
  27944. );
  27945. });
  27946. }
  27947. var me = this;
  27948. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  27949. queryParams.t = new Date().getTime();
  27950. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  27951. var content = [];
  27952. (result.content || []).forEach(function(item) {
  27953. content.push(new IPortalResource(me.iportalUrl, item));
  27954. });
  27955. let queryResult = new IPortalQueryResult();
  27956. queryResult.content = content;
  27957. queryResult.total = result.total;
  27958. queryResult.currentPage = result.currentPage;
  27959. queryResult.pageSize = result.pageSize;
  27960. queryResult.aggregations = result.aggregations;
  27961. return queryResult;
  27962. });
  27963. }
  27964. /**
  27965. * @function IPortal.prototype.updateResourcesShareSetting
  27966. * @description 更新共享设置。
  27967. * @version 10.0.1
  27968. * @param {IPortalShareParam} shareParams - 共享的参数。
  27969. * @returns {Promise} 包含共享资源结果的 Promise 对象。
  27970. */
  27971. updateResourcesShareSetting(shareParams) {
  27972. if (!(shareParams instanceof IPortalShareParam)) {
  27973. return new Promise( function(resolve){
  27974. resolve(
  27975. "shareParams is not instanceof iPortalShareParam !"
  27976. );
  27977. });
  27978. }
  27979. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  27980. if(resourceUrlName === "datas"){
  27981. resourceUrlName = "mycontent/"+resourceUrlName;
  27982. }
  27983. var cloneShareParams = {
  27984. ids: shareParams.ids,
  27985. entities: shareParams.entities
  27986. }
  27987. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  27988. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  27989. return result;
  27990. });
  27991. }
  27992. }
  27993. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  27994. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27995. * This program are made available under the terms of the Apache License, Version 2.0
  27996. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27997. /**
  27998. * @class IPortalShareEntity
  27999. * @aliasclass iPortalShareEntity
  28000. * @deprecatedclass SuperMap.iPortalShareEntity
  28001. * @classdesc iPortal 资源共享实体参数。
  28002. * @version 10.0.1
  28003. * @category iPortal/Online Resources ResourcesShare
  28004. * @param {Object} shareEntity - 可选参数。
  28005. * @param {PermissionType} [shareEntity.permissionType] - 权限类型。
  28006. * @param {EntityType} [shareEntity.entityType] - 实体类型。
  28007. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  28008. * @param {number} [shareEntity.entityId] - 实体的 ID。用于群组的授权。
  28009. * @usage
  28010. */
  28011. class IPortalShareEntity {
  28012. constructor(shareEntity) {
  28013. shareEntity = shareEntity || {};
  28014. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  28015. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  28016. this.entityName = "GUEST"; // GUEST or 具体用户 name
  28017. this.entityId = null;
  28018. Util_Util.extend(this, shareEntity);
  28019. }
  28020. }
  28021. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  28022. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28023. * This program are made available under the terms of the Apache License, Version 2.0
  28024. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28025. /**
  28026. * @class IPortalAddResourceParam
  28027. * @aliasclass iPortalAddResourceParam
  28028. * @deprecatedclass SuperMap.iPortalAddResourceParam
  28029. * @classdesc iPortal 添加资源参数。
  28030. * @version 10.0.1
  28031. * @category iPortal/Online Resources ResourcesShare
  28032. * @param {Object} params - 可选参数。
  28033. * @param {string} [params.rootUrl] - 服务地址。
  28034. * @param {Array} [params.tags] - 标签。
  28035. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  28036. * @usage
  28037. */
  28038. class IPortalAddResourceParam {
  28039. constructor(params) {
  28040. params = params || {};
  28041. this.rootUrl = "";
  28042. this.tags = [];
  28043. this.entities = [];
  28044. Util_Util.extend(this, params);
  28045. }
  28046. }
  28047. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  28048. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28049. * This program are made available under the terms of the Apache License, Version 2.0
  28050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28051. /**
  28052. * @class IPortalRegisterServiceParam
  28053. * @aliasclass iPortalRegisterServiceParam
  28054. * @deprecatedclass SuperMap.iPortalRegisterServiceParam
  28055. * @classdesc iPortal 注册服务参数。
  28056. * @version 10.0.1
  28057. * @category iPortal/Online Resources Data
  28058. * @param {Object} params - 可选参数。
  28059. * @param {string} [params.type] - 服务类型。
  28060. * @param {Array} [params.tags] - 服务标签。
  28061. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  28062. * @param {Object} [params.metadata] - 服务元信息。
  28063. * @param {Array} [params.addedMapNames] - 地图服务列表。
  28064. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  28065. * @usage
  28066. */
  28067. class IPortalRegisterServiceParam {
  28068. constructor(params) {
  28069. params = params || {};
  28070. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  28071. this.tags = [];
  28072. this.entities = [];
  28073. this.metadata = {};
  28074. this.addedMapNames = [];
  28075. this.addedSceneNames = [];
  28076. Util_Util.extend(this, params);
  28077. }
  28078. }
  28079. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  28080. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28081. * This program are made available under the terms of the Apache License, Version 2.0
  28082. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28083. /**
  28084. * @class IPortalAddDataParam
  28085. * @aliasclass iPortalAddDataParam
  28086. * @deprecatedclass SuperMap.iPortalAddDataParam
  28087. * @classdesc iPortal 上传/注册数据所需的参数。
  28088. * @version 10.0.1
  28089. * @category iPortal/Online Resources Data
  28090. * @param {Object} params - 参数。
  28091. * @param {string} params.fileName - 文件名称。
  28092. * @param {DataItemType} params.type - 数据类型。
  28093. * @param {Array} [params.tags] - 数据的标签。
  28094. * @param {IPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息。
  28095. * @usage
  28096. */
  28097. class IPortalAddDataParam {
  28098. constructor(params) {
  28099. params = params || {};
  28100. this.fileName = "";
  28101. this.type = "";
  28102. this.tags = [];
  28103. this.dataMetaInfo = {};
  28104. Util_Util.extend(this, params);
  28105. }
  28106. }
  28107. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  28108. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28109. * This program are made available under the terms of the Apache License, Version 2.0
  28110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28111. /**
  28112. * @class IPortalDataMetaInfoParam
  28113. * @aliasclass iPortalDataMetaInfoParam
  28114. * @deprecatedclass SuperMap.iPortalDataMetaInfoParam
  28115. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  28116. * @version 10.0.1
  28117. * @category iPortal/Online Resources Data
  28118. * @param {Object} params - 参数。
  28119. * @param {string} params.xField - X 坐标字段。
  28120. * @param {string} params.yField - Y 坐标字段。
  28121. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)。
  28122. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)。
  28123. * @param {Array.<string>} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为['a','b',,'c']。
  28124. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)。
  28125. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)。
  28126. * @param {boolean} params.url - HDFS注册目录地址。
  28127. * @param {IPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息。
  28128. * @usage
  28129. */
  28130. class IPortalDataMetaInfoParam {
  28131. constructor(params) {
  28132. params = params || {};
  28133. this.xField = "";
  28134. this.yField = "";
  28135. this.fileEncoding = "UTF-8";
  28136. this.xIndex = 1;
  28137. this.yIndex = 1;
  28138. this.fieldTypes = [];
  28139. this.separator = "";
  28140. this.firstRowIsHead = true;
  28141. this.url = "";
  28142. this.dataStoreInfo = {};
  28143. Util_Util.extend(this, params);
  28144. }
  28145. }
  28146. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  28147. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28148. * This program are made available under the terms of the Apache License, Version 2.0
  28149. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28150. /**
  28151. * @class IPortalDataStoreInfoParam
  28152. * @aliasclass iPortalDataStoreInfoParam
  28153. * @deprecatedclass SuperMap.iPortalDataStoreInfoParam
  28154. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  28155. * @version 10.0.1
  28156. * @category iPortal/Online Resources Data
  28157. * @param {Object} params - 参数。
  28158. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE。
  28159. * @param {string} params.url - HDFS数据存储目录地址。
  28160. * @param {IPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息。
  28161. * @usage
  28162. */
  28163. class IPortalDataStoreInfoParam {
  28164. constructor(params) {
  28165. params = params || {};
  28166. this.type = "";
  28167. this.url = "";
  28168. this.connectionInfo = {};
  28169. Util_Util.extend(this, params);
  28170. }
  28171. }
  28172. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  28173. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28174. * This program are made available under the terms of the Apache License, Version 2.0
  28175. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28176. /**
  28177. * @class IPortalDataConnectionInfoParam
  28178. * @aliasclass iPortalDataConnectionInfoParam
  28179. * @deprecatedclass SuperMap.iPortalDataConnectionInfoParam
  28180. * @classdesc iPortal HBASE数据源连接信息类。
  28181. * @version 10.0.1
  28182. * @category iPortal/Online Resources Data
  28183. * @param {Object} params - 参数。
  28184. * @param {string} params.dataBase - 数据源连接的数据库名。
  28185. * @param {string} params.server - 服务地址。
  28186. * @usage
  28187. */
  28188. class IPortalDataConnectionInfoParam {
  28189. constructor(params) {
  28190. params = params || {};
  28191. this.dataBase = "";
  28192. this.server = "";
  28193. Util_Util.extend(this, params);
  28194. }
  28195. }
  28196. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  28197. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28198. * This program are made available under the terms of the Apache License, Version 2.0
  28199. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28200. /**
  28201. * @class IPortalUser
  28202. * @aliasclass iPortalUser
  28203. * @deprecatedclass SuperMap.iPortalUser
  28204. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  28205. * @version 10.0.1
  28206. * @category iPortal/Online Resources
  28207. * @param {string} iportalUrl - 服务地址。
  28208. * @extends {IPortalServiceBase}
  28209. * @usage
  28210. */
  28211. class IPortalUser extends IPortalServiceBase {
  28212. constructor(iportalUrl) {
  28213. super(iportalUrl);
  28214. this.iportalUrl = iportalUrl;
  28215. }
  28216. /**
  28217. * @function IPortalUser.prototype.deleteResources
  28218. * @description 删除资源。
  28219. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  28220. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  28221. */
  28222. deleteResources(params) {
  28223. var resourceName = params.resourceType.replace("_","").toLowerCase();
  28224. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  28225. if( resourceName === 'data') {
  28226. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  28227. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  28228. }
  28229. return this.request("DELETE", deleteResourceUrl);
  28230. }
  28231. /**
  28232. * @function IPortalUser.prototype.addMap
  28233. * @description 添加地图。
  28234. * @version 10.1.0
  28235. * @param {IPortalAddResourceParam} addMapParams - 添加地图的参数。
  28236. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  28237. */
  28238. addMap(addMapParams) {
  28239. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  28240. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  28241. }
  28242. let cloneAddMapParams = {
  28243. rootUrl: addMapParams.rootUrl,
  28244. tags: addMapParams.tags,
  28245. authorizeSetting: addMapParams.entities
  28246. }
  28247. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  28248. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  28249. return result;
  28250. });
  28251. }
  28252. /**
  28253. * @function IPortalUser.prototype.addScene
  28254. * @description 添加场景。
  28255. * @version 10.1.0
  28256. * @param {IPortalAddResourceParam} addSceneParams - 添加场景的参数。
  28257. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  28258. */
  28259. addScene(addSceneParams) {
  28260. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  28261. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  28262. }
  28263. let cloneAddSceneParams = {
  28264. rootUrl: addSceneParams.rootUrl,
  28265. tags: addSceneParams.tags,
  28266. authorizeSetting: addSceneParams.entities
  28267. }
  28268. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  28269. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  28270. return result;
  28271. });
  28272. }
  28273. /**
  28274. * @function IPortalUser.prototype.registerService
  28275. * @description 注册服务。
  28276. * @version 10.1.0
  28277. * @param {IPortalRegisterServiceParam} registerParams - 注册服务的参数。
  28278. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  28279. */
  28280. registerService(registerParams) {
  28281. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  28282. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  28283. }
  28284. let cloneRegisterParams = {
  28285. type: registerParams.type,
  28286. tags: registerParams.tags,
  28287. authorizeSetting: registerParams.entities,
  28288. metadata: registerParams.metadata,
  28289. addedMapNames: registerParams.addedMapNames,
  28290. addedSceneNames: registerParams.addedSceneNames
  28291. }
  28292. let registerUrl = this.iportalUrl + "/web/services.json";
  28293. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  28294. return result;
  28295. });
  28296. }
  28297. /**
  28298. * @function IPortalUser.prototype.getErrMsgPromise
  28299. * @description 获取包含错误信息的Promise对象。
  28300. * @version 10.1.0
  28301. * @param {string} errMsg - 传入的错误信息。
  28302. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  28303. */
  28304. getErrMsgPromise(errMsg) {
  28305. return new Promise(resolve => {
  28306. resolve(errMsg);
  28307. })
  28308. }
  28309. /**
  28310. * @function IPortalUser.prototype.uploadDataRequest
  28311. * @description 上传数据。
  28312. * @version 10.1.0
  28313. * @param {number} id - 上传数据的资源ID。
  28314. * @param {Object} formData - 请求体为文本数据流。
  28315. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  28316. */
  28317. uploadDataRequest(id,formData) {
  28318. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  28319. return this.request("POST",uploadDataUrl,formData);
  28320. }
  28321. /**
  28322. * @function IPortalUser.prototype.addData
  28323. * @description 上传/注册数据。
  28324. * @version 10.1.0
  28325. * @param {IPortalAddDataParam} params - 上传/注册数据所需的参数。
  28326. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  28327. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  28328. */
  28329. addData(params,formData) {
  28330. if(!(params instanceof IPortalAddDataParam)){
  28331. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  28332. }
  28333. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  28334. var entity = {
  28335. fileName:params.fileName,
  28336. tags:params.tags,
  28337. type:params.type
  28338. };
  28339. var type = params.type.toLowerCase();
  28340. var dataMetaInfo;
  28341. if(type === "excel" || type === "csv"){
  28342. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  28343. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  28344. }
  28345. dataMetaInfo = {
  28346. xField:params.dataMetaInfo.xField,
  28347. yField:params.dataMetaInfo.yField
  28348. }
  28349. if(type === 'csv') {
  28350. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  28351. }
  28352. entity.coordType = "WGS84";
  28353. entity.dataMetaInfo = dataMetaInfo;
  28354. }else if(type === "hdfs" || type === "hbase") {
  28355. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  28356. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  28357. }
  28358. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  28359. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  28360. }
  28361. var dataStoreInfo = {
  28362. type:params.dataMetaInfo.dataStoreInfo.type
  28363. }
  28364. switch (type) {
  28365. case "hdfs":
  28366. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  28367. dataMetaInfo = {
  28368. url: params.dataMetaInfo.url,
  28369. dataStoreInfo:dataStoreInfo
  28370. }
  28371. break;
  28372. case "hbase":
  28373. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  28374. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  28375. }
  28376. dataStoreInfo.connectionInfo = {
  28377. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  28378. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  28379. engineType:'HBASE'
  28380. }
  28381. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  28382. dataMetaInfo = {
  28383. dataStoreInfo:dataStoreInfo
  28384. }
  28385. break;
  28386. }
  28387. entity.dataMetaInfo = dataMetaInfo;
  28388. }
  28389. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  28390. if(type === "hdfs" || type === "hbase"){
  28391. return res;
  28392. }else {
  28393. if(res.childID) {
  28394. return this.uploadDataRequest(res.childID,formData);
  28395. }else {
  28396. return res.customResult;
  28397. }
  28398. }
  28399. })
  28400. }
  28401. /**
  28402. * @function IPortalUser.prototype.publishOrUnpublish
  28403. * @description 发布/取消发布。
  28404. * @version 10.1.0
  28405. * @param {Object} options - 发布/取消发布数据服务所需的参数。
  28406. * @param {Object} options.dataId - 数据项ID。
  28407. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  28408. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  28409. * @param {boolean} forPublish - 是否取消发布。
  28410. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  28411. */
  28412. publishOrUnpublish(option,forPublish){
  28413. if(!option.dataId || !option.serviceType) {
  28414. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  28415. }
  28416. var dataId = option.dataId;
  28417. var dataServiceId = option.dataServiceId;
  28418. var serviceType = option.serviceType;
  28419. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  28420. if (dataServiceId) {
  28421. publishUrl += "&dataServiceId=" + dataServiceId;
  28422. }
  28423. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  28424. // 发起服务状态查询
  28425. if(forPublish) {
  28426. // 发布服务的结果异步处理
  28427. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  28428. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  28429. dataServiceId = res.customResult;
  28430. }
  28431. return dataServiceId;
  28432. }else {
  28433. // 取消发布的结果同步处理
  28434. return res;
  28435. }
  28436. });
  28437. }
  28438. /**
  28439. * @function IPortalUser.prototype.getDataPublishedStatus
  28440. * @description 查询服务状态,发起服务状态查询。
  28441. * @version 10.1.0
  28442. * @param {number} dataId - 查询服务状态的数据项ID。
  28443. * @param {string} dataServiceId - 发布的服务ID。
  28444. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  28445. */
  28446. getDataPublishedStatus(dataId,dataServiceId){
  28447. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  28448. return this.request("GET",publishStateUrl);
  28449. }
  28450. /**
  28451. * @function IPortalUser.prototype.unPublishedDataService
  28452. * @description 取消发布。
  28453. * @version 10.1.0
  28454. * @param {Object} options - 取消发布服务具体参数。
  28455. * @param {Object} options.dataId - 数据项ID。
  28456. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  28457. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  28458. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  28459. */
  28460. unPublishDataService(option){
  28461. return this.publishOrUnpublish(option,false);
  28462. }
  28463. /**
  28464. * @function IPortalUser.prototype.publishedDataService
  28465. * @description 发布数据服务。
  28466. * @version 10.1.0
  28467. * @param {Object} options - 发布数据服务具体参数。
  28468. * @param {Object} options.dataId - 数据项ID。
  28469. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  28470. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  28471. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  28472. */
  28473. publishDataService(option){
  28474. return this.publishOrUnpublish(option,true);
  28475. }
  28476. }
  28477. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  28478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28479. * This program are made available under the terms of the Apache License, Version 2.0
  28480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28481. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  28482. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28483. * This program are made available under the terms of the Apache License, Version 2.0
  28484. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28485. /**
  28486. * @class CommonServiceBase
  28487. * @deprecatedclass SuperMap.CommonServiceBase
  28488. * @category iServer Core
  28489. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  28490. * @param {string} url - 服务地址。
  28491. * @param {Object} options - 参数。
  28492. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  28493. * @param {string} [options.proxy] - 服务代理地址。
  28494. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  28495. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28496. * @param {Object} [options.headers] - 请求头。
  28497. * @usage
  28498. */
  28499. class CommonServiceBase {
  28500. constructor(url, options) {
  28501. let me = this;
  28502. this.EVENT_TYPES = ['processCompleted', 'processFailed'];
  28503. this.events = null;
  28504. this.eventListeners = null;
  28505. this.url = null;
  28506. this.urls = null;
  28507. this.proxy = null;
  28508. this.index = null;
  28509. this.length = null;
  28510. this.totalTimes = null;
  28511. this.POLLING_TIMES = 3;
  28512. this.isInTheSameDomain = null;
  28513. this.withCredentials = false;
  28514. if (Util_Util.isArray(url)) {
  28515. me.urls = url;
  28516. me.length = url.length;
  28517. me.totalTimes = me.length;
  28518. if (me.length === 1) {
  28519. me.url = url[0];
  28520. } else {
  28521. me.index = parseInt(Math.random() * me.length);
  28522. me.url = url[me.index];
  28523. }
  28524. } else {
  28525. me.totalTimes = 1;
  28526. me.url = url;
  28527. }
  28528. if (Util_Util.isArray(url) && !me.isServiceSupportPolling()) {
  28529. me.url = url[0];
  28530. me.totalTimes = 1;
  28531. }
  28532. options = options || {};
  28533. this.crossOrigin = options.crossOrigin;
  28534. this.headers = options.headers;
  28535. Util_Util.extend(this, options);
  28536. me.isInTheSameDomain = Util_Util.isInTheSameDomain(me.url);
  28537. me.events = new Events(me, null, me.EVENT_TYPES, true);
  28538. if (me.eventListeners instanceof Object) {
  28539. me.events.on(me.eventListeners);
  28540. }
  28541. this.CLASS_NAME = 'SuperMap.CommonServiceBase';
  28542. }
  28543. /**
  28544. * @function CommonServiceBase.prototype.destroy
  28545. * @description 释放资源,将引用的资源属性置空。
  28546. */
  28547. destroy() {
  28548. let me = this;
  28549. if (Util_Util.isArray(me.urls)) {
  28550. me.urls = null;
  28551. me.index = null;
  28552. me.length = null;
  28553. me.totalTimes = null;
  28554. }
  28555. me.url = null;
  28556. me._processSuccess = null;
  28557. me._processFailed = null;
  28558. me.isInTheSameDomain = null;
  28559. me.EVENT_TYPES = null;
  28560. if (me.events) {
  28561. me.events.destroy();
  28562. me.events = null;
  28563. }
  28564. if (me.eventListeners) {
  28565. me.eventListeners = null;
  28566. }
  28567. }
  28568. /**
  28569. * @function CommonServiceBase.prototype.request
  28570. * @description: 该方法用于向服务发送请求。
  28571. * @param {Object} options - 参数。
  28572. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  28573. * @param {string} [options.url] - 发送请求的地址。
  28574. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  28575. * @param {string} [options.data] - 发送到服务器的数据。
  28576. * @param {function} options.success - 请求成功后的回调函数。
  28577. * @param {function} options.failure - 请求失败后的回调函数。
  28578. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  28579. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  28580. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  28581. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28582. * @param {Object} [options.headers] - 请求头。
  28583. */
  28584. request(options) {
  28585. const format = options.scope.format;
  28586. if (format && !this.supportDataFormat(format)) {
  28587. throw new Error(`${this.CLASS_NAME} is not surport ${format} format!`);
  28588. }
  28589. let me = this;
  28590. options.url = options.url || me.url;
  28591. if (this._returnContent(options) && !options.url.includes('returnContent=true')) {
  28592. options.url = Util_Util.urlAppend(options.url, 'returnContent=true');
  28593. }
  28594. options.proxy = options.proxy || me.proxy;
  28595. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  28596. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  28597. options.headers = options.headers || me.headers;
  28598. options.isInTheSameDomain = me.isInTheSameDomain;
  28599. options.withoutFormatSuffix = options.scope.withoutFormatSuffix || false;
  28600. //为url添加安全认证信息片段
  28601. options.url = SecurityManager.appendCredential(options.url);
  28602. me.calculatePollingTimes();
  28603. options.scope = me;
  28604. var success = options.scope? options.success.bind(options.scope) : options.success;
  28605. var failure = options.scope? options.failure.bind(options.scope) : options.failure;
  28606. options.success = me.getUrlCompleted(success, options);
  28607. options.failure = me.getUrlFailed(failure, options);
  28608. me._commit(options);
  28609. }
  28610. /**
  28611. * @function CommonServiceBase.prototype.getUrlCompleted
  28612. * @description 请求成功后执行此方法。
  28613. * @param {Object} cb - 成功回调函数。
  28614. * @param {Object} options - 请求参数对象。
  28615. * @private
  28616. */
  28617. getUrlCompleted(cb, options) {
  28618. // @param {Object} result - 服务器返回的结果对象。
  28619. return function(result) {
  28620. cb && cb(result, options);
  28621. }
  28622. }
  28623. /**
  28624. * @function CommonServiceBase.prototype.getUrlFailed
  28625. * @description 请求失败后执行此方法。
  28626. * @param {Object} cb - 失败回调函数。
  28627. * @param {Object} options - 请求参数对象。
  28628. * @private
  28629. */
  28630. getUrlFailed(cb, options) {
  28631. const me = this;
  28632. // @param {Object} result - 服务器返回的结果对象。
  28633. return function(result) {
  28634. if (me.totalTimes > 0) {
  28635. me.totalTimes--;
  28636. me.ajaxPolling(options);
  28637. } else {
  28638. cb && cb(result, options);
  28639. }
  28640. }
  28641. }
  28642. /**
  28643. *
  28644. * @function CommonServiceBase.prototype.ajaxPolling
  28645. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求。
  28646. * @param {Object} options - 请求参数对象。
  28647. * @private
  28648. */
  28649. ajaxPolling(options) {
  28650. let me = this,
  28651. url = options.url,
  28652. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  28653. me.index = parseInt(Math.random() * me.length);
  28654. me.url = me.urls[me.index];
  28655. url = url.replace(re, re.exec(me.url)[0]);
  28656. options.url = url;
  28657. options.isInTheSameDomain = Util_Util.isInTheSameDomain(url);
  28658. me._commit(options);
  28659. }
  28660. /**
  28661. * @function CommonServiceBase.prototype.calculatePollingTimes
  28662. * @description 计算剩余请求失败执行次数。
  28663. */
  28664. calculatePollingTimes() {
  28665. let me = this;
  28666. if (me.times) {
  28667. if (me.totalTimes > me.POLLING_TIMES) {
  28668. if (me.times > me.POLLING_TIMES) {
  28669. me.totalTimes = me.POLLING_TIMES;
  28670. } else {
  28671. me.totalTimes = me.times;
  28672. }
  28673. } else {
  28674. if (me.times < me.totalTimes) {
  28675. me.totalTimes = me.times;
  28676. }
  28677. }
  28678. } else {
  28679. if (me.totalTimes > me.POLLING_TIMES) {
  28680. me.totalTimes = me.POLLING_TIMES;
  28681. }
  28682. }
  28683. me.totalTimes--;
  28684. }
  28685. /**
  28686. * @function CommonServiceBase.prototype.isServiceSupportPolling
  28687. * @description 判断服务是否支持轮询。
  28688. */
  28689. isServiceSupportPolling() {
  28690. let me = this;
  28691. return !(
  28692. me.CLASS_NAME === 'SuperMap.REST.ThemeService' || me.CLASS_NAME === 'SuperMap.REST.EditFeaturesService'
  28693. );
  28694. }
  28695. /**
  28696. * @function CommonServiceBase.prototype.serviceProcessCompleted
  28697. * @description 状态完成,执行此方法。
  28698. * @param {Object} result - 服务器返回的结果对象。
  28699. * @param {Object} options - 请求参数对象。
  28700. * @private
  28701. */
  28702. serviceProcessCompleted(result, options) {
  28703. result = Util_Util.transformResult(result);
  28704. this.events.triggerEvent('processCompleted', {
  28705. result: result,
  28706. options: options
  28707. });
  28708. }
  28709. /**
  28710. * @function CommonServiceBase.prototype.serviceProcessFailed
  28711. * @description 状态失败,执行此方法。
  28712. * @param {Object} result - 服务器返回的结果对象。
  28713. * @param {Object} options - 请求参数对象。对象
  28714. * @private
  28715. */
  28716. serviceProcessFailed(result, options) {
  28717. result = Util_Util.transformResult(result);
  28718. let error = result.error || result;
  28719. this.events.triggerEvent('processFailed', {
  28720. error: error,
  28721. options: options
  28722. });
  28723. }
  28724. _returnContent(options) {
  28725. if (options.scope.format === DataFormat.FGB) {
  28726. return false;
  28727. }
  28728. if (options.scope.returnContent) {
  28729. return true;
  28730. }
  28731. return false;
  28732. }
  28733. supportDataFormat(foramt) {
  28734. return this.dataFormat().includes(foramt);
  28735. }
  28736. dataFormat() {
  28737. return [DataFormat.GEOJSON, DataFormat.ISERVER];
  28738. }
  28739. _commit(options) {
  28740. if (options.method === 'POST' || options.method === 'PUT' || options.method === 'PATCH') {
  28741. if (options.params) {
  28742. options.url = Util_Util.urlAppend(options.url, Util_Util.getParameterString(options.params || {}));
  28743. }
  28744. if (typeof options.data === 'object') {
  28745. try {
  28746. options.params = Util_Util.toJSON(options.data);
  28747. } catch (e) {
  28748. console.log('不是json对象');
  28749. }
  28750. } else {
  28751. options.params = options.data;
  28752. }
  28753. }
  28754. FetchRequest.commit(options.method, options.url, options.params, {
  28755. headers: options.headers,
  28756. withoutFormatSuffix: options.withoutFormatSuffix,
  28757. withCredentials: options.withCredentials,
  28758. crossOrigin: options.crossOrigin,
  28759. timeout: options.async ? 0 : null,
  28760. proxy: options.proxy
  28761. })
  28762. .then(function (response) {
  28763. if (response.text) {
  28764. return response.text();
  28765. }
  28766. if (response.json) {
  28767. return response.json();
  28768. }
  28769. return response;
  28770. })
  28771. .then(function (text) {
  28772. let requestResult = text;
  28773. if (typeof text === 'string') {
  28774. requestResult = new JSONFormat().read(text);
  28775. }
  28776. if (
  28777. !requestResult ||
  28778. requestResult.error ||
  28779. (requestResult.code >= 300 && requestResult.code !== 304)
  28780. ) {
  28781. if (requestResult && requestResult.error) {
  28782. requestResult = {
  28783. error: requestResult.error
  28784. };
  28785. } else {
  28786. requestResult = {
  28787. error: requestResult
  28788. };
  28789. }
  28790. }
  28791. if (requestResult && options.scope.format === DataFormat.FGB) {
  28792. requestResult.newResourceLocation = requestResult.newResourceLocation.replace('.json', '') + '.fgb';
  28793. }
  28794. return requestResult;
  28795. })
  28796. .catch(function (e) {
  28797. return { error: e };
  28798. })
  28799. .then((requestResult) => {
  28800. if (requestResult.error) {
  28801. var failure = options.scope ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  28802. failure(requestResult);
  28803. } else {
  28804. requestResult.succeed = requestResult.succeed == undefined ? true : requestResult.succeed;
  28805. var success = options.scope ? FunctionExt.bind(options.success, options.scope) : options.success;
  28806. success(requestResult);
  28807. }
  28808. });
  28809. }
  28810. }
  28811. /**
  28812. * 服务器请求回调函数。
  28813. * @callback RequestCallback
  28814. * @category BaseTypes Util
  28815. * @example
  28816. * var requestCallback = function (serviceResult){
  28817. * console.log(serviceResult.result);
  28818. * }
  28819. * new QueryService(url).queryByBounds(param, requestCallback);
  28820. * @param {Object} serviceResult
  28821. * @param {Object} serviceResult.result 服务器返回结果。
  28822. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  28823. * @param {Object} serviceResult.type 事件类型。
  28824. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  28825. * @param {Object} serviceResult.options 请求参数。
  28826. */
  28827. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  28828. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28829. * This program are made available under the terms of the Apache License, Version 2.0
  28830. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28831. /**
  28832. * @class GeoCodingParameter
  28833. * @deprecatedclass SuperMap.GeoCodingParameter
  28834. * @category iServer AddressMatch
  28835. * @classdesc 地理正向匹配参数类。
  28836. * @param {Object} options - 参数。
  28837. * @param {string} options.address - 地点关键词。
  28838. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  28839. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  28840. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  28841. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  28842. * @param {number} [options.maxReturn] - 最大返回结果数。
  28843. * @usage
  28844. */
  28845. class GeoCodingParameter {
  28846. constructor(options) {
  28847. if (options.filters && typeof(options.filters) === 'string') {
  28848. options.filters = options.filters.split(',');
  28849. }
  28850. /**
  28851. * @member {string} GeoCodingParameter.prototype.address
  28852. * @description 地点关键词。
  28853. */
  28854. this.address = null;
  28855. /**
  28856. * @member {number} [GeoCodingParameter.prototype.fromIndex]
  28857. * @description 设置返回对象的起始索引值。
  28858. */
  28859. this.fromIndex = null;
  28860. /**
  28861. * @member {number} [GeoCodingParameter.prototype.toIndex]
  28862. * @description 设置返回对象的结束索引值。
  28863. */
  28864. this.toIndex = null;
  28865. /**
  28866. * @member {Array.<string>} [GeoCodingParameter.prototype.filters]
  28867. * @description 过滤字段,限定查询区域。
  28868. */
  28869. this.filters = null;
  28870. /**
  28871. * @member {string} [GeoCodingParameter.prototype.prjCoordSys]
  28872. * @description 查询结果的坐标系。
  28873. */
  28874. this.prjCoordSys = null;
  28875. /**
  28876. * @member {number} [GeoCodingParameter.prototype.maxReturn]
  28877. * @description 最大返回结果数。
  28878. */
  28879. this.maxReturn = null;
  28880. Util_Util.extend(this, options);
  28881. }
  28882. /**
  28883. * @function GeoCodingParameter.prototype.destroy
  28884. * @description 释放资源,将引用资源的属性置空。
  28885. */
  28886. destroy() {
  28887. this.address = null;
  28888. this.fromIndex = null;
  28889. this.toIndex = null;
  28890. this.filters = null;
  28891. this.prjCoordSys = null;
  28892. this.maxReturn = null;
  28893. }
  28894. }
  28895. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  28896. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28897. * This program are made available under the terms of the Apache License, Version 2.0
  28898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28899. /**
  28900. * @class GeoDecodingParameter
  28901. * @deprecatedclass SuperMap.GeoDecodingParameter
  28902. * @category iServer AddressMatch
  28903. * @classdesc 地理反向匹配参数类。
  28904. * @param {Object} options - 参数。
  28905. * @param {number} options.x - 查询位置的横坐标。
  28906. * @param {number} options.y - 查询位置的纵坐标。
  28907. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  28908. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  28909. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  28910. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  28911. * @param {number} [options.maxReturn] - 最大返回结果数。
  28912. * @param {number} [options.geoDecodingRadius] - 查询半径。
  28913. * @usage
  28914. */
  28915. class GeoDecodingParameter {
  28916. constructor(options) {
  28917. if (options.filters) {
  28918. options.filters = options.filters.split(',');
  28919. }
  28920. /**
  28921. * @member {number} GeoDecodingParameter.prototype.x
  28922. * @description 查询位置的横坐标。
  28923. */
  28924. this.x = null;
  28925. /**
  28926. * @member {number} GeoDecodingParameter.prototype.y
  28927. * @description 查询位置的纵坐标。
  28928. */
  28929. this.y = null;
  28930. /**
  28931. * @member {number} [GeoDecodingParameter.prototype.fromIndex]
  28932. * @description 设置返回对象的起始索引值。
  28933. */
  28934. this.fromIndex = null;
  28935. /**
  28936. * @member {number} [GeoDecodingParameter.prototype.toIndex]
  28937. * @description 设置返回对象的结束索引值。
  28938. */
  28939. this.toIndex = null;
  28940. /**
  28941. * @member {Array.<string>} [GeoDecodingParameter.prototype.filters]
  28942. * @description 过滤字段,限定查询区域。
  28943. */
  28944. this.filters = null;
  28945. /**
  28946. * @member {string} [GeoDecodingParameter.prototype.prjCoordSys]
  28947. * @description 查询结果的坐标系。
  28948. */
  28949. this.prjCoordSys = null;
  28950. /**
  28951. * @member {number} [GeoDecodingParameter.prototype.maxReturn]
  28952. * @description 最大返回结果数。
  28953. */
  28954. this.maxReturn = null;
  28955. /**
  28956. * @member {number} GeoDecodingParameter.prototype.geoDecodingRadius
  28957. * @description 查询半径。
  28958. */
  28959. this.geoDecodingRadius = null;
  28960. Util_Util.extend(this, options);
  28961. }
  28962. /**
  28963. * @function GeoDecodingParameter.prototype.destroy
  28964. * @description 释放资源,将引用资源的属性置空。
  28965. */
  28966. destroy() {
  28967. this.x = null;
  28968. this.y = null;
  28969. this.fromIndex = null;
  28970. this.toIndex = null;
  28971. this.filters = null;
  28972. this.prjCoordSys = null;
  28973. this.maxReturn = null;
  28974. this.geoDecodingRadius = null;
  28975. }
  28976. }
  28977. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  28978. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28979. * This program are made available under the terms of the Apache License, Version 2.0
  28980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28981. /**
  28982. * @class AddressMatchService
  28983. * @deprecatedclass SuperMap.AddressMatchService
  28984. * @category iServer AddressMatch
  28985. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  28986. * @param {string} url - 服务地址。
  28987. * @param {Object} options - 可选参数。
  28988. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28989. * @param {Object} [options.headers] - 请求头。
  28990. * @usage
  28991. */
  28992. class AddressMatchService extends CommonServiceBase {
  28993. constructor(url, options) {
  28994. super(url, options);
  28995. this.options = options || {};
  28996. this.eventCount = 0;
  28997. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  28998. }
  28999. /**
  29000. * @function AddressMatchService.prototype.destroy
  29001. * @override
  29002. */
  29003. destroy() {
  29004. super.destroy();
  29005. }
  29006. /**
  29007. * @function AddressMatchService.prototype.code
  29008. * @param {string} url - 正向地址匹配服务地址。
  29009. * @param {GeoCodingParameter} params - 正向地址匹配服务参数。
  29010. */
  29011. code(url, params, callback) {
  29012. if (!(params instanceof GeoCodingParameter)) {
  29013. return;
  29014. }
  29015. this.processAsync(url, params, callback);
  29016. }
  29017. /**
  29018. * @function AddressMatchService.prototype.decode
  29019. * @param {string} url - 反向地址匹配服务地址。
  29020. * @param {GeoDecodingParameter} params - 反向地址匹配服务参数。
  29021. */
  29022. decode(url, params, callback) {
  29023. if (!(params instanceof GeoDecodingParameter)) {
  29024. return;
  29025. }
  29026. this.processAsync(url, params, callback);
  29027. }
  29028. /**
  29029. * @function AddressMatchService.prototype.processAsync
  29030. * @description 负责将客户端的动态分段服务参数传递到服务端。
  29031. * @param {string} url - 服务地址。
  29032. * @param {Object} params - 参数。
  29033. */
  29034. processAsync(url, params, callback) {
  29035. let eventId = ++this.eventCount;
  29036. let eventListeners = {
  29037. scope: this,
  29038. processCompleted: function(result) {
  29039. if (eventId === result.result.eventId && callback) {
  29040. delete result.result.eventId;
  29041. callback(result);
  29042. this.events && this.events.un(eventListeners);
  29043. return false;
  29044. }
  29045. },
  29046. processFailed: function(result) {
  29047. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  29048. callback(result);
  29049. this.events && this.events.un(eventListeners);
  29050. return false;
  29051. }
  29052. }
  29053. }
  29054. this.events.on(eventListeners);
  29055. this.request({
  29056. method: 'GET',
  29057. url,
  29058. params,
  29059. scope: this,
  29060. success(result, options) {
  29061. result.eventId = eventId;
  29062. this.serviceProcessCompleted(result, options);
  29063. },
  29064. failure(result, options) {
  29065. if (result.error) {
  29066. result.error.eventId = eventId;
  29067. }
  29068. result.eventId = eventId;
  29069. this.serviceProcessFailed(result, options);
  29070. }
  29071. });
  29072. }
  29073. /**
  29074. * @function AddressMatchService.prototype.serviceProcessCompleted
  29075. * @param {Object} result - 服务器返回的结果对象。
  29076. * @description 服务流程是否完成
  29077. */
  29078. serviceProcessCompleted(result, options) {
  29079. if (result.succeed) {
  29080. delete result.succeed;
  29081. }
  29082. super.serviceProcessCompleted(result, options);
  29083. }
  29084. /**
  29085. * @function AddressMatchService.prototype.serviceProcessCompleted
  29086. * @param {Object} result - 服务器返回的结果对象。
  29087. * @description 服务流程是否失败
  29088. */
  29089. serviceProcessFailed(result, options) {
  29090. super.serviceProcessFailed(result, options);
  29091. }
  29092. }
  29093. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  29094. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29095. * This program are made available under the terms of the Apache License, Version 2.0
  29096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29097. /**
  29098. * @class AggregationParameter
  29099. * @deprecatedclass SuperMap.AggregationParameter
  29100. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  29101. * @category iServer Data FeatureResults
  29102. * @param {Object} options - 参数。
  29103. * @param {string} options.aggName - 聚合名称。
  29104. * @param {string} options.aggFieldName - 聚合字段。
  29105. * @usage
  29106. */
  29107. class AggregationParameter {
  29108. constructor(options) {
  29109. /**
  29110. * @member {string} AggregationParameter.prototype.aggName
  29111. * @description 聚合名称。
  29112. */
  29113. this.aggName = null;
  29114. /**
  29115. * @member {string} AggregationParameter.prototype.aggFieldName
  29116. * @description 聚合字段。
  29117. */
  29118. this.aggFieldName = null;
  29119. this.CLASS_NAME = 'SuperMap.AggregationParameter';
  29120. Util_Util.extend(this, options);
  29121. }
  29122. destroy() {
  29123. var me = this;
  29124. me.aggName = null;
  29125. me.aggFieldName = null;
  29126. me.aggType = null;
  29127. }
  29128. }
  29129. ;// CONCATENATED MODULE: ./src/common/iServer/BucketAggParameter.js
  29130. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29131. * This program are made available under the terms of the Apache License, Version 2.0
  29132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29133. /**
  29134. * @class BucketAggParameter
  29135. * @deprecatedclass SuperMap.BucketAggParameter
  29136. * @classdesc 子聚合类查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  29137. * @category iServer Data FeatureResults
  29138. * @param {Object} options - 参数。
  29139. * @param {Array.<MetricsAggParameter>} options.subAggs - 子聚合类集合。
  29140. * @extends {AggregationParameter}
  29141. * @usage
  29142. */
  29143. class BucketAggParameter extends AggregationParameter {
  29144. constructor(options) {
  29145. super();
  29146. /**
  29147. * @member {Array.<MetricsAggParameter>} BucketAggParameter.prototype.subAggs
  29148. * @description 子聚合类集合。
  29149. */
  29150. this.subAggs = null;
  29151. this.aggType = null;
  29152. this.CLASS_NAME = 'SuperMap.BucketAggParameter';
  29153. Util_Util.extend(this, options);
  29154. }
  29155. destroy() {
  29156. var me = this;
  29157. if (me.subAggs) {
  29158. me.subAggs = null;
  29159. }
  29160. }
  29161. }
  29162. ;// CONCATENATED MODULE: ./src/common/iServer/MetricsAggParameter.js
  29163. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29164. * This program are made available under the terms of the Apache License, Version 2.0
  29165. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29166. /**
  29167. * @class MetricsAggParameter
  29168. * @deprecatedclass SuperMap.MetricsAggParameter
  29169. * @classdesc 指标聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  29170. * @category iServer Data FeatureResults
  29171. * @param {Object} options - 可选参数。
  29172. * @param {MetricsAggType} [options.aggType = 'avg'] - 聚合类型。
  29173. * @extends {AggregationParameter}
  29174. * @usage
  29175. */
  29176. class MetricsAggParameter extends AggregationParameter {
  29177. constructor(option) {
  29178. super();
  29179. /**
  29180. * @member {MetricsAggType} [MetricsAggParameter.prototype.aggType=MetricsAggType.AVG]
  29181. * @description 指标聚合类型。
  29182. */
  29183. this.aggType = MetricsAggType.AVG;
  29184. Util_Util.extend(this, option);
  29185. this.CLASS_NAME = 'SuperMap.MetricsAggParameter';
  29186. }
  29187. destroy() {
  29188. super.destroy();
  29189. var me = this;
  29190. me.aggType = null;
  29191. }
  29192. }
  29193. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  29194. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29195. * This program are made available under the terms of the Apache License, Version 2.0
  29196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29197. /**
  29198. * @class AreaSolarRadiationParameters
  29199. * @deprecatedclass SuperMap.AreaSolarRadiationParameters
  29200. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  29201. * @classdesc 地区太阳辐射参数类。
  29202. * @param {Object} options - 参数。
  29203. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  29204. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  29205. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  29206. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  29207. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  29208. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  29209. * @param {number} options.latitude - 待计算区域的纬度值。
  29210. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  29211. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  29212. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  29213. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  29214. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  29215. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  29216. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  29217. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  29218. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29219. * @usage
  29220. */
  29221. class AreaSolarRadiationParameters {
  29222. constructor(options) {
  29223. /**
  29224. * @member {string} AreaSolarRadiationParameters.prototype.dataset
  29225. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  29226. */
  29227. this.dataset = null;
  29228. /**
  29229. * @member {string} AreaSolarRadiationParameters.prototype.targetDatasourceName
  29230. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  29231. */
  29232. this.targetDatasourceName = null;
  29233. /**
  29234. * @member {string} AreaSolarRadiationParameters.prototype.totalGridName
  29235. * @description 指定地区太阳辐射总辐射量数据集的名称。
  29236. */
  29237. this.totalGridName = null;
  29238. /**
  29239. * @member {string} AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  29240. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  29241. */
  29242. this.diffuseDatasetGridName = null;
  29243. /**
  29244. * @member {string} AreaSolarRadiationParameters.prototype.durationDatasetGridName
  29245. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  29246. */
  29247. this.durationDatasetGridName = null;
  29248. /**
  29249. * @member {string} AreaSolarRadiationParameters.prototype.directDatasetGridName
  29250. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  29251. */
  29252. this.directDatasetGridName = null;
  29253. /**
  29254. * @member {number} AreaSolarRadiationParameters.prototype.latitude
  29255. * @description 待计算区域的纬度值。
  29256. */
  29257. this.latitude = null;
  29258. /**
  29259. * @member {string} [AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  29260. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  29261. */
  29262. this.timeMode = "MULTIDAYS";
  29263. /**
  29264. * @member {number} AreaSolarRadiationParameters.prototype.dayStart
  29265. * @description 起始日期(年内的第几天)。
  29266. */
  29267. this.dayStart = null;
  29268. /**
  29269. * @member {number} AreaSolarRadiationParameters.prototype.dayEnd
  29270. * @description 结束日期(年内的第几天)。
  29271. */
  29272. this.dayEnd = null;
  29273. /**
  29274. * @member {number} [AreaSolarRadiationParameters.prototype.hourStart]
  29275. * @description 起始时间(一天中的第几个小时)。
  29276. */
  29277. this.hourStart = null;
  29278. /**
  29279. * @member {number} [AreaSolarRadiationParameters.prototype.hourEnd]
  29280. * @description 结束时间(一天中的第几个小时)。
  29281. */
  29282. this.hourEnd = null;
  29283. /**
  29284. * @member {number} [AreaSolarRadiationParameters.prototype.transmittance]
  29285. * @description 太阳辐射穿过大气的透射率。
  29286. */
  29287. this.transmittance = null;
  29288. /**
  29289. * @member {number} [AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  29290. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  29291. */
  29292. this.hourInterval = null;
  29293. /**
  29294. * @member {number} [AreaSolarRadiationParameters.prototype.dayInterval=5]
  29295. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  29296. */
  29297. this.dayInterval = null;
  29298. /**
  29299. * @member {boolean} [AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  29300. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29301. */
  29302. this.deleteExistResultDataset = false;
  29303. Util_Util.extend(this, options);
  29304. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  29305. }
  29306. /**
  29307. * @function AreaSolarRadiationParameters.prototype.destroy
  29308. * @description 释放资源,将引用资源的属性置空。
  29309. */
  29310. destroy() {
  29311. var me = this;
  29312. me.dataset = null;
  29313. me.zFactor = 1.0;
  29314. me.averageCurvatureName = null;
  29315. me.profileCurvatureName = null;
  29316. me.planCurvatureName = null;
  29317. me.deleteExistResultDataset = true;
  29318. }
  29319. /**
  29320. * @function AreaSolarRadiationParameters.toObject
  29321. * @param {AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  29322. * @param {AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  29323. * @returns {Object} JSON对象。
  29324. * @description 将AreaSolarRadiationParameters对象转换成JSON对象。
  29325. */
  29326. static toObject(param, tempObj) {
  29327. var parameter = {};
  29328. for (var name in param) {
  29329. if (name !== "dataset") {
  29330. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  29331. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  29332. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  29333. if (name1 || name2 || name3) {
  29334. parameter[name] = param[name];
  29335. } else {
  29336. tempObj[name] = param[name];
  29337. }
  29338. }
  29339. }
  29340. tempObj["parameter"] = parameter;
  29341. }
  29342. }
  29343. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  29344. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29345. * This program are made available under the terms of the Apache License, Version 2.0
  29346. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29347. /**
  29348. * @class SpatialAnalystBase
  29349. * @deprecatedclass SuperMap.SpatialAnalystBase
  29350. * @category iServer Core
  29351. * @classdesc 空间分析服务基类。
  29352. * @param {string} url - 地址。
  29353. * @param {Object} options - 可选参数。
  29354. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29355. * @param {Object} [options.headers] - 请求头。
  29356. * @extends {CommonServiceBase}
  29357. * @usage
  29358. */
  29359. class SpatialAnalystBase extends CommonServiceBase {
  29360. constructor(url, options) {
  29361. super(url, options);
  29362. /**
  29363. * @member {DataFormat} [SpatialAnalystBase.prototype.format=DataFormat.GEOJSON]
  29364. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  29365. */
  29366. this.format = options.format || DataFormat.GEOJSON;
  29367. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  29368. }
  29369. /**
  29370. * @function SpatialAnalystBase.prototype.destroy
  29371. * @override
  29372. */
  29373. destroy() {
  29374. super.destroy();
  29375. this.format = null;
  29376. }
  29377. /**
  29378. * @function SpatialAnalystBase.prototype.serviceProcessCompleted
  29379. * @description 分析完成,执行此方法。
  29380. * @param {Object} result - 服务器返回的结果对象。
  29381. */
  29382. serviceProcessCompleted(result, options) {
  29383. var me = this, analystResult;
  29384. result = Util_Util.transformResult(result);
  29385. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  29386. //批量分析时会返回多个结果
  29387. if (Util_Util.isArray(result)) {
  29388. for (var i = 0; i < result.length; i++) {
  29389. result[i] = me.toGeoJSONResult(result[i])
  29390. }
  29391. analystResult = result;
  29392. } else {
  29393. analystResult = me.toGeoJSONResult(result);
  29394. }
  29395. }
  29396. if (!analystResult) {
  29397. analystResult = result;
  29398. }
  29399. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  29400. }
  29401. /**
  29402. * @function SpatialAnalystBase.prototype.toGeoJSONResult
  29403. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29404. * @param {Object} result - 服务器返回的结果对象。
  29405. *
  29406. */
  29407. toGeoJSONResult(result) {
  29408. if (!result) {
  29409. return null;
  29410. }
  29411. //批量叠加分析时结果这样处理
  29412. if (result.result && result.result.resultGeometry) {
  29413. result = result.result
  29414. }
  29415. var geoJSONFormat = new GeoJSON();
  29416. if (result.recordsets) {
  29417. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  29418. if (recordsets[i].features) {
  29419. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  29420. }
  29421. }
  29422. } else if (result.recordset && result.recordset.features) {
  29423. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  29424. }
  29425. if (result.resultGeometry) {
  29426. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  29427. }
  29428. if (result.regions) {
  29429. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  29430. }
  29431. return result;
  29432. }
  29433. }
  29434. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  29435. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29436. * This program are made available under the terms of the Apache License, Version 2.0
  29437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29438. /**
  29439. * @class AreaSolarRadiationService
  29440. * @deprecatedclass SuperMap.AreaSolarRadiationService
  29441. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  29442. * @classdesc 地区太阳辐射服务类。
  29443. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  29444. * @param {Object} options - 参数。</br>
  29445. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29446. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29447. * @param {Object} [options.headers] - 请求头。
  29448. * @extends {SpatialAnalystBase}
  29449. * @example 例如:
  29450. * (start code)
  29451. * var myAreaSolarRadiationService = new AreaSolarRadiationService(url);
  29452. * myAreaSolarRadiationService.on({
  29453. * "processCompleted": processCompleted,
  29454. * "processFailed": processFailed
  29455. * }
  29456. * );
  29457. * (end)
  29458. * @usage
  29459. */
  29460. class AreaSolarRadiationService extends SpatialAnalystBase {
  29461. constructor(url, options) {
  29462. super(url, options);
  29463. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  29464. }
  29465. /**
  29466. * @function AreaSolarRadiationService.prototype.destroy
  29467. * @override
  29468. */
  29469. destroy() {
  29470. super.destroy();
  29471. }
  29472. /**
  29473. * @function AreaSolarRadiationService.prototype.processAsync
  29474. * @description 负责将客户端的查询参数传递到服务端。
  29475. * @param {AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  29476. */
  29477. processAsync(parameter) {
  29478. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  29479. return;
  29480. }
  29481. var me = this;
  29482. var parameterObject = {};
  29483. if (parameter instanceof AreaSolarRadiationParameters) {
  29484. me.url = Util_Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  29485. }
  29486. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  29487. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  29488. var jsonParameters = Util_Util.toJSON(parameterObject);
  29489. me.request({
  29490. method: 'POST',
  29491. data: jsonParameters,
  29492. scope: me,
  29493. success: me.serviceProcessCompleted,
  29494. failure: me.serviceProcessFailed
  29495. });
  29496. }
  29497. }
  29498. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  29499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29500. * This program are made available under the terms of the Apache License, Version 2.0
  29501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29502. /**
  29503. * @class BufferDistance
  29504. * @deprecatedclass SuperMap.BufferDistance
  29505. * @category iServer SpatialAnalyst BufferAnalyst
  29506. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  29507. * @param {Object} options - 可选参数。
  29508. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  29509. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  29510. * @usage
  29511. */
  29512. class BufferDistance {
  29513. constructor(options) {
  29514. /**
  29515. * @member {string} [BufferDistance.prototype.exp]
  29516. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  29517. */
  29518. this.exp = null;
  29519. /**
  29520. * @member {number} [BufferDistance.prototype.value=100]
  29521. * @description 以数值作为缓冲区分析的距离值。单位:米。
  29522. */
  29523. this.value = 100;
  29524. Util_Util.extend(this, options);
  29525. this.CLASS_NAME = "SuperMap.BufferDistance";
  29526. }
  29527. /**
  29528. * @function BufferDistance.prototype.destroy
  29529. * @description 释放资源,将引用资源的属性置空。
  29530. */
  29531. destroy() {
  29532. this.exp = null;
  29533. this.value = null;
  29534. }
  29535. }
  29536. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  29537. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29538. * This program are made available under the terms of the Apache License, Version 2.0
  29539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29540. /**
  29541. * @class BufferSetting
  29542. * @deprecatedclass SuperMap.BufferSetting
  29543. * @category iServer SpatialAnalyst BufferAnalyst
  29544. * @classdesc 缓冲区分析通用设置类。
  29545. * @param {Object} options - 可选参数。
  29546. * @param {BufferEndType} [options.endType=BufferEndType.FLAT] - 缓冲区端点枚举值。
  29547. * @param {BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  29548. * @param {BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  29549. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  29550. * @param {BufferRadiusUnit} [options.radiusUnit=BufferRadiusUnit.METER] - 缓冲半径单位。
  29551. * @usage
  29552. */
  29553. class BufferSetting {
  29554. constructor(options) {
  29555. /**
  29556. * @member {BufferEndType} [BufferSetting.prototype.endType = BufferEndType.FLAT]
  29557. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  29558. */
  29559. this.endType = BufferEndType.FLAT;
  29560. /**
  29561. * @member {BufferDistance} [BufferSetting.prototype.leftDistance=100]
  29562. * @description 左侧缓冲距离。
  29563. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  29564. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  29565. */
  29566. this.leftDistance = new BufferDistance();
  29567. /**
  29568. * @member {BufferDistance} [BufferSetting.prototype.rightDistance=100]
  29569. * @description 右侧缓冲距离。
  29570. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  29571. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting#radiusUnit}设置(默认全部为米)。
  29572. */
  29573. this.rightDistance = new BufferDistance();
  29574. /**
  29575. * @member {number} [BufferSetting.prototype.semicircleLineSegment=4]
  29576. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  29577. */
  29578. this.semicircleLineSegment = 4;
  29579. /**
  29580. * @member {BufferRadiusUnit} [BufferSetting.prototype.radiusUnit = BufferRadiusUnit.METER]
  29581. * @description 缓冲半径单位,可以是{@link BufferRadiusUnit.METER}、{@link BufferRadiusUnit.MILLIMETER}、
  29582. * {@link BufferRadiusUnit.CENTIMETER}、{@link BufferRadiusUnit.DECIMETER}、{@link BufferRadiusUnit.KILOMETER}、
  29583. * {@link BufferRadiusUnit.FOOT}、{@link BufferRadiusUnit.INCH}、{@link BufferRadiusUnit.MILE}、{@link BufferRadiusUnit.YARD}。
  29584. * 仅对BufferAnalyst有效。
  29585. */
  29586. this.radiusUnit = BufferRadiusUnit.METER;
  29587. if (options) {
  29588. Util_Util.extend(this, options);
  29589. }
  29590. this.CLASS_NAME = "SuperMap.BufferSetting";
  29591. }
  29592. /**
  29593. * @function BufferSetting.prototype.destroy
  29594. * @description 释放资源,将引用资源的属性置空。
  29595. */
  29596. destroy() {
  29597. let me = this;
  29598. me.endType = null;
  29599. if (me.leftDistance) {
  29600. me.leftDistance.destroy();
  29601. me.leftDistance = null;
  29602. }
  29603. if (me.rightDistance) {
  29604. me.rightDistance.destroy();
  29605. me.rightDistance = null;
  29606. }
  29607. me.semicircleLineSegment = null;
  29608. me.radiusUnit = null;
  29609. }
  29610. }
  29611. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  29612. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29613. * This program are made available under the terms of the Apache License, Version 2.0
  29614. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29615. /**
  29616. * @class BufferAnalystParameters
  29617. * @deprecatedclass SuperMap.BufferAnalystParameters
  29618. * @category iServer SpatialAnalyst BufferAnalyst
  29619. * @classdesc 缓冲区分析参数基类。
  29620. * @param {Object} options - 参数。
  29621. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  29622. * @usage
  29623. */
  29624. class BufferAnalystParameters {
  29625. constructor(options) {
  29626. var me = this;
  29627. /**
  29628. * @member {BufferSetting} [BufferAnalystParameters.prototype.bufferSetting]
  29629. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  29630. */
  29631. me.bufferSetting = new BufferSetting();
  29632. Util_Util.extend(this, options);
  29633. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  29634. }
  29635. /**
  29636. * @function BufferAnalystParameters.prototype.destroy
  29637. * @description 释放资源,将引用资源的属性置空。
  29638. */
  29639. destroy() {
  29640. var me = this;
  29641. if (me.bufferSetting) {
  29642. me.bufferSetting.destroy();
  29643. me.bufferSetting = null;
  29644. }
  29645. }
  29646. }
  29647. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  29648. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29649. * This program are made available under the terms of the Apache License, Version 2.0
  29650. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29651. /**
  29652. * @class DataReturnOption
  29653. * @deprecatedclass SuperMap.DataReturnOption
  29654. * @category iServer Data Dataset
  29655. * @classdesc 数据返回设置类。
  29656. * @param {Object} options - 参数。
  29657. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  29658. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link DataReturnMode.DATASET_ONLY}或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  29659. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  29660. * @param {DataReturnMode} [options.dataReturnMode=DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  29661. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29662. * @usage
  29663. */
  29664. class DataReturnOption {
  29665. constructor(options) {
  29666. /**
  29667. * @member {number} [DataReturnOption.prototype.expectCount=1000]
  29668. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  29669. */
  29670. this.expectCount = 1000;
  29671. /**
  29672. * @member {string} [DataReturnOption.prototype.dataset]
  29673. * @description 设置结果数据集标识,当dataReturnMode为 {@link DataReturnMode.DATASET_ONLY}
  29674. * 或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  29675. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  29676. */
  29677. this.dataset = null;
  29678. /**
  29679. * @member {DataReturnMode} [DataReturnOption.prototype.dataReturnMode=DataReturnMode.RECORDSET_ONLY]
  29680. * @description 数据返回模式。
  29681. */
  29682. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  29683. /**
  29684. * @member {boolean} [DataReturnOption.prototype.deleteExistResultDataset=true]
  29685. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29686. */
  29687. this.deleteExistResultDataset = true;
  29688. Util_Util.extend(this, options);
  29689. this.CLASS_NAME = "SuperMap.DataReturnOption";
  29690. }
  29691. /**
  29692. * @function DataReturnOption.prototype.destroy
  29693. * @description 释放资源,将引用资源的属性置空。
  29694. */
  29695. destroy() {
  29696. var me = this;
  29697. me.expectCount = null;
  29698. me.dataset = null;
  29699. me.dataReturnMode = null;
  29700. me.deleteExistResultDataset = null;
  29701. }
  29702. }
  29703. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  29704. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29705. * This program are made available under the terms of the Apache License, Version 2.0
  29706. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29707. /**
  29708. * @class FilterParameter
  29709. * @deprecatedclass SuperMap.FilterParameter
  29710. * @category iServer Data FeatureResults
  29711. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  29712. * @param {Object} options - 参数。
  29713. * @param {string} options.attributeFilter - 属性过滤条件。
  29714. * @param {string} options.name - 查询数据集名称或者图层名称。
  29715. * @param {Array.<JoinItem>} [options.joinItems] - 与外部表的连接信息 JoinItem 数组。
  29716. * @param {Array.<LinkItem>} [options.linkItems] - 与外部表的关联信息 LinkItem 数组。
  29717. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  29718. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  29719. * @param {string} [options.groupBy] - 查询分组条件的字段。
  29720. * @param {Array.<string>} [options.fields] - 查询字段数组。
  29721. * @usage
  29722. */
  29723. class FilterParameter {
  29724. constructor(options) {
  29725. /**
  29726. * @member {string} FilterParameter.prototype.attributeFilter
  29727. * @description 属性过滤条件。
  29728. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  29729. * attributeFilter 就是其中的“条件表达式”。
  29730. * 该字段的用法为 attributeFilter = "过滤条件"。
  29731. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  29732. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  29733. */
  29734. this.attributeFilter = null;
  29735. /**
  29736. * @member {string} FilterParameter.prototype.name
  29737. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  29738. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  29739. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  29740. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  29741. * 而不同的数据源中可能存在同名的数据集,
  29742. * 使用数据集名称不能唯一的确定数据集,
  29743. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  29744. */
  29745. this.name = null;
  29746. /**
  29747. * @member {Array.<JoinItem>} [FilterParameter.prototype.joinItems]
  29748. * @description 与外部表的连接信息 JoinItem 数组。
  29749. */
  29750. this.joinItems = null;
  29751. /**
  29752. * @member {Array.<LinkItem>} [FilterParameter.prototype.linkItems]
  29753. * @description 与外部表的关联信息 LinkItem 数组。
  29754. */
  29755. this.linkItems = null;
  29756. /**
  29757. * @member {Array.<string>} [FilterParameter.prototype.ids]
  29758. * @description 查询 id 数组,即属性表中的 SmID 值。
  29759. */
  29760. this.ids = null;
  29761. /**
  29762. * @member {string} [FilterParameter.prototype.orderBy]
  29763. * @description 查询排序的字段,orderBy的字段须为数值型的。
  29764. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  29765. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  29766. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  29767. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  29768. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  29769. * 分别表示国家的面积和1994年的各国人口数量。
  29770. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  29771. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  29772. */
  29773. this.orderBy = null;
  29774. /**
  29775. * @member {string} [FilterParameter.prototype.groupBy]
  29776. * @description 查询分组条件的字段。
  29777. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  29778. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  29779. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  29780. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  29781. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  29782. * 分别表示某个城市所属的洲和国家。
  29783. * 如果要按照国家对全球的城市进行分组,可以设置 groupBy = "Country";
  29784. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  29785. */
  29786. this.groupBy = null;
  29787. /**
  29788. * @member {Array.<string>} [FilterParameter.prototype.fields]
  29789. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  29790. */
  29791. this.fields = null;
  29792. if (options) {
  29793. Util_Util.extend(this, options);
  29794. }
  29795. this.CLASS_NAME = "SuperMap.FilterParameter";
  29796. }
  29797. /**
  29798. * @function FilterParameter.prototype.destroy
  29799. * @description 释放资源,将引用资源的属性置空。
  29800. */
  29801. destroy() {
  29802. var me = this;
  29803. me.attributeFilter = null;
  29804. me.name = null;
  29805. if (me.joinItems) {
  29806. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  29807. joinItems[i].destroy();
  29808. }
  29809. me.joinItems = null;
  29810. }
  29811. if (me.linkItems) {
  29812. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  29813. linkItems[i].destroy();
  29814. }
  29815. me.linkItems = null;
  29816. }
  29817. me.ids = null;
  29818. me.orderBy = null;
  29819. me.groupBy = null;
  29820. me.fields = null;
  29821. }
  29822. }
  29823. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  29824. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29825. * This program are made available under the terms of the Apache License, Version 2.0
  29826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29827. /**
  29828. * @class DatasetBufferAnalystParameters
  29829. * @deprecatedclass SuperMap.DatasetBufferAnalystParameters
  29830. * @category iServer SpatialAnalyst BufferAnalyst
  29831. * @classdesc 数据集缓冲区分析参数类。
  29832. * @param {Object} options - 参数。
  29833. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  29834. * @param {FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  29835. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  29836. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  29837. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  29838. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  29839. *
  29840. * @extends {BufferAnalystParameters}
  29841. * @usage
  29842. */
  29843. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  29844. constructor(options) {
  29845. super(options);
  29846. /**
  29847. * @member {string} DatasetBufferAnalystParameters.prototype.dataset
  29848. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  29849. */
  29850. this.dataset = null;
  29851. /**
  29852. * @member {FilterParameter} [DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  29853. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  29854. */
  29855. this.filterQueryParameter = new FilterParameter();
  29856. /**
  29857. * @member {DataReturnOption} [DatasetBufferAnalystParameters.prototype.resultSetting]
  29858. * @description 结果返回设置类。
  29859. */
  29860. this.resultSetting = new DataReturnOption();
  29861. /**
  29862. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  29863. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  29864. */
  29865. this.isAttributeRetained = true;
  29866. /**
  29867. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isUnion=false]
  29868. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  29869. */
  29870. this.isUnion = false;
  29871. Util_Util.extend(this, options);
  29872. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  29873. }
  29874. /**
  29875. * @function DatasetBufferAnalystParameters.prototype.destroy
  29876. * @override
  29877. */
  29878. destroy() {
  29879. super.destroy();
  29880. var me = this;
  29881. me.dataset = null;
  29882. if (me.filterQueryParameter) {
  29883. me.filterQueryParameter.destroy();
  29884. me.filterQueryParameter = null;
  29885. }
  29886. if (me.resultSetting) {
  29887. me.resultSetting.destroy();
  29888. me.resultSetting = null;
  29889. }
  29890. me.isAttributeRetained = null;
  29891. me.isUnion = null;
  29892. }
  29893. /**
  29894. * @function DatasetBufferAnalystParameters.toObject
  29895. * @param {DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  29896. * @param {DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  29897. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  29898. * @returns {Object} JSON 对象。
  29899. */
  29900. static toObject(datasetBufferAnalystParameters, tempObj) {
  29901. for (var name in datasetBufferAnalystParameters) {
  29902. if (name === "bufferSetting") {
  29903. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  29904. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  29905. } else if (name === "resultSetting") {
  29906. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  29907. } else if (name === "dataset") {
  29908. continue;
  29909. } else {
  29910. tempObj[name] = datasetBufferAnalystParameters[name];
  29911. }
  29912. }
  29913. }
  29914. }
  29915. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  29916. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29917. * This program are made available under the terms of the Apache License, Version 2.0
  29918. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29919. /**
  29920. * @class GeometryBufferAnalystParameters
  29921. * @deprecatedclass SuperMap.GeometryBufferAnalystParameters
  29922. * @category iServer SpatialAnalyst BufferAnalyst
  29923. * @classdesc 几何对象缓冲区分析参数类。
  29924. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  29925. * @param {Object} options - 参数。
  29926. * @param {GeoJSONObject} options.sourceGeometry - 要做缓冲区分析的几何对象。
  29927. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  29928. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  29929. * @extends {BufferAnalystParameters}
  29930. * @usage
  29931. */
  29932. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  29933. constructor(options) {
  29934. super(options);
  29935. /**
  29936. * @member {GeoJSONObject} GeometryBufferAnalystParameters.prototype.sourceGeometry
  29937. * @description 要做缓冲区分析的几何对象。<br>
  29938. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  29939. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  29940. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  29941. */
  29942. this.sourceGeometry = null;
  29943. /**
  29944. * @member {number} GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  29945. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  29946. */
  29947. this.sourceGeometrySRID = null;
  29948. if (options) {
  29949. Util_Util.extend(this, options);
  29950. }
  29951. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  29952. }
  29953. /**
  29954. * @function GeometryBufferAnalystParameters.prototype.destroy
  29955. * @override
  29956. */
  29957. destroy() {
  29958. super.destroy();
  29959. var me = this;
  29960. if (me.sourceGeometry) {
  29961. me.sourceGeometry.destroy();
  29962. me.sourceGeometry = null;
  29963. }
  29964. }
  29965. /**
  29966. * @function GeometryBufferAnalystParameters.toObject
  29967. * @param {GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  29968. * @param {GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  29969. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  29970. * @returns {Object} JSON 对象。
  29971. */
  29972. static toObject(geometryBufferAnalystParameters, tempObj) {
  29973. for (var name in geometryBufferAnalystParameters) {
  29974. if (name === "bufferSetting") {
  29975. var tempBufferSetting = {};
  29976. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  29977. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  29978. }
  29979. tempObj.analystParameter = tempBufferSetting;
  29980. } else if (name === "sourceGeometry") {
  29981. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  29982. } else {
  29983. tempObj[name] = geometryBufferAnalystParameters[name];
  29984. }
  29985. }
  29986. }
  29987. }
  29988. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  29989. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29990. * This program are made available under the terms of the Apache License, Version 2.0
  29991. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29992. /**
  29993. * @class BufferAnalystService
  29994. * @deprecatedclass SuperMap.BufferAnalystService
  29995. * @category iServer SpatialAnalyst BufferAnalyst
  29996. * @classdesc 缓冲区分析服务类。
  29997. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  29998. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  29999. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  30000. * @param {Object} options - 参数。
  30001. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30002. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30003. * @param {Object} [options.headers] - 请求头。
  30004. * @extends {SpatialAnalystBase}
  30005. * @example 例如:
  30006. * (start code)
  30007. * var myBufferAnalystService = new BufferAnalystService(url, {
  30008. * eventListeners: {
  30009. * "processCompleted": bufferCompleted,
  30010. * "processFailed": bufferFailed
  30011. * }
  30012. * });
  30013. * (end)
  30014. * @usage
  30015. */
  30016. class BufferAnalystService extends SpatialAnalystBase {
  30017. constructor(url, options) {
  30018. super(url, options);
  30019. /**
  30020. * @member {string} BufferAnalystService.prototype.mode
  30021. * @description 缓冲区分析类型
  30022. */
  30023. this.mode = null;
  30024. if (options) {
  30025. Util_Util.extend(this, options);
  30026. }
  30027. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  30028. }
  30029. /**
  30030. * @function BufferAnalystService.prototype.destroy
  30031. * @override
  30032. */
  30033. destroy() {
  30034. super.destroy();
  30035. this.mode = null;
  30036. }
  30037. /**
  30038. * @method BufferAnalystService.prototype.processAsync
  30039. * @description 负责将客户端的查询参数传递到服务端。
  30040. * @param {BufferAnalystParameters} parameter - 缓冲区分析参数
  30041. */
  30042. processAsync(parameter) {
  30043. var parameterObject = {};
  30044. var me = this;
  30045. if (parameter instanceof DatasetBufferAnalystParameters) {
  30046. me.mode = 'datasets';
  30047. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  30048. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  30049. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  30050. me.mode = 'geometry';
  30051. me.url = Util_Util.urlPathAppend(me.url, 'geometry/buffer');
  30052. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  30053. }
  30054. var jsonParameters = Util_Util.toJSON(parameterObject);
  30055. this.returnContent = true;
  30056. me.request({
  30057. method: "POST",
  30058. data: jsonParameters,
  30059. scope: me,
  30060. success: me.serviceProcessCompleted,
  30061. failure: me.serviceProcessFailed
  30062. });
  30063. }
  30064. dataFormat() {
  30065. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  30066. }
  30067. }
  30068. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  30069. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30070. * This program are made available under the terms of the Apache License, Version 2.0
  30071. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30072. // eslint-disable-line no-unused-vars
  30073. /**
  30074. * @class DatasourceConnectionInfo
  30075. * @deprecatedclass SuperMap.DatasourceConnectionInfo
  30076. * @category iServer Data Datasource
  30077. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  30078. * 当保存为工作空间时,工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  30079. * 所以在使用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  30080. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  30081. * @param {Object} options - 参数。
  30082. * @param {string} options.alias - 数据源别名。
  30083. * @param {string} options.dataBase - 数据源连接的数据库名。
  30084. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  30085. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  30086. * @param {EngineType} [options.engineType] - 数据源连接的引擎类型。
  30087. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  30088. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  30089. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  30090. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  30091. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  30092. * @param {string} [options.user] - 登录数据库的用户名。
  30093. * @usage
  30094. */
  30095. class DatasourceConnectionInfo {
  30096. constructor(options) {
  30097. /**
  30098. * @member {string} DatasourceConnectionInfo.prototype.alias
  30099. * @description 数据源别名。
  30100. */
  30101. this.alias = null;
  30102. /**
  30103. * @member {boolean} [DatasourceConnectionInfo.prototype.connect]
  30104. * @description 数据源是否自动连接数据。
  30105. */
  30106. this.connect = null;
  30107. /**
  30108. * @member {string} DatasourceConnectionInfo.prototype.dataBase
  30109. * @description 数据源连接的数据库名。
  30110. */
  30111. this.dataBase = null;
  30112. /**
  30113. * @member {string} [DatasourceConnectionInfo.prototype.driver]
  30114. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  30115. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  30116. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  30117. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  30118. */
  30119. this.driver = null;
  30120. /**
  30121. * @member {EngineType} [DatasourceConnectionInfo.prototype.engineType]
  30122. * @description 数据源连接的引擎类型。
  30123. */
  30124. this.engineType = null;
  30125. /**
  30126. * @member {boolean} [DatasourceConnectionInfo.prototype.exclusive]
  30127. * @description 是否以独占方式打开数据源。
  30128. */
  30129. this.exclusive = null;
  30130. /**
  30131. * @member {boolean} [DatasourceConnectionInfo.prototype.OpenLinkTable]
  30132. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  30133. */
  30134. this.OpenLinkTable = null;
  30135. /**
  30136. * @member {string} [DatasourceConnectionInfo.prototype.password]
  30137. * @description 登录数据源连接的数据库或文件的密码。
  30138. */
  30139. this.password = null;
  30140. /**
  30141. * @member {boolean} [DatasourceConnectionInfo.prototype.readOnly]
  30142. * @description 是否以只读方式打开数据源。
  30143. */
  30144. this.readOnly = null;
  30145. /**
  30146. * @member {string} [DatasourceConnectionInfo.prototype.server]
  30147. * @description 数据库服务器名、文件名或服务地址。
  30148. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  30149. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  30150. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  30151. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  30152. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  30153. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  30154. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  30155. * 8.对于 SuperMapCould 数据源,为其服务地址。
  30156. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  30157. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  30158. */
  30159. this.server = null;
  30160. /**
  30161. * @member {string} DatasourceConnectionInfo.prototype.user
  30162. * @description 登录数据库的用户名。
  30163. */
  30164. this.user = null;
  30165. if (options) {
  30166. Util_Util.extend(this, options);
  30167. }
  30168. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  30169. }
  30170. /**
  30171. * @function DatasourceConnectionInfo.prototype.destroy
  30172. * @description 释放资源,将引用资源的属性置空。
  30173. */
  30174. destroy() {
  30175. var me = this;
  30176. me.alias = null;
  30177. me.connect = null;
  30178. me.dataBase = null;
  30179. me.driver = null;
  30180. me.engineType = null;
  30181. me.exclusive = null;
  30182. me.OpenLinkTable = null;
  30183. me.password = null;
  30184. me.readOnly = null;
  30185. me.server = null;
  30186. me.user = null;
  30187. }
  30188. }
  30189. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  30190. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30191. * This program are made available under the terms of the Apache License, Version 2.0
  30192. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30193. /**
  30194. * @class OutputSetting
  30195. * @deprecatedclass SuperMap.OutputSetting
  30196. * @category iServer ProcessingService
  30197. * @classdesc 分布式分析输出类型设置类。
  30198. * @param {Object} options - 参数。
  30199. * @param {DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  30200. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  30201. * @param {OutputType} [options.type=OutputType.UDB] - 输出类型。
  30202. * @param {string} [options.outputPath] - 分析结果输出路径。
  30203. * @usage
  30204. */
  30205. class OutputSetting {
  30206. constructor(options) {
  30207. /**
  30208. * @member {OutputType} OutputSetting.prototype.type
  30209. * @description 分布式分析的输出类型。
  30210. */
  30211. this.type = OutputType.UDB;
  30212. /**
  30213. * @member {string} [OutputSetting.prototype.datasetName='analystResult']
  30214. * @description 分布式分析的输出结果数据集名称。
  30215. */
  30216. this.datasetName = "analystResult";
  30217. /**
  30218. * @member {DatasourceConnectionInfo} OutputSetting.prototype.datasourceInfo
  30219. * @description 分布式分析的输出结果数据源连接信息。
  30220. */
  30221. this.datasourceInfo = null;
  30222. /**
  30223. * @member {string} [OutputSetting.prototype.outputPath]
  30224. * @description 分布式分析的分析结果输出路径。
  30225. */
  30226. this.outputPath = "";
  30227. Util_Util.extend(this, options);
  30228. this.CLASS_NAME = "SuperMap.OutputSetting";
  30229. }
  30230. /**
  30231. * @function OutputSetting.prototype.destroy
  30232. * @description 释放资源,将引用资源的属性置空。
  30233. */
  30234. destroy() {
  30235. var me = this;
  30236. me.type = null;
  30237. me.datasetName = null;
  30238. me.outputPath = null;
  30239. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  30240. me.datasourceInfo.destroy();
  30241. me.datasourceInfo = null;
  30242. }
  30243. }
  30244. }
  30245. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  30246. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30247. * This program are made available under the terms of the Apache License, Version 2.0
  30248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30249. /**
  30250. * @class MappingParameters
  30251. * @deprecatedclass SuperMap.MappingParameters
  30252. * @category iServer ProcessingService
  30253. * @classdesc 分析后结果可视化的参数类。
  30254. * @param {Object} options - 参数。
  30255. * @param {Array.<ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  30256. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  30257. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 专题图分段模式。
  30258. * @param {number} [options.rangeCount] - 专题图分段个数。
  30259. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  30260. * @usage
  30261. */
  30262. class MappingParameters {
  30263. constructor(options) {
  30264. /**
  30265. * @member {Array.<ThemeGridRangeItem>} [MappingParameters.prototype.items]
  30266. * @description 栅格分段专题图子项数组。
  30267. */
  30268. this.items = null;
  30269. /**
  30270. * @member {number} [MappingParameters.prototype.numericPrecision=1]
  30271. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  30272. */
  30273. this.numericPrecision = 1;
  30274. /**
  30275. * @member {RangeMode} [MappingParameters.prototype.RangeMode=RangeMode.EQUALINTERVAL]
  30276. * @description 专题图分段模式。
  30277. */
  30278. this.rangeMode = RangeMode.EQUALINTERVAL;
  30279. /**
  30280. * @member {number} [MappingParameters.prototype.rangeCount]
  30281. * @description 专题图分段个数。
  30282. */
  30283. this.rangeCount = "";
  30284. /**
  30285. * @member {ColorGradientType} [MappingParameters.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  30286. * @description 专题图颜色渐变模式。
  30287. */
  30288. this.colorGradientType = ColorGradientType.YELLOW_RED;
  30289. Util_Util.extend(this, options);
  30290. this.CLASS_NAME = "SuperMap.MappingParameters";
  30291. }
  30292. /**
  30293. * @function MappingParameters.prototype.destroy
  30294. * @description 释放资源,将引用资源的属性置空。
  30295. */
  30296. destroy() {
  30297. var me = this;
  30298. if (me.items) {
  30299. if (me.items.length > 0) {
  30300. for (var item in me.items) {
  30301. me.items[item].destroy();
  30302. me.items[item] = null;
  30303. }
  30304. }
  30305. me.items = null;
  30306. }
  30307. me.numericPrecision = null;
  30308. me.rangeMode = null;
  30309. me.rangeCount = null;
  30310. me.colorGradientType = null;
  30311. }
  30312. }
  30313. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  30314. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30315. * This program are made available under the terms of the Apache License, Version 2.0
  30316. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30317. /**
  30318. * @class BuffersAnalystJobsParameter
  30319. * @deprecatedclass SuperMap.BuffersAnalystJobsParameter
  30320. * @category iServer ProcessingService BufferAnalyst
  30321. * @classdesc 缓冲区分析任务参数类。
  30322. * @param {Object} options - 参数。
  30323. * @param {string} options.datasetName - 数据集名。
  30324. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 分析范围(默认为全图范围)。
  30325. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  30326. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  30327. * @param {AnalystSizeUnit} [options.distanceUnit=AnalystSizeUnit.METER] - 缓冲距离单位单位。
  30328. * @param {OutputSetting} [options.output] - 输出参数设置。
  30329. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30330. * @usage
  30331. */
  30332. class BuffersAnalystJobsParameter {
  30333. constructor(options) {
  30334. /**
  30335. * @member {string} BuffersAnalystJobsParameter.prototype.datasetName
  30336. * @description 数据集名。
  30337. */
  30338. this.datasetName = '';
  30339. /**
  30340. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} BuffersAnalystJobsParameter.prototype.bounds
  30341. * @description 分析范围。
  30342. */
  30343. this.bounds = '';
  30344. /**
  30345. * @member {string} [BuffersAnalystJobsParameter.prototype.distance='15']
  30346. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段为空时,此参数有效。
  30347. */
  30348. this.distance = '';
  30349. /**
  30350. * @member {string} [BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  30351. * @description 缓冲距离字段。
  30352. */
  30353. this.distanceField = '';
  30354. /**
  30355. * @member {AnalystSizeUnit} [BuffersAnalystJobsParameter.prototype.distanceUnit=AnalystSizeUnit.METER]
  30356. * @description 缓冲距离单位。
  30357. */
  30358. this.distanceUnit = AnalystSizeUnit.METER;
  30359. /**
  30360. * @member {string} BuffersAnalystJobsParameter.prototype.dissolveField
  30361. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  30362. */
  30363. this.dissolveField = '';
  30364. /**
  30365. * @member {OutputSetting} [BuffersAnalystJobsParameter.prototype.output]
  30366. * @description 输出参数设置类。
  30367. */
  30368. this.output = null;
  30369. /**
  30370. * @member {MappingParameters} [BuffersAnalystJobsParameter.prototype.mappingParameters]
  30371. * @description 分析后结果可视化的参数类。
  30372. */
  30373. this.mappingParameters = null;
  30374. if (!options) {
  30375. return this;
  30376. }
  30377. Util_Util.extend(this, options);
  30378. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  30379. }
  30380. /**
  30381. * @function BuffersAnalystJobsParameter.prototype.destroy
  30382. * @description 释放资源,将引用资源的属性置空。
  30383. */
  30384. destroy() {
  30385. this.datasetName = null;
  30386. this.bounds = null;
  30387. this.distance = null;
  30388. this.distanceField = null;
  30389. this.distanceUnit = null;
  30390. this.dissolveField = null;
  30391. if (this.output instanceof OutputSetting) {
  30392. this.output.destroy();
  30393. this.output = null;
  30394. }
  30395. if (this.mappingParameters instanceof MappingParameters) {
  30396. this.mappingParameters.destroy();
  30397. this.mappingParameters = null;
  30398. }
  30399. }
  30400. /**
  30401. * @function BuffersAnalystJobsParameter.toObject
  30402. * @param {BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  30403. * @param {Object} tempObj - 目标对象。
  30404. * @description 生成缓冲区分析任务对象。
  30405. */
  30406. static toObject(BuffersAnalystJobsParameter, tempObj) {
  30407. for (var name in BuffersAnalystJobsParameter) {
  30408. if (name === 'datasetName') {
  30409. tempObj['input'] = tempObj['input'] || {};
  30410. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  30411. continue;
  30412. }
  30413. if (name === 'output') {
  30414. tempObj['output'] = tempObj['output'] || {};
  30415. tempObj['output'] = BuffersAnalystJobsParameter[name];
  30416. continue;
  30417. }
  30418. tempObj['analyst'] = tempObj['analyst'] || {};
  30419. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  30420. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  30421. } else {
  30422. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  30423. }
  30424. if (name === 'mappingParameters') {
  30425. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30426. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  30427. }
  30428. }
  30429. }
  30430. }
  30431. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  30432. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30433. * This program are made available under the terms of the Apache License, Version 2.0
  30434. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30435. /**
  30436. * @class ProcessingServiceBase
  30437. * @deprecatedclass SuperMap.ProcessingServiceBase
  30438. * @category iServer Core
  30439. * @classdesc 分布式分析服务基类
  30440. * @extends {CommonServiceBase}
  30441. * @param {string} url - 服务地址。
  30442. * @param {Object} options - 参数。
  30443. * @param {Events} options.events - 处理所有事件的对象。
  30444. * @param {number} options.index - 服务访问地址在数组中的位置。
  30445. * @param {number} options.length - 服务访问地址数组长度。
  30446. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  30447. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30448. * @param {Object} [options.headers] - 请求头。
  30449. * @usage
  30450. */
  30451. class ProcessingServiceBase extends CommonServiceBase {
  30452. constructor(url, options) {
  30453. options = options || {};
  30454. /*
  30455. * Constant: EVENT_TYPES
  30456. * {Array.<string>}
  30457. * 此类支持的事件类型
  30458. * - *processCompleted* 创建成功后触发的事件。
  30459. * - *processFailed* 创建失败后触发的事件 。
  30460. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  30461. */
  30462. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  30463. super(url, options);
  30464. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  30465. }
  30466. /**
  30467. * @function ProcessingServiceBase.prototype.destroy
  30468. * @override
  30469. */
  30470. destroy() {
  30471. super.destroy();
  30472. }
  30473. /**
  30474. * @function ProcessingServiceBase.prototype.getJobs
  30475. * @description 获取分布式分析任务。
  30476. * @param {string} url - 资源地址。
  30477. */
  30478. getJobs(url) {
  30479. var me = this;
  30480. FetchRequest.get(SecurityManager.appendCredential(url), null, {
  30481. proxy: me.proxy
  30482. }).then(function (response) {
  30483. return response.json();
  30484. }).then(function (result) {
  30485. me.events.triggerEvent("processCompleted", {
  30486. result: result
  30487. });
  30488. }).catch(function (e) {
  30489. me.eventListeners.processFailed({
  30490. error: e
  30491. });
  30492. });
  30493. }
  30494. /**
  30495. * @function ProcessingServiceBase.prototype.addJob
  30496. * @description 添加分布式分析任务。
  30497. * @param {string} url - 资源根地址。
  30498. * @param {Object} params - 创建一个空间分析的请求参数。
  30499. * @param {string} paramType - 请求参数类型。
  30500. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30501. */
  30502. addJob(url, params, paramType, seconds) {
  30503. var me = this,
  30504. parameterObject = null;
  30505. if (params && params instanceof paramType) {
  30506. parameterObject = new Object();
  30507. paramType.toObject(params, parameterObject);
  30508. }
  30509. let headers = Object.assign({
  30510. 'Content-Type': 'application/x-www-form-urlencoded'
  30511. }, me.headers || {})
  30512. var options = {
  30513. proxy: me.proxy,
  30514. headers,
  30515. withCredentials: me.withCredentials,
  30516. crossOrigin: me.crossOrigin,
  30517. isInTheSameDomain: me.isInTheSameDomain
  30518. };
  30519. FetchRequest.post(SecurityManager.appendCredential(url), JSON.stringify(parameterObject), options).then(function (response) {
  30520. return response.json();
  30521. }).then(function (result) {
  30522. if (result.succeed) {
  30523. me.serviceProcessCompleted(result, seconds);
  30524. } else {
  30525. me.serviceProcessFailed(result);
  30526. }
  30527. }).catch(function (e) {
  30528. me.serviceProcessFailed({
  30529. error: e
  30530. });
  30531. });
  30532. }
  30533. serviceProcessCompleted(result, seconds) {
  30534. result = Util_Util.transformResult(result);
  30535. seconds = seconds || 1000;
  30536. var me = this;
  30537. if (result) {
  30538. var id = setInterval(function () {
  30539. FetchRequest.get(SecurityManager.appendCredential(result.newResourceLocation), {
  30540. _t: new Date().getTime()
  30541. })
  30542. .then(function (response) {
  30543. return response.json();
  30544. }).then(function (job) {
  30545. me.events.triggerEvent("processRunning", {
  30546. id: job.id,
  30547. state: job.state
  30548. });
  30549. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  30550. clearInterval(id);
  30551. me.events.triggerEvent("processFailed", {
  30552. error: job.state.errorMsg,
  30553. state: job.state.runState
  30554. });
  30555. }
  30556. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  30557. clearInterval(id);
  30558. me.events.triggerEvent("processCompleted", {
  30559. result: job
  30560. });
  30561. }
  30562. }).catch(function (e) {
  30563. clearInterval(id);
  30564. me.events.triggerEvent("processFailed", {
  30565. error: e
  30566. });
  30567. });
  30568. }, seconds);
  30569. }
  30570. }
  30571. serviceProcessFailed(result) {
  30572. super.serviceProcessFailed(result);
  30573. }
  30574. }
  30575. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  30576. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30577. * This program are made available under the terms of the Apache License, Version 2.0
  30578. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30579. /**
  30580. * @class BuffersAnalystJobsService
  30581. * @deprecatedclass SuperMap.BuffersAnalystJobsService
  30582. * @category iServer ProcessingService BufferAnalyst
  30583. * @classdesc 缓冲区分析服务类。
  30584. * @extends {ProcessingServiceBase}
  30585. * @param {string} url - 服务地址。
  30586. * @param {Object} options - 参数。
  30587. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30588. * @param {Object} [options.headers] - 请求头。
  30589. * @usage
  30590. */
  30591. class BuffersAnalystJobsService extends ProcessingServiceBase {
  30592. constructor(url, options) {
  30593. super(url, options);
  30594. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  30595. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  30596. }
  30597. /**
  30598. *@override
  30599. */
  30600. destroy() {
  30601. super.destroy();
  30602. }
  30603. /**
  30604. * @function BuffersAnalystJobsService.prototype.getBufferJobs
  30605. * @description 获取缓冲区分析所有任务
  30606. */
  30607. getBuffersJobs() {
  30608. super.getJobs(this.url);
  30609. }
  30610. /**
  30611. * @function BuffersAnalystJobsService.prototype.getBufferJob
  30612. * @description 获取指定id的缓冲区分析服务
  30613. * @param {string} id - 指定要获取数据的id。
  30614. */
  30615. getBuffersJob(id) {
  30616. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  30617. }
  30618. /**
  30619. * @function BuffersAnalystJobsService.prototype.addBufferJob
  30620. * @description 新建缓冲区分析服务
  30621. * @param {BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  30622. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30623. */
  30624. addBuffersJob(params, seconds) {
  30625. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  30626. }
  30627. }
  30628. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  30629. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30630. * This program are made available under the terms of the Apache License, Version 2.0
  30631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30632. /**
  30633. * @class BurstPipelineAnalystParameters
  30634. * @deprecatedclass SuperMap.BurstPipelineAnalystParameters
  30635. * @category iServer NetworkAnalyst BurstAnalyse
  30636. * @classdesc 爆管分析参数类。
  30637. * @param {Object} options - 参数。
  30638. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  30639. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  30640. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  30641. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  30642. * @usage
  30643. */
  30644. class BurstPipelineAnalystParameters {
  30645. constructor(options) {
  30646. var me = this;
  30647. /**
  30648. * @member {Array.<number>} BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  30649. * @description 指定的设施点 ID 数组。
  30650. */
  30651. this.sourceNodeIDs = null;
  30652. /**
  30653. * @member {number} [BurstPipelineAnalystParameters.prototype.edgeID]
  30654. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  30655. */
  30656. this.edgeID = null;
  30657. /**
  30658. * @member {number} [BurstPipelineAnalystParameters.prototype.nodeID]
  30659. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  30660. */
  30661. this.nodeID = null;
  30662. /**
  30663. * @member {boolean} [BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  30664. * @description 指定不确定流向是否有效。
  30665. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  30666. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30667. */
  30668. this.isUncertainDirectionValid = false;
  30669. Util_Util.extend(me, options);
  30670. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  30671. }
  30672. /**
  30673. * @function BurstPipelineAnalystParameters.prototype.destroy
  30674. * @description 释放资源,将引用资源的属性置空。
  30675. */
  30676. destroy() {
  30677. var me = this;
  30678. me.sourceNodeIDs = null;
  30679. me.edgeID = null;
  30680. me.nodeID = null;
  30681. me.isUncertainDirectionValid = null;
  30682. }
  30683. }
  30684. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  30685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30686. * This program are made available under the terms of the Apache License, Version 2.0
  30687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30688. /**
  30689. * @class NetworkAnalystServiceBase
  30690. * @deprecatedclass SuperMap.NetworkAnalystServiceBase
  30691. * @category iServer Core
  30692. * @classdesc 网络分析服务基类。
  30693. * @extends {CommonServiceBase}
  30694. * @param {string} url - 服务地址。
  30695. * @param {Object} options - 可选参数。
  30696. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30697. * @param {Object} [options.headers] - 请求头。
  30698. * @usage
  30699. */
  30700. class NetworkAnalystServiceBase extends CommonServiceBase {
  30701. constructor(url, options) {
  30702. super(url, options);
  30703. /**
  30704. * @member {DataFormat} [NetworkAnalystServiceBase.prototype.format=DataFormat.GEOJSON]
  30705. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  30706. */
  30707. this.format = DataFormat.GEOJSON;
  30708. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  30709. }
  30710. /**
  30711. * @function NetworkAnalystServiceBase.prototype.destroy
  30712. * @description 释放资源,将引用的资源属性置空。
  30713. */
  30714. destroy() {
  30715. super.destroy();
  30716. this.format = null;
  30717. }
  30718. /**
  30719. * @function NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  30720. * @description 分析完成,执行此方法。
  30721. * @param {Object} result - 服务器返回的结果对象。
  30722. */
  30723. serviceProcessCompleted(result, options) {
  30724. var me = this, analystResult;
  30725. result = Util_Util.transformResult(result);
  30726. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  30727. analystResult = me.toGeoJSONResult(result);
  30728. }
  30729. if (!analystResult) {
  30730. analystResult = result;
  30731. }
  30732. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  30733. }
  30734. /**
  30735. * @function NetworkAnalystServiceBase.prototype.toGeoJSONResult
  30736. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  30737. * @param {Object} result - 服务器返回的结果对象。
  30738. * @returns {GeoJSONObject} GeoJSON 对象。
  30739. */
  30740. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  30741. return null;
  30742. }
  30743. }
  30744. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  30745. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30746. * This program are made available under the terms of the Apache License, Version 2.0
  30747. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30748. /**
  30749. * @class BurstPipelineAnalystService
  30750. * @deprecatedclass SuperMap.BurstPipelineAnalystService
  30751. * @category iServer NetworkAnalyst BurstAnalyse
  30752. * @classdesc 爆管分析服务类。即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  30753. * @extends {NetworkAnalystServiceBase}
  30754. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  30755. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  30756. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  30757. * @param {Object} options - 参数。
  30758. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30759. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30760. * @param {Object} [options.headers] - 请求头。
  30761. * @usage
  30762. */
  30763. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  30764. constructor(url, options) {
  30765. super(url, options);
  30766. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  30767. }
  30768. /**
  30769. * @function BurstPipelineAnalystService.prototype.destroy
  30770. * @override
  30771. */
  30772. destroy() {
  30773. super.destroy();
  30774. }
  30775. /**
  30776. * @function BurstPipelineAnalystService.prototype.processAsync
  30777. * @description 负责将客户端的查询参数传递到服务端。
  30778. * @params {BurstPipelineAnalystParameters} params - 爆管分析参数类
  30779. */
  30780. processAsync(params) {
  30781. if (!(params instanceof BurstPipelineAnalystParameters)) {
  30782. return null;
  30783. }
  30784. var me = this, jsonObject;
  30785. me.url = Util_Util.urlPathAppend(me.url, 'burstAnalyse');
  30786. jsonObject = {
  30787. sourceNodeIDs: params.sourceNodeIDs,
  30788. isUncertainDirectionValid: params.isUncertainDirectionValid
  30789. };
  30790. //必传参数不正确,就终止
  30791. if (params.edgeID !== null && params.nodeID !== null) {
  30792. throw new Error('edgeID and nodeID cannot be null at the same time.');
  30793. }
  30794. if (params.edgeID === null && params.nodeID === null) {
  30795. throw new Error('edgeID and nodeID cannot be null at the same time.');
  30796. }
  30797. if (params.edgeID !== null) {
  30798. jsonObject.edgeID = params.edgeID;
  30799. } else {
  30800. jsonObject.nodeID = params.nodeID;
  30801. }
  30802. me.request({
  30803. method: "GET",
  30804. params: jsonObject,
  30805. scope: me,
  30806. success: me.serviceProcessCompleted,
  30807. failure: me.serviceProcessFailed
  30808. });
  30809. }
  30810. }
  30811. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  30812. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30813. * This program are made available under the terms of the Apache License, Version 2.0
  30814. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30815. /**
  30816. * @class ChartFeatureInfoSpecsService
  30817. * @deprecatedclass SuperMap.ChartFeatureInfoSpecsService
  30818. * @category iServer Map Chart
  30819. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  30820. * 用户可以通过两种方式获取查询结果:
  30821. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  30822. * 另一种是使用 AsyncResponder 类实现异步处理。
  30823. * @extends {CommonServiceBase}
  30824. * @param {string} url - 地图(特指海图)服务地址。
  30825. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  30826. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  30827. * @param {Object} options - 参数。
  30828. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  30829. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  30830. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30831. * @param {Object} [options.headers] - 请求头。
  30832. * @usage
  30833. */
  30834. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  30835. constructor(url, options) {
  30836. super(url, options);
  30837. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  30838. }
  30839. /**
  30840. * @function ChartFeatureInfoSpecsService.prototype.destroy
  30841. * @override
  30842. */
  30843. destroy() {
  30844. super.destroy();
  30845. Util_Util.reset(this);
  30846. }
  30847. /**
  30848. * @function ChartFeatureInfoSpecsService.prototype.processAsync
  30849. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  30850. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  30851. * 事件。用可以通过户两种方式获取图层信息:
  30852. * 1. 通过 AsyncResponder 类获取(推荐使用);
  30853. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  30854. */
  30855. processAsync() {
  30856. var me = this, method = "GET";
  30857. if (!me.isTempLayers) {
  30858. Util_Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  30859. }
  30860. me.request({
  30861. method: method,
  30862. params: null,
  30863. scope: me,
  30864. success: me.serviceProcessCompleted,
  30865. failure: me.serviceProcessFailed
  30866. });
  30867. }
  30868. }
  30869. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  30870. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30871. * This program are made available under the terms of the Apache License, Version 2.0
  30872. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30873. /**
  30874. * @class ChartQueryFilterParameter
  30875. * @deprecatedclass SuperMap.ChartQueryFilterParameter
  30876. * @category iServer Map Chart
  30877. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  30878. * @param {Object} options - 参数。
  30879. * @param {string} options.attributeFilter - 属性字段过滤条件。
  30880. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  30881. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  30882. * @param {boolean} [options.isQueryLine] - 是否查询线。
  30883. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  30884. * @usage
  30885. */
  30886. class ChartQueryFilterParameter {
  30887. constructor(options) {
  30888. /**
  30889. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryPoint]
  30890. * @description 是否查询点。
  30891. */
  30892. this.isQueryPoint = null;
  30893. /**
  30894. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryLine]
  30895. * @description 是否查询线。
  30896. */
  30897. this.isQueryLine = null;
  30898. /**
  30899. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryRegion]
  30900. * @description 是否查询面。
  30901. */
  30902. this.isQueryRegion = null;
  30903. /**
  30904. * @member {string} ChartQueryFilterParameter.prototype.attributeFilter
  30905. * @description 属性字段过滤条件。
  30906. */
  30907. this.attributeFilter = null;
  30908. /**
  30909. * @member {number} ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  30910. * @description 查询的物标代号。
  30911. */
  30912. this.chartFeatureInfoSpecCode = null;
  30913. Util_Util.extend(this, options);
  30914. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  30915. }
  30916. /**
  30917. * @function ChartQueryFilterParameter.prototype.destroy
  30918. * @description 释放资源,将引用资源的属性置空。
  30919. */
  30920. destroy() {
  30921. var me = this;
  30922. me.isQueryPoint = null;
  30923. me.isQueryLine = null;
  30924. me.isQueryRegion = null;
  30925. me.attributeFilter = null;
  30926. me.chartFeatureInfoSpecCode = null;
  30927. }
  30928. /**
  30929. * @function ChartQueryFilterParameter.prototype.toJson
  30930. * @description 将属性信息转化成 JSON 格式字符串。
  30931. */
  30932. toJson() {
  30933. var json = "";
  30934. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  30935. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  30936. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  30937. if (this.attributeFilter) {
  30938. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  30939. }
  30940. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  30941. json = "{" + json + "}";
  30942. return json;
  30943. }
  30944. }
  30945. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  30946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30947. * This program are made available under the terms of the Apache License, Version 2.0
  30948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30949. /**
  30950. * @class ChartQueryParameters
  30951. * @deprecatedclass SuperMap.ChartQueryParameters
  30952. * @category iServer Map Chart
  30953. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  30954. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  30955. * @param {Object} options - 参数。
  30956. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  30957. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  30958. * @param {Array.<ChartQueryFilterParameter>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  30959. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 海图查询范围。当进行海图范围查询时,此为必选参数。
  30960. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  30961. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  30962. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  30963. * @usage
  30964. */
  30965. class ChartQueryParameters {
  30966. constructor(options) {
  30967. /**
  30968. * @member {string} ChartQueryParameters.prototype.queryMode
  30969. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  30970. */
  30971. this.queryMode = null;
  30972. /**
  30973. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} ChartQueryParameters.prototype.bounds
  30974. * @description 海图查询范围。
  30975. */
  30976. this.bounds = null;
  30977. /**
  30978. * @member {Array.<string>} ChartQueryParameters.prototype.chartLayerNames
  30979. * @description 查询的海图图层的名称。
  30980. */
  30981. this.chartLayerNames = null;
  30982. /**
  30983. * @member {Array.<ChartQueryFilterParameter>} ChartQueryParameters.prototype.chartQueryFilterParameters
  30984. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  30985. */
  30986. this.chartQueryFilterParameters = null;
  30987. /**
  30988. * @member {boolean} [ChartQueryParameters.prototype.returnContent=true]
  30989. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  30990. */
  30991. this.returnContent = true;
  30992. /**
  30993. * @member {number} [ChartQueryParameters.prototype.startRecord=0]
  30994. * @description 查询起始记录位置。
  30995. */
  30996. this.startRecord = 0;
  30997. /**
  30998. * @member {number} [ChartQueryParameters.prototype.expectCount]
  30999. * @description 期望查询结果返回的记录数,该值大于0。
  31000. */
  31001. this.expectCount = null;
  31002. Util_Util.extend(this, options);
  31003. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  31004. }
  31005. /**
  31006. * @function ChartQueryParameters.prototype.destroy
  31007. * @description 释放资源,将引用资源的属性置空。
  31008. */
  31009. destroy() {
  31010. var me = this;
  31011. me.queryMode = null;
  31012. me.bounds = null;
  31013. me.chartLayerNames = null;
  31014. me.chartQueryFilterParameters = null;
  31015. me.returnContent = true;
  31016. me.startRecord = 0;
  31017. me.expectCount = null;
  31018. }
  31019. /**
  31020. * @function ChartQueryParameters.prototype.getVariablesJson
  31021. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  31022. * @returns {string} JSON 字符串。
  31023. */
  31024. getVariablesJson() {
  31025. var json = "";
  31026. json += "\"queryMode\":\"" + this.queryMode + "\",";
  31027. if (this.chartLayerNames && this.chartLayerNames.length) {
  31028. var chartLayersArray = [];
  31029. var layerLength = this.chartLayerNames.length;
  31030. for (var i = 0; i < layerLength; i++) {
  31031. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  31032. }
  31033. var layerNames = "[" + chartLayersArray.join(",") + "]";
  31034. json += "\"chartLayerNames\":" + layerNames + ",";
  31035. }
  31036. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  31037. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  31038. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  31039. "\"y\":" + this.bounds.top + "}" + "},";
  31040. }
  31041. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  31042. var chartParamArray = [];
  31043. var chartLength = this.chartQueryFilterParameters.length;
  31044. for (var j = 0; j < chartLength; j++) {
  31045. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  31046. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  31047. continue;
  31048. }
  31049. chartParamArray.push(chartQueryFilterParameter.toJson());
  31050. }
  31051. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  31052. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  31053. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  31054. chartParamsJson += "\"expectCount\":" + this.expectCount;
  31055. chartParamsJson = "{" + chartParamsJson + "}";
  31056. json += "\"chartQueryParameters\":" + chartParamsJson;
  31057. }
  31058. json = "{" + json + "}";
  31059. return json;
  31060. }
  31061. }
  31062. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  31063. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31064. * This program are made available under the terms of the Apache License, Version 2.0
  31065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31066. /**
  31067. * @class QueryParameters
  31068. * @deprecatedclass SuperMap.QueryParameters
  31069. * @category iServer Map QueryResults
  31070. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  31071. * @param {Object} options - 参数。
  31072. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  31073. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  31074. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  31075. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  31076. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  31077. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  31078. * @param {number} [options.startRecord=0] - 查询起始记录号。
  31079. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  31080. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  31081. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  31082. * @usage
  31083. */
  31084. class QueryParameters {
  31085. constructor(options) {
  31086. if (!options) {
  31087. return;
  31088. }
  31089. /**
  31090. * @member {string} [QueryParameters.prototype.customParams]
  31091. * @description 自定义参数,供扩展使用。
  31092. */
  31093. this.customParams = null;
  31094. /**
  31095. * @member {Object} [QueryParameters.prototype.prjCoordSys]
  31096. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  31097. */
  31098. this.prjCoordSys = null;
  31099. /**
  31100. * @member {number} [QueryParameters.prototype.expectCount=100000]
  31101. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  31102. * 如果实际不足100000条则返回实际记录条数。
  31103. */
  31104. this.expectCount = 100000;
  31105. /**
  31106. * @member {GeometryType} [QueryParameters.prototype.networkType=GeometryType.LINE]
  31107. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  31108. */
  31109. this.networkType = REST_GeometryType.LINE;
  31110. /**
  31111. * @member {QueryOption} [QueryParameters.prototype.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY]
  31112. * @description 查询结果类型枚举类。
  31113. * 该类描述查询结果返回类型,包括只返回属性、
  31114. * 只返回几何实体以及返回属性和几何实体。
  31115. */
  31116. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  31117. /**
  31118. * @member {Array.<FilterParameter>} QueryParameters.prototype.queryParams
  31119. * @description 查询过滤条件参数数组。
  31120. * 该类用于设置查询数据集的查询过滤参数。
  31121. */
  31122. this.queryParams = null;
  31123. /**
  31124. * @member {number} [QueryParameters.prototype.startRecord=0]
  31125. * @description 查询起始记录号。
  31126. */
  31127. this.startRecord = 0;
  31128. /**
  31129. * @member {number} [QueryParameters.prototype.holdTime=10]
  31130. * @description 资源在服务端保存的时间,单位为分钟。
  31131. */
  31132. this.holdTime = 10;
  31133. /**
  31134. * @member {boolean} [QueryParameters.prototype.returnCustomResult=false]
  31135. * @description 仅供三维使用。
  31136. */
  31137. this.returnCustomResult = false;
  31138. /**
  31139. * @member {boolean} [QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  31140. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  31141. */
  31142. this.returnFeatureWithFieldCaption = false;
  31143. Util_Util.extend(this, options);
  31144. this.CLASS_NAME = "SuperMap.QueryParameters";
  31145. }
  31146. /**
  31147. * @function QueryParameters.prototype.destroy
  31148. * @description 释放资源,将引用资源的属性置空。
  31149. */
  31150. destroy() {
  31151. var me = this;
  31152. me.customParams = null;
  31153. me.expectCount = null;
  31154. me.networkType = null;
  31155. me.queryOption = null;
  31156. if (me.queryParams) {
  31157. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  31158. qps[i].destroy();
  31159. }
  31160. me.queryParams = null;
  31161. }
  31162. me.startRecord = null;
  31163. me.holdTime = null;
  31164. me.returnCustomResult = null;
  31165. me.prjCoordSys = null;
  31166. }
  31167. }
  31168. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  31169. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31170. * This program are made available under the terms of the Apache License, Version 2.0
  31171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31172. /**
  31173. * @class ChartQueryService
  31174. * @deprecatedclass SuperMap.ChartQueryService
  31175. * @category iServer Map Chart
  31176. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  31177. * 用户可以通过两种方式获取查询结果:
  31178. * 1.通过 AsyncResponder 类获取(推荐使用);
  31179. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  31180. * @extends {CommonServiceBase}
  31181. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  31182. * @param {Object} options - 参数。
  31183. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  31184. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  31185. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31186. * @param {Object} [options.headers] - 请求头。
  31187. * @example
  31188. * 下面示例显示了如何进行海图属性查询:
  31189. * var nameArray = ["GB4X0000_52000"];
  31190. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  31191. * isQueryPoint:true,
  31192. * isQueryLine:true,
  31193. * isQueryRegion:true,
  31194. * attributeFilter:"SmID<10",
  31195. * chartFeatureInfoSpecCode:1
  31196. * });
  31197. *
  31198. * var chartQueryParameters = new ChartQueryParameters({
  31199. * queryMode:"ChartAttributeQuery",
  31200. * chartLayerNames:nameArray,
  31201. * returnContent:true,
  31202. * chartQueryFilterParameters:[chartQueryFilterParameter]
  31203. * });
  31204. *
  31205. * var chartQueryService = new ChartQueryService(url);
  31206. *
  31207. * chartQueryService.events.on({
  31208. * "processCompleted":processCompleted,
  31209. * "processFailed":processFailed
  31210. * });
  31211. * chartQueryService.processAsync(chartQueryParameters);
  31212. * @usage
  31213. */
  31214. class ChartQueryService extends CommonServiceBase {
  31215. constructor(url, options) {
  31216. super(url, options);
  31217. options = options || {};
  31218. /**
  31219. * @member {boolean} ChartQueryService.prototype.returnContent
  31220. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  31221. */
  31222. this.returnContent = null;
  31223. /**
  31224. * @member {DataFormat} ChartQueryService.prototype.format
  31225. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  31226. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  31227. */
  31228. this.format = DataFormat.GEOJSON;
  31229. Util_Util.extend(this, options);
  31230. var me = this;
  31231. if (options.format) {
  31232. me.format = options.format.toUpperCase();
  31233. }
  31234. if (!me.url) {
  31235. return;
  31236. }
  31237. me.url = Util_Util.urlPathAppend(me.url, 'queryResults');
  31238. this.CLASS_NAME = "SuperMap.ChartQueryService";
  31239. }
  31240. /**
  31241. * @function ChartQueryService.prototype.destroy
  31242. * @override
  31243. */
  31244. destroy() {
  31245. var me = this;
  31246. CommonServiceBase.prototype.destroy.apply(this, arguments);
  31247. me.returnContent = null;
  31248. me.format = null;
  31249. }
  31250. /**
  31251. * @function ChartQueryService.prototype.processAsync
  31252. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  31253. * @param {ChartQueryParameters} params - 查询参数。
  31254. */
  31255. processAsync(params) {
  31256. //todo重点需要添加代码的地方
  31257. if (!(params instanceof ChartQueryParameters)) {
  31258. return;
  31259. }
  31260. var me = this, jsonParameters;
  31261. me.returnContent = params.returnContent;
  31262. jsonParameters = params.getVariablesJson();
  31263. if (me.returnContent) {
  31264. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  31265. }
  31266. me.request({
  31267. method: "POST",
  31268. data: jsonParameters,
  31269. scope: me,
  31270. success: me.serviceProcessCompleted,
  31271. failure: me.serviceProcessFailed
  31272. });
  31273. }
  31274. /**
  31275. * @function ChartQueryService.prototype.serviceProcessCompleted
  31276. * @description 查询完成,执行此方法。
  31277. * @param {Object} result - 服务器返回的结果对象。
  31278. */
  31279. serviceProcessCompleted(result, options) {
  31280. var me = this;
  31281. result = Util_Util.transformResult(result);
  31282. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  31283. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  31284. if (recordsets[i].features) {
  31285. var geoJSONFormat = new GeoJSON();
  31286. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  31287. }
  31288. }
  31289. }
  31290. me.events.triggerEvent("processCompleted", {result: result, options});
  31291. }
  31292. /**
  31293. * @function ChartQueryService.prototype.getQueryParameters
  31294. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  31295. * @param {Object} params - JSON 字符串表示的查询参数。
  31296. * @returns {QueryParameters} 返回查询结果
  31297. */
  31298. getQueryParameters(params) {
  31299. return new QueryParameters({
  31300. queryMode: params.queryMode,
  31301. bounds: params.bounds,
  31302. chartLayerNames: params.chartLayerNames,
  31303. chartQueryFilterParameters: params.chartQueryFilterParameters,
  31304. returnContent: params.returnContent
  31305. });
  31306. }
  31307. }
  31308. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  31309. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31310. * This program are made available under the terms of the Apache License, Version 2.0
  31311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31312. /**
  31313. * @class ClipParameter
  31314. * @deprecatedclass SuperMap.ClipParameter
  31315. * @category iServer SpatialAnalyst InterpolationAnalyst
  31316. * @classdesc 用于裁剪的参数。优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  31317. * @param {Object} options - 可选参数。
  31318. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  31319. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  31320. * @param {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} [options.clipRegion] - 用户指定的裁剪区域。
  31321. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  31322. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  31323. * @usage
  31324. */
  31325. class ClipParameter {
  31326. constructor(options) {
  31327. /**
  31328. * @member {string} ClipParameter.prototype.clipDatasetName
  31329. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  31330. */
  31331. this.clipDatasetName = null;
  31332. /**
  31333. * @member {string} ClipParameter.prototype.clipDatasourceName
  31334. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  31335. */
  31336. this.clipDatasourceName = null;
  31337. /**
  31338. * @member {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} ClipParameter.prototype.clipRegion
  31339. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  31340. */
  31341. this.clipRegion = null;
  31342. /**
  31343. * @member {boolean} [ClipParameter.prototype.isClipInRegion=true]
  31344. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  31345. */
  31346. this.isClipInRegion = true;
  31347. /**
  31348. * @member {boolean} [ClipParameter.prototype.isExactClip=true]
  31349. * @description 是否使用精确裁剪。
  31350. */
  31351. this.isExactClip = null;
  31352. if (options) {
  31353. Util_Util.extend(this, options);
  31354. }
  31355. this.CLASS_NAME = "SuperMap.ClipParameter";
  31356. }
  31357. /**
  31358. * @function ClipParameter.prototype.destroy
  31359. * @description 释放资源,将引用资源的属性置空。
  31360. */
  31361. destroy() {
  31362. var me = this;
  31363. me.clipDatasetName = null;
  31364. me.clipDatasourceName = null;
  31365. me.clipRegion = null;
  31366. me.isClipInRegion = null;
  31367. me.isExactClip = null;
  31368. }
  31369. /**
  31370. * @function ClipParameter.prototype.toJSON
  31371. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  31372. * @returns {string} 返回转换后的 JSON 字符串。
  31373. */
  31374. toJSON() {
  31375. return Util_Util.toJSON({
  31376. isClipInRegion: this.isClipInRegion,
  31377. clipDatasetName: this.clipDatasetName,
  31378. clipDatasourceName: this.clipDatasourceName,
  31379. isExactClip: this.isExactClip,
  31380. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  31381. });
  31382. }
  31383. }
  31384. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  31385. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31386. * This program are made available under the terms of the Apache License, Version 2.0
  31387. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31388. /**
  31389. * @class ColorDictionary
  31390. * @deprecatedclass SuperMap.ColorDictionary
  31391. * @category iServer Map Theme
  31392. * @classdesc 颜色对照表类。颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。
  31393. * 对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,
  31394. * 对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,
  31395. * 对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,
  31396. * 然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  31397. * @param {Object} options - 参数。
  31398. * @param {number} options.elevation - 高程值。
  31399. * @param {ServerColor} options.color - 服务端颜色类。
  31400. * @usage
  31401. */
  31402. class ColorDictionary {
  31403. constructor(options) {
  31404. options = options || {};
  31405. /**
  31406. * @member {number} ColorDictionary.prototype.elevation
  31407. * @description 高程值。
  31408. */
  31409. this.elevation = null;
  31410. /**
  31411. * @member {ServerColor} ColorDictionary.prototype.color
  31412. * @description 服务端颜色类。
  31413. */
  31414. this.color = null;
  31415. Util_Util.extend(this, options);
  31416. var me = this,
  31417. c = me.color;
  31418. if (c) {
  31419. me.color = new ServerColor(c.red, c.green, c.blue);
  31420. }
  31421. this.CLASS_NAME = "SuperMap.ColorDictionary";
  31422. }
  31423. /**
  31424. * @function ColorDictionary.prototype.destroy
  31425. * @description 释放资源,将引用资源的属性置空。
  31426. */
  31427. destroy() {
  31428. Util_Util.reset(this);
  31429. }
  31430. /**
  31431. * @function ColorDictionary.prototype.toServerJSONObject
  31432. * @description 转换成对应的 JSON 格式对象。
  31433. * @returns {Object} JSON 对象。
  31434. */
  31435. toServerJSONObject() {
  31436. var dataObj = {};
  31437. dataObj = Util_Util.copyAttributes(dataObj, this);
  31438. return dataObj;
  31439. }
  31440. }
  31441. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  31442. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31443. * This program are made available under the terms of the Apache License, Version 2.0
  31444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31445. /**
  31446. * @class TransportationAnalystResultSetting
  31447. * @deprecatedclass SuperMap.TransportationAnalystResultSetting
  31448. * @category iServer NetworkAnalyst
  31449. * @classdesc 交通网络分析结果参数类。通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  31450. * @param {Object} options - 可选参数。
  31451. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  31452. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  31453. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  31454. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  31455. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  31456. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  31457. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  31458. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  31459. * @usage
  31460. */
  31461. class TransportationAnalystResultSetting {
  31462. constructor(options) {
  31463. if (!options) {
  31464. return;
  31465. }
  31466. /**
  31467. * @member {boolean} TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  31468. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  31469. */
  31470. this.returnEdgeFeatures = false;
  31471. /**
  31472. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  31473. * @description 返回的弧段要素集合中是否包含几何对象信息。
  31474. */
  31475. this.returnEdgeGeometry = false;
  31476. /**
  31477. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  31478. * @description 返回结果中是否包含经过弧段 ID 集合。
  31479. */
  31480. this.returnEdgeIDs = false;
  31481. /**
  31482. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  31483. * @description 是否在分析结果中包含结点要素集合。
  31484. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  31485. */
  31486. this.returnNodeFeatures = false;
  31487. /**
  31488. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  31489. * @description 返回的结点要素集合中是否包含几何对象信息。
  31490. */
  31491. this.returnNodeGeometry = false;
  31492. /**
  31493. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  31494. * @description 返回结果中是否包含经过结点 ID 集合。
  31495. */
  31496. this.returnNodeIDs = false;
  31497. /**
  31498. * @member {boolean} TransportationAnalystResultSetting.prototype.returnPathGuides
  31499. * @description 返回分析结果中是否包含行驶导引集合。
  31500. */
  31501. this.returnPathGuides = false;
  31502. /**
  31503. * @member {boolean} TransportationAnalystResultSetting.prototype.returnRoutes
  31504. * @description 返回分析结果中是否包含路由对象的集合。
  31505. */
  31506. this.returnRoutes = false;
  31507. Util_Util.extend(this, options);
  31508. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  31509. }
  31510. /**
  31511. * @function TransportationAnalystResultSetting.prototype.destroy
  31512. * @description 释放资源,将引用资源的属性置空。
  31513. */
  31514. destroy() {
  31515. var me = this;
  31516. me.returnEdgeFeatures = null;
  31517. me.returnEdgeGeometry = null;
  31518. me.returnEdgeIDs = null;
  31519. me.returnNodeFeatures = null;
  31520. me.returnNodeGeometry = null;
  31521. me.returnNodeIDs = null;
  31522. me.returnPathGuides = null;
  31523. me.returnRoutes = null;
  31524. }
  31525. }
  31526. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  31527. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31528. * This program are made available under the terms of the Apache License, Version 2.0
  31529. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31530. /**
  31531. * @class TransportationAnalystParameter
  31532. * @deprecatedclass SuperMap.TransportationAnalystParameter
  31533. * @category iServer NetworkAnalyst
  31534. * @classdesc 交通网络分析通用参数类。该类主要用来提供交通网络分析所需的通用参数。
  31535. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  31536. * @param {Object} options - 参数。
  31537. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  31538. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  31539. * @param {string} options.turnWeightField - 转向权重字段的名称。
  31540. * @param {TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  31541. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  31542. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  31543. * @usage
  31544. */
  31545. class TransportationAnalystParameter {
  31546. constructor(options) {
  31547. if (!options) {
  31548. return;
  31549. }
  31550. /**
  31551. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierEdgeIDs
  31552. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  31553. */
  31554. this.barrierEdgeIDs = null;
  31555. /**
  31556. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierNodeIDs
  31557. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  31558. */
  31559. this.barrierNodeIDs = null;
  31560. /**
  31561. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} TransportationAnalystParameter.prototype.barrierPoints
  31562. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  31563. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  31564. */
  31565. this.barrierPoints = null;
  31566. /**
  31567. * @member {string} [TransportationAnalystParameter.prototype.weightFieldName]
  31568. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  31569. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  31570. */
  31571. this.weightFieldName = null;
  31572. /**
  31573. * @member {string} TransportationAnalystParameter.prototype.turnWeightField
  31574. * @description 转向权重字段的名称。
  31575. */
  31576. this.turnWeightField = null;
  31577. /**
  31578. * @member {TransportationAnalystResultSetting} TransportationAnalystParameter.prototype.resultSetting
  31579. * @description 分析结果返回内容。
  31580. */
  31581. this.resultSetting = new TransportationAnalystResultSetting();
  31582. Util_Util.extend(this, options);
  31583. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  31584. }
  31585. /**
  31586. * @function TransportationAnalystParameter.prototype.destroy
  31587. * @description 释放资源,将引用资源的属性置空。
  31588. */
  31589. destroy() {
  31590. var me = this;
  31591. me.barrierEdgeIDs = null;
  31592. me.barrierNodeIDs = null;
  31593. me.weightFieldName = null;
  31594. me.turnWeightField = null;
  31595. if (me.resultSetting) {
  31596. me.resultSetting.destroy();
  31597. me.resultSetting = null;
  31598. }
  31599. if (me.barrierPoints && me.barrierPoints.length) {
  31600. for (var i in me.barrierPoints) {
  31601. me.barrierPoints[i].destroy();
  31602. }
  31603. }
  31604. me.barrierPoints = null;
  31605. }
  31606. }
  31607. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  31608. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31609. * This program are made available under the terms of the Apache License, Version 2.0
  31610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31611. /**
  31612. * @class ComputeWeightMatrixParameters
  31613. * @deprecatedclass SuperMap.ComputeWeightMatrixParameters
  31614. * @category iServer NetworkAnalyst WeightMatrix
  31615. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  31616. * @param {Object} options - 参数。
  31617. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  31618. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.nodes - 要计算耗费矩阵的点数组。
  31619. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  31620. * @usage
  31621. */
  31622. class ComputeWeightMatrixParameters {
  31623. constructor(options) {
  31624. /**
  31625. * @member {boolean} [ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  31626. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  31627. */
  31628. this.isAnalyzeById = false;
  31629. /**
  31630. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} ComputeWeightMatrixParameters.prototype.nodes
  31631. * @description 要计算耗费矩阵的点数组。
  31632. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  31633. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  31634. */
  31635. this.nodes = null;
  31636. /**
  31637. * @member {TransportationAnalystParameter} ComputeWeightMatrixParameters.prototype.parameter
  31638. * @description 交通网络分析通用参数。
  31639. */
  31640. this.parameter = new TransportationAnalystParameter();
  31641. Util_Util.extend(this, options);
  31642. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  31643. }
  31644. /**
  31645. * @function ComputeWeightMatrixParameters.prototype.destroy
  31646. * @description 释放资源,将引用资源的属性置空。
  31647. */
  31648. destroy() {
  31649. var me = this;
  31650. me.isAnalyzeById = null;
  31651. me.nodes = null;
  31652. if (me.parameter) {
  31653. me.parameter.destroy();
  31654. me.parameter = null;
  31655. }
  31656. }
  31657. }
  31658. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  31659. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31660. * This program are made available under the terms of the Apache License, Version 2.0
  31661. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31662. /**
  31663. * @class ComputeWeightMatrixService
  31664. * @deprecatedclass SuperMap.ComputeWeightMatrixService
  31665. * @category iServer NetworkAnalyst WeightMatrix
  31666. * @classdesc 耗费矩阵分析服务类。
  31667. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  31668. * 用来存储指定的任意两点间的资源消耗。
  31669. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  31670. * @extends {NetworkAnalystServiceBase}
  31671. * @example
  31672. * var mycomputeWeightMatrixService = new ComputeWeightMatrixService(url,{
  31673. * eventListeners: {
  31674. * "processCompleted": computeWeightMatrixCompleted,
  31675. * "processFailed": computeWeightMatrixnError
  31676. * }
  31677. * });
  31678. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  31679. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  31680. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  31681. * @param {Object} options - 参数。
  31682. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31683. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31684. * @param {Object} [options.headers] - 请求头。
  31685. * @usage
  31686. */
  31687. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  31688. constructor(url, options) {
  31689. super(url, options);
  31690. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  31691. }
  31692. /**
  31693. * @function ComputeWeightMatrixService.prototype.destroy
  31694. * @override
  31695. */
  31696. destroy() {
  31697. super.destroy();
  31698. }
  31699. /**
  31700. * @function ComputeWeightMatrixService.prototype.processAsync
  31701. * @description 负责将客户端的查询参数传递到服务端。
  31702. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  31703. */
  31704. processAsync(params) {
  31705. if (!(params instanceof ComputeWeightMatrixParameters)) {
  31706. return;
  31707. }
  31708. var me = this,
  31709. jsonObject;
  31710. me.url = Util_Util.urlPathAppend(me.url, 'weightmatrix');
  31711. jsonObject = {
  31712. parameter: Util_Util.toJSON(params.parameter),
  31713. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  31714. };
  31715. me.request({
  31716. method: "GET",
  31717. params: jsonObject,
  31718. scope: me,
  31719. success: me.serviceProcessCompleted,
  31720. failure: me.serviceProcessFailed
  31721. });
  31722. }
  31723. /**
  31724. * @function ComputeWeightMatrixService.prototype.getJson
  31725. * @description 将对象转化为JSON字符串。
  31726. * @param {boolean} isAnalyzeById - 是否通过id分析
  31727. * @param {Array.<ComputeWeightMatrixParameters>} params - 分析参数数组
  31728. * @returns {string} 转化后的JSON字符串。
  31729. */
  31730. getJson(isAnalyzeById, params) {
  31731. var jsonString = "[",
  31732. len = params ? params.length : 0;
  31733. if (isAnalyzeById === false) {
  31734. for (let i = 0; i < len; i++) {
  31735. if (i > 0) {
  31736. jsonString += ",";
  31737. }
  31738. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  31739. }
  31740. } else if (isAnalyzeById === true) {
  31741. for (let i = 0; i < len; i++) {
  31742. if (i > 0) {
  31743. jsonString += ",";
  31744. }
  31745. jsonString += params[i];
  31746. }
  31747. }
  31748. jsonString += ']';
  31749. return jsonString;
  31750. }
  31751. }
  31752. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  31753. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31754. * This program are made available under the terms of the Apache License, Version 2.0
  31755. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31756. /**
  31757. * @class DataFlowService
  31758. * @deprecatedclass SuperMap.DataFlowService
  31759. * @category iServer DataFlow
  31760. * @classdesc 数据流服务类。
  31761. * @extends {CommonServiceBase}
  31762. * @param {string} url - 数据流服务地址。
  31763. * @param {Object} options - 参数。
  31764. * @param {function} options.style - 设置数据加载样式。
  31765. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  31766. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  31767. * @param {Object} [options.excludeField] - 排除字段。
  31768. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31769. * @param {Object} [options.headers] - 请求头。
  31770. * @usage
  31771. */
  31772. class DataFlowService extends CommonServiceBase {
  31773. constructor(url, options) {
  31774. options = options || {};
  31775. /*
  31776. * @constant EVENT_TYPES
  31777. * {Array.<string>}
  31778. * 此类支持的事件类型
  31779. */
  31780. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketClosed", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketClosed", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  31781. super(url, options);
  31782. /**
  31783. * @member {GeoJSONObject} DataFlowService.prototype.geometry
  31784. * @description 指定几何范围,该范围内的要素才能被订阅。
  31785. */
  31786. this.geometry = null;
  31787. /**
  31788. * @member {Object} DataFlowService.prototype.prjCoordSys
  31789. * @description 动态投影参数。
  31790. */
  31791. this.prjCoordSys = null;
  31792. /**
  31793. * @member {Object} DataFlowService.prototype.excludeField
  31794. * @description 排除字段。
  31795. */
  31796. this.excludeField = null;
  31797. Util_Util.extend(this, options);
  31798. this.CLASS_NAME = "SuperMap.DataFlowService";
  31799. }
  31800. /**
  31801. * @function DataFlowService.prototype.initBroadcast
  31802. * @description 初始化广播。
  31803. * @returns {DataFlowService}
  31804. */
  31805. initBroadcast() {
  31806. var me = this;
  31807. this.broadcastWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'broadcast'));
  31808. this.broadcastWebSocket.onopen = function (e) {
  31809. me.broadcastWebSocket.isOpen = true;
  31810. e.eventType = 'broadcastSocketConnected';
  31811. me.events.triggerEvent('broadcastSocketConnected', e);
  31812. };
  31813. this.broadcastWebSocket.onclose = function (e) {
  31814. if (me.broadcastWebSocket) {
  31815. me.broadcastWebSocket.isOpen = false;
  31816. }
  31817. e.eventType = 'broadcastSocketClosed';
  31818. me.events.triggerEvent('broadcastSocketClosed', e);
  31819. };
  31820. this.broadcastWebSocket.onerror = function (e) {
  31821. e.eventType = 'broadcastSocketError';
  31822. me.events.triggerEvent('broadcastSocketError', e);
  31823. };
  31824. return this;
  31825. }
  31826. /**
  31827. * @function DataFlowService.prototype.broadcast
  31828. * @description 加载广播数据。
  31829. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  31830. */
  31831. broadcast(geoJSONFeature) {
  31832. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  31833. this.events.triggerEvent('broadcastFailed');
  31834. return;
  31835. }
  31836. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  31837. this.events.triggerEvent('broadcastSucceeded');
  31838. }
  31839. /**
  31840. * @function DataFlowService.prototype.initSubscribe
  31841. * @description 初始化订阅数据。
  31842. * @returns {DataFlowService} DataFlowService的实例对象。
  31843. */
  31844. initSubscribe() {
  31845. var me = this;
  31846. this.subscribeWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'subscribe'));
  31847. this.subscribeWebSocket.onopen = function (e) {
  31848. me.subscribeWebSocket.send(me._getFilterParams());
  31849. e.eventType = 'subscribeSocketConnected';
  31850. me.events.triggerEvent('subscribeSocketConnected', e);
  31851. };
  31852. this.subscribeWebSocket.onclose = function (e) {
  31853. e.eventType = 'subscribeWebSocketClosed';
  31854. me.events.triggerEvent('subscribeWebSocketClosed', e);
  31855. };
  31856. this.subscribeWebSocket.onerror = function (e) {
  31857. e.eventType = 'subscribeSocketError';
  31858. me.events.triggerEvent('subscribeSocketError', e);
  31859. };
  31860. this.subscribeWebSocket.onmessage = function (e) {
  31861. me._onMessage(e);
  31862. };
  31863. return this;
  31864. }
  31865. /**
  31866. * @function DataFlowService.prototype.setExcludeField
  31867. * @description 设置排除字段。
  31868. * @param {Object} excludeField - 排除字段。
  31869. * @returns {DataFlowService} DataFlowService的实例对象。
  31870. */
  31871. setExcludeField(excludeField) {
  31872. this.excludeField = excludeField;
  31873. this.subscribeWebSocket.send(this._getFilterParams());
  31874. return this;
  31875. }
  31876. /**
  31877. * @function DataFlowService.prototype.setGeometry
  31878. * @description 设置添加的几何要素数据。
  31879. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  31880. * @returns {DataFlowService} DataFlowService的实例对象。
  31881. */
  31882. setGeometry(geometry) {
  31883. this.geometry = geometry;
  31884. this.subscribeWebSocket.send(this._getFilterParams());
  31885. return this;
  31886. }
  31887. /**
  31888. * @function DataFlowService.prototype.unSubscribe
  31889. * @description 结束订阅数据。
  31890. */
  31891. unSubscribe() {
  31892. if (!this.subscribeWebSocket) {
  31893. return;
  31894. }
  31895. this.subscribeWebSocket.close();
  31896. this.subscribeWebSocket = null;
  31897. }
  31898. /**
  31899. * @function DataFlowService.prototype.unBroadcast
  31900. * @description 结束加载广播。
  31901. */
  31902. unBroadcast() {
  31903. if (!this.broadcastWebSocket) {
  31904. return;
  31905. }
  31906. this.broadcastWebSocket.close();
  31907. this.broadcastWebSocket = null;
  31908. }
  31909. /**
  31910. * @function DataFlowService.prototype.destroy
  31911. * @override
  31912. */
  31913. destroy() {
  31914. CommonServiceBase.prototype.destroy.apply(this, arguments);
  31915. var me = this;
  31916. me.geometry = null;
  31917. me.prjCoordSys = null;
  31918. me.excludeField = null;
  31919. this.unBroadcast();
  31920. this.unSubscribe();
  31921. }
  31922. _getFilterParams() {
  31923. var filter = {
  31924. filterParam: {
  31925. prjCoordSys: this.prjCoordSys,
  31926. excludeField: this.excludeField,
  31927. geometry: this.geometry
  31928. }
  31929. };
  31930. return Util_Util.toJSON(filter);
  31931. }
  31932. _onMessage(e) {
  31933. if (e.data && e.data.indexOf("filterParam") >= 0) {
  31934. var filterParam = JSON.parse(e.data);
  31935. e.filterParam = filterParam;
  31936. e.eventType = 'setFilterParamSucceeded';
  31937. this.events.triggerEvent('setFilterParamSucceeded', e);
  31938. return;
  31939. }
  31940. var feature = JSON.parse(e.data);
  31941. e.featureResult = feature;
  31942. e.eventType = 'messageSucceeded';
  31943. this.events.triggerEvent('messageSucceeded', e);
  31944. }
  31945. _connect(url) {
  31946. url = SecurityManager.appendCredential(url);
  31947. if ("WebSocket" in window) {
  31948. return new WebSocket(url);
  31949. } else if ("MozWebSocket" in window) {
  31950. var mozWebSocket = window.MozWebSocket;
  31951. return new mozWebSocket(url);
  31952. } else {
  31953. console.log("no WebSocket");
  31954. return null;
  31955. }
  31956. }
  31957. }
  31958. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  31959. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31960. * This program are made available under the terms of the Apache License, Version 2.0
  31961. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31962. /**
  31963. * @class DatasetInfo
  31964. * @deprecatedclass SuperMap.DatasetInfo
  31965. * @category iServer Data Dataset
  31966. * @classdesc 数据集信息类。
  31967. * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  31968. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  31969. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  31970. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  31971. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  31972. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  31973. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  31974. * @param {Object} options - 参数。
  31975. * @param {Bounds} [options.bounds] - 数据集范围。
  31976. * @param {string} [options.dataSourceName] - 数据源名称。
  31977. * @param {string} [options.description] - 数据集的描述信息。
  31978. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式。
  31979. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  31980. * @param {string} options.name - 数据集名称。
  31981. * @param {Object} [options.prjCoordSys] - 数据集的投影信息。如:prjCoordSys={"epsgCode":3857}。
  31982. * @param {string} [options.tableName] - 表名。
  31983. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  31984. * @usage
  31985. */
  31986. class DatasetInfo {
  31987. constructor(options) {
  31988. options = options || {};
  31989. /**
  31990. * @member {Bounds} [DatasetInfo.prototype.bounds]
  31991. * @description 数据集范围,该字段只读。
  31992. */
  31993. this.bounds = null;
  31994. /**
  31995. * @member {string} [DatasetInfo.prototype.dataSourceName]
  31996. * @description 数据源名称,该字段只读。
  31997. */
  31998. this.dataSourceName = null;
  31999. /**
  32000. * @member {string} [DatasetInfo.prototype.description]
  32001. * @description 数据集的描述信息。
  32002. */
  32003. this.description = null;
  32004. /**
  32005. * @member {string} [DatasetInfo.prototype.encodeType]
  32006. * @description 数据集存储时的压缩编码方式,该字段只读。
  32007. */
  32008. this.encodeType = null;
  32009. /**
  32010. * @member {boolean} [DatasetInfo.prototype.isReadOnly]
  32011. * @description 数据集是否为只读。
  32012. */
  32013. this.isReadOnly = null;
  32014. /**
  32015. * @member {string} DatasetInfo.prototype.name
  32016. * @description 数据集名称,该字段必须且只读。
  32017. */
  32018. this.name = null;
  32019. /**
  32020. * @member {Object} [DatasetInfo.prototype.prjCoordSys]
  32021. * @description 数据集的投影信息。
  32022. */
  32023. this.prjCoordSys = null;
  32024. /**
  32025. * @member {string} [DatasetInfo.prototype.tableName]
  32026. * @description 表名,该字段只读。
  32027. */
  32028. this.tableName = null;
  32029. /**
  32030. * @member {string} DatasetInfo.prototype.type
  32031. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  32032. */
  32033. this.type = null;
  32034. Util_Util.extend(this, options);
  32035. var b = this.bounds;
  32036. if (b) {
  32037. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  32038. }
  32039. this.CLASS_NAME = "SuperMap.DatasetInfo";
  32040. }
  32041. /**
  32042. * @function DatasetInfo.prototype.destroy
  32043. * @description 释放资源,将引用资源的属性置空。
  32044. */
  32045. destroy() {
  32046. Util_Util.reset(this);
  32047. }
  32048. /**
  32049. * @function DatasetInfo.prototype.toServerJSONObject
  32050. * @description 转换成对应的 JSON 格式对象。
  32051. * @returns {Object} JSON 对象。
  32052. */
  32053. toServerJSONObject() {
  32054. var dataObj = {};
  32055. dataObj = Util_Util.copyAttributes(dataObj, this);
  32056. if (dataObj.bounds) {
  32057. if (dataObj.bounds.toServerJSONObject) {
  32058. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  32059. }
  32060. }
  32061. return dataObj;
  32062. }
  32063. }
  32064. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  32065. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32066. * This program are made available under the terms of the Apache License, Version 2.0
  32067. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32068. /**
  32069. * @class OverlayAnalystParameters
  32070. * @deprecatedclass SuperMap.OverlayAnalystParameters
  32071. * @category iServer SpatialAnalyst OverlayAnalyst
  32072. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  32073. * @param {Object} options - 参数。
  32074. * @usage
  32075. */
  32076. class OverlayAnalystParameters {
  32077. constructor(options) {
  32078. /**
  32079. * @member {OverlayOperationType} [OverlayAnalystParameters.prototype.operation=OverlayOperationType.UNION]
  32080. * @description 指定叠加分析操作类型。
  32081. */
  32082. this.operation = OverlayOperationType.UNION;
  32083. if (options) {
  32084. Util_Util.extend(this, options);
  32085. }
  32086. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  32087. }
  32088. /**
  32089. * @function OverlayAnalystParameters.prototype.destroy
  32090. * @description 释放资源,将引用资源的属性置空。
  32091. */
  32092. destroy() {
  32093. var me = this;
  32094. me.operation = null;
  32095. }
  32096. }
  32097. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  32098. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32099. * This program are made available under the terms of the Apache License, Version 2.0
  32100. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32101. /**
  32102. * @class DatasetOverlayAnalystParameters
  32103. * @deprecatedclass SuperMap.DatasetOverlayAnalystParameters
  32104. * @category iServer SpatialAnalyst OverlayAnalyst
  32105. * @classdesc 数据集叠加分析参数类。
  32106. * @param {Object} options - 参数。
  32107. * @param {string} options.operateDataset -数据集名称。
  32108. * @param {string} options.sourceDataset - 源数据集名称。
  32109. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  32110. * @param {FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  32111. * @param {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  32112. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  32113. * @param {FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  32114. * @param {number} [options.tolerance=0] - 容限。
  32115. * @param {OverlayOperationType} options.operation - 叠加操作枚举值。
  32116. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  32117. * @extends {GetFeaturesParametersBase}
  32118. * @usage
  32119. */
  32120. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  32121. constructor(options) {
  32122. super(options);
  32123. /**
  32124. * @member {string} DatasetOverlayAnalystParameters.prototype.operateDataset
  32125. * @description 叠加分析中操作数据集的名称。
  32126. */
  32127. this.operateDataset = null;
  32128. /**
  32129. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  32130. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  32131. */
  32132. this.operateDatasetFields = [];
  32133. /**
  32134. * @member {FilterParameter} DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  32135. * @description 设置操作数据集中空间对象过滤条件。
  32136. */
  32137. this.operateDatasetFilter = new FilterParameter();
  32138. /**
  32139. * @member {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [DatasetOverlayAnalystParameters.prototype.operateRegions]
  32140. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  32141. */
  32142. this.operateRegions = [];
  32143. /**
  32144. * @member {string} DatasetOverlayAnalystParameters.prototype.sourceDataset
  32145. * @description 叠加分析中源数据集的名称。
  32146. */
  32147. this.sourceDataset = null;
  32148. /**
  32149. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  32150. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  32151. */
  32152. this.sourceDatasetFields = [];
  32153. /**
  32154. * @member {FilterParameter} [DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  32155. * @description 设置源数据集中空间对象过滤条件。
  32156. */
  32157. this.sourceDatasetFilter = new FilterParameter();
  32158. /**
  32159. * @member {number} [DatasetOverlayAnalystParameters.prototype.tolerance=0]
  32160. * @description 容限。
  32161. */
  32162. this.tolerance = 0;
  32163. /**
  32164. * @member {DataReturnOption} [DatasetOverlayAnalystParameters.prototype.resultSetting]
  32165. * @description 结果返回设置类。
  32166. */
  32167. this.resultSetting = new DataReturnOption();
  32168. Util_Util.extend(this, options);
  32169. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  32170. }
  32171. /**
  32172. * @function DatasetOverlayAnalystParameters.prototype.destroy
  32173. * @override
  32174. */
  32175. destroy() {
  32176. super.destroy();
  32177. var me = this;
  32178. me.operateDataset = null;
  32179. me.operateDatasetFields = null;
  32180. if (me.operateDatasetFilter) {
  32181. me.operateDatasetFilter.destroy();
  32182. me.operateDatasetFilter = null;
  32183. }
  32184. if (me.operateRegions) {
  32185. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  32186. opRegions[i].destroy();
  32187. }
  32188. me.operateRegions = null;
  32189. }
  32190. me.sourceDataset = null;
  32191. me.sourceDatasetFields = null;
  32192. if (me.sourceDatasetFilter) {
  32193. me.sourceDatasetFilter.destroy();
  32194. me.sourceDatasetFilter = null;
  32195. }
  32196. me.tolerance = null;
  32197. if (me.resultSetting) {
  32198. me.resultSetting.destroy();
  32199. me.resultSetting = null;
  32200. }
  32201. }
  32202. /**
  32203. * @function DatasetOverlayAnalystParameters.toObject
  32204. * @param {DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  32205. * @param {DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  32206. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  32207. * @returns {Object} JSON 对象。
  32208. */
  32209. static toObject(datasetOverlayAnalystParameters, tempObj) {
  32210. for (var name in datasetOverlayAnalystParameters) {
  32211. if (name === "sourceDataset") {
  32212. continue;
  32213. } else if (name === "operateRegions") {
  32214. tempObj.operateRegions = [];
  32215. var ors = datasetOverlayAnalystParameters.operateRegions;
  32216. for (var index in ors) {
  32217. if (ors.hasOwnProperty(index)) { //icl542
  32218. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  32219. }
  32220. }
  32221. } else if (name === "resultSetting") {
  32222. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  32223. } else {
  32224. tempObj[name] = datasetOverlayAnalystParameters[name];
  32225. }
  32226. }
  32227. }
  32228. }
  32229. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  32230. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32231. * This program are made available under the terms of the Apache License, Version 2.0
  32232. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32233. /**
  32234. * @class SurfaceAnalystParametersSetting
  32235. * @deprecatedclass SuperMap.SurfaceAnalystParametersSetting
  32236. * @category iServer SpatialAnalyst SurfaceAnalyst
  32237. * @classdesc 表面分析参数设置类。
  32238. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  32239. * @param {Object} options - 参数。
  32240. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  32241. * @param {number} [options.datumValue=0] - 提取等值线、提取等值面的基准值。
  32242. * @param {Array.<number>} options.expectedZValues - 期望分析结果的 Z 值集合。
  32243. * @param {number} [options.interval=0] - 等值距。等值距是两条等值线之间的间隔值。
  32244. * @param {number} [options.resampleTolerance=0] - 重采样容限。
  32245. * @param {SmoothMethod} [options.smoothMethod=SmoothMethod.BSPLINE] - 光滑处理所使用的方法。
  32246. * @param {number} [options.smoothness=0] - 等值线或等值面的边界线的光滑度。
  32247. * @usage
  32248. */
  32249. class SurfaceAnalystParametersSetting {
  32250. constructor(options) {
  32251. /**
  32252. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [SurfaceAnalystParametersSetting.prototype.clipRegion]
  32253. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  32254. */
  32255. this.clipRegion = null;
  32256. /**
  32257. * @member {number} [SurfaceAnalystParametersSetting.prototype.datumValue=0]
  32258. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  32259. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。例如,高程范围为 220 -1550 的 DEM 栅格数据,
  32260. * 如果设基准值为 0,等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  32261. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  32262. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  32263. */
  32264. this.datumValue = 0;
  32265. /**
  32266. * @member {Array.<number>} SurfaceAnalystParametersSetting.prototype.expectedZValues
  32267. * @description 获取或设置期望分析结果的 Z 值集合。
  32268. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  32269. */
  32270. this.expectedZValues = null;
  32271. /**
  32272. * @member {number} [SurfaceAnalystParametersSetting.prototype.interval=0]
  32273. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  32274. */
  32275. this.interval = 0;
  32276. /**
  32277. * @member {number} [SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  32278. * @description 获取或设置重采样容限。
  32279. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  32280. */
  32281. this.resampleTolerance = 0;
  32282. /**
  32283. * @member {SmoothMethod} [SurfaceAnalystParametersSetting.prototype.smoothMethod=SmoothMethod.BSPLINE]
  32284. * @description 获取或设置光滑处理所使用的方法。
  32285. */
  32286. this.smoothMethod = SmoothMethod.BSPLINE;
  32287. /**
  32288. * @member {number} [SurfaceAnalystParametersSetting.prototype.smoothness=0]
  32289. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  32290. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  32291. * 随着光滑度的增加,提取的等值线越光滑,当然光滑度越大,
  32292. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  32293. * 光滑度太高会出现等值线相交的问题。
  32294. */
  32295. this.smoothness = 0;
  32296. if (options) {
  32297. Util_Util.extend(this, options);
  32298. }
  32299. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  32300. }
  32301. /**
  32302. * @function SurfaceAnalystParametersSetting.prototype.destroy
  32303. * @description 释放资源,将引用资源的属性置空。
  32304. */
  32305. destroy() {
  32306. var me = this;
  32307. if (me.clipRegion) {
  32308. me.clipRegion.destroy();
  32309. me.clipRegion = null;
  32310. }
  32311. me.datumValue = null;
  32312. me.expectedZValues = null;
  32313. me.interval = null;
  32314. me.resampleTolerance = null;
  32315. me.smoothMethod = null;
  32316. me.smoothness = null;
  32317. }
  32318. /**
  32319. * @function SurfaceAnalystParametersSetting.prototype.toJSON
  32320. * @description 将对象转化为 JSON 字符串。
  32321. * @returns {string} 对象 JSON 字符串。
  32322. */
  32323. toJSON() {
  32324. let json = "'datumValue':" + Util_Util.toJSON(this.datumValue);
  32325. json += ",'interval':" + Util_Util.toJSON(this.interval);
  32326. json += ",'resampleTolerance':" + Util_Util.toJSON(this.resampleTolerance);
  32327. json += ",'smoothMethod':" + Util_Util.toJSON(this.smoothMethod);
  32328. json += ",'smoothness':" + Util_Util.toJSON(this.smoothness);
  32329. if (this.expectedZValues != null) {
  32330. json += "," + "'expectedZValues':" + Util_Util.toJSON(this.expectedZValues);
  32331. }
  32332. if (this.clipRegion != null) {
  32333. var serverGeometry = this.clipRegion;
  32334. if (this.clipRegion instanceof Geometry_Geometry && this.clipRegion.components) {
  32335. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  32336. }
  32337. json += ",'clipRegion':" + Util_Util.toJSON(serverGeometry);
  32338. }
  32339. return "{" + json + "}";
  32340. }
  32341. }
  32342. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  32343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32344. * This program are made available under the terms of the Apache License, Version 2.0
  32345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32346. /**
  32347. * @class SurfaceAnalystParameters
  32348. * @deprecatedclass SuperMap.SurfaceAnalystParameters
  32349. * @category iServer SpatialAnalyst SurfaceAnalyst
  32350. * @classdesc 表面分析提取操作参数类。通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  32351. * {@link DatasetSurfaceAnalystParameters} 和 {@link GeometrySurfaceAnalystParameters} 继承自该类。
  32352. * @param {Object} options - 参数。
  32353. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。
  32354. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  32355. * @param {DataReturnOption} options.resultSetting - 结果返回设置类。
  32356. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  32357. * @usage
  32358. */
  32359. class SurfaceAnalystParameters {
  32360. constructor(options) {
  32361. /**
  32362. * @member {number} SurfaceAnalystParameters.prototype.resolution
  32363. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  32364. */
  32365. this.resolution = 0;
  32366. /**
  32367. * @member {SurfaceAnalystParametersSetting} SurfaceAnalystParameters.prototype.extractParameter
  32368. * @description 获取或设置表面分析参数。
  32369. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  32370. */
  32371. this.extractParameter = new SurfaceAnalystParametersSetting();
  32372. /**
  32373. * @member {DataReturnOption} SurfaceAnalystParameters.prototype.resultSetting
  32374. * @description 结果返回设置类。
  32375. */
  32376. this.resultSetting = new DataReturnOption();
  32377. /**
  32378. * @member {SurfaceAnalystMethod} [SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE]
  32379. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  32380. */
  32381. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  32382. if (options) {
  32383. Util_Util.extend(this, options);
  32384. }
  32385. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  32386. }
  32387. /**
  32388. * @function SurfaceAnalystParameters.prototype.destroy
  32389. * @description 释放资源,将引用资源的属性置空。
  32390. */
  32391. destroy() {
  32392. var me = this;
  32393. me.resolution = null;
  32394. if (me.extractParameter) {
  32395. me.extractParameter.destroy();
  32396. me.extractParameter = null;
  32397. }
  32398. if (me.resultSetting) {
  32399. me.resultSetting.destroy();
  32400. me.resultSetting = null;
  32401. }
  32402. me.surfaceAnalystMethod = null;
  32403. }
  32404. }
  32405. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  32406. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32407. * This program are made available under the terms of the Apache License, Version 2.0
  32408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32409. /**
  32410. * @class DatasetSurfaceAnalystParameters
  32411. * @deprecatedclass SuperMap.DatasetSurfaceAnalystParameters
  32412. * @category iServer SpatialAnalyst SurfaceAnalyst
  32413. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  32414. * @param {Object} options - 参数。
  32415. * @param {string} options.dataset - 数据集名称。
  32416. * @param {string} options.zValueFieldName - 字段名称。
  32417. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  32418. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  32419. * @param {FilterParameter} [options.filterQueryParameter] - 查询过滤条件参数。
  32420. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  32421. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 表面分析的提取方法,提取等值线和提取等值面。
  32422. * @extends {SurfaceAnalystParameters}
  32423. * @usage
  32424. */
  32425. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  32426. constructor(options) {
  32427. super(options);
  32428. /**
  32429. * @member {string} DatasetSurfaceAnalystParameters.prototype.dataset
  32430. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  32431. */
  32432. this.dataset = null;
  32433. /**
  32434. * @member {FilterParameter} DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  32435. * @description 获取或设置查询过滤条件参数。
  32436. */
  32437. this.filterQueryParameter = new FilterParameter();
  32438. /**
  32439. * @member {string} DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  32440. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  32441. */
  32442. this.zValueFieldName = null;
  32443. if (options) {
  32444. Util_Util.extend(this, options);
  32445. }
  32446. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  32447. }
  32448. /**
  32449. * @function DatasetSurfaceAnalystParameters.prototype.destroy
  32450. * @override
  32451. */
  32452. destroy() {
  32453. super.destroy();
  32454. var me = this;
  32455. me.dataset = null;
  32456. if (me.filterQueryParameter) {
  32457. me.filterQueryParameter.destroy();
  32458. me.filterQueryParameter = null;
  32459. }
  32460. me.zValueFieldName = null;
  32461. }
  32462. /**
  32463. * @function DatasetSurfaceAnalystParameters.toObject
  32464. * @param {DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  32465. * @param {DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  32466. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  32467. * @returns JSON 对象。
  32468. */
  32469. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  32470. for (var name in datasetSurfaceAnalystParameters) {
  32471. if (name === "filterQueryParameter") {
  32472. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  32473. }
  32474. if (name === "extractParameter") {
  32475. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry_Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  32476. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  32477. }
  32478. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  32479. } else if (name === "dataset") {
  32480. continue;
  32481. } else if (name === "surfaceAnalystMethod") {
  32482. continue;
  32483. } else {
  32484. tempObj[name] = datasetSurfaceAnalystParameters[name];
  32485. }
  32486. }
  32487. }
  32488. }
  32489. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  32490. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32491. * This program are made available under the terms of the Apache License, Version 2.0
  32492. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32493. /**
  32494. * @class ThiessenAnalystParameters
  32495. * @deprecatedclass SuperMap.ThiessenAnalystParameters
  32496. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  32497. * @classdesc 泰森多边形分析参数基类。
  32498. * @param {Object} options - 可选参数。
  32499. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  32500. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  32501. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  32502. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  32503. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  32504. * @usage
  32505. */
  32506. class ThiessenAnalystParameters {
  32507. constructor(options) {
  32508. if (!options) {
  32509. return;
  32510. }
  32511. /**
  32512. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [ThiessenAnalystParameters.prototype.clipRegion]
  32513. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  32514. */
  32515. this.clipRegion = null;
  32516. /**
  32517. * @member {boolean} [ThiessenAnalystParameters.prototype.createResultDataset=false]
  32518. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  32519. */
  32520. this.createResultDataset = false;
  32521. /**
  32522. * @member {string} ThiessenAnalystParameters.prototype.resultDatasetName
  32523. * @description 指定结果数据集名称。
  32524. */
  32525. this.resultDatasetName = null;
  32526. /**
  32527. * @member {string} ThiessenAnalystParameters.prototype.resultDatasourceName
  32528. * @description 指定结果数据集所在数据源。
  32529. */
  32530. this.resultDatasourceName = null;
  32531. /**
  32532. * @member {boolean} ThiessenAnalystParameters.prototype.returnResultRegion
  32533. * @description 是否返回分析得到的多边形面数组。
  32534. */
  32535. this.returnResultRegion = true;
  32536. Util_Util.extend(this, options);
  32537. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  32538. }
  32539. /**
  32540. * @function ThiessenAnalystParameters.prototype.destroy
  32541. * @description 释放资源,将引用资源的属性置空。
  32542. */
  32543. destroy() {
  32544. var me = this;
  32545. if (me.clipRegion) {
  32546. me.clipRegion.destroy();
  32547. me.clipRegion = null;
  32548. }
  32549. me.createResultDataset = null;
  32550. me.resultDatasetName = null;
  32551. me.resultDatasourceName = null;
  32552. me.returnResultRegion = null;
  32553. }
  32554. }
  32555. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  32556. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32557. * This program are made available under the terms of the Apache License, Version 2.0
  32558. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32559. /**
  32560. * @class DatasetThiessenAnalystParameters
  32561. * @deprecatedclass SuperMap.DatasetThiessenAnalystParameters
  32562. * @category iServer SpatialAnalyst ThiessenAnalyst
  32563. * @classdesc 数据集泰森多边形分析参数类。
  32564. * @param {Object} options - 参数。
  32565. * @param {FilterParameter} [options.filterQueryParameter] - 过滤参数类,即对数据集中的所有点进行分析。
  32566. * @extends {ThiessenAnalystParameters}
  32567. * @usage
  32568. */
  32569. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  32570. constructor(options) {
  32571. super(options);
  32572. /**
  32573. * @member {FilterParameter} [DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  32574. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  32575. * @example
  32576. * var filterQueryParameter = new FilterParameter({
  32577. * name: "Countries@World",
  32578. * attributeFilter: "SmID>100"
  32579. * });
  32580. */
  32581. this.filterQueryParameter = null;
  32582. /**
  32583. * @member {string} DatasetThiessenAnalystParameters.prototype.dataset
  32584. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  32585. */
  32586. this.dataset = null;
  32587. if (options) {
  32588. Util_Util.extend(this, options);
  32589. }
  32590. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  32591. }
  32592. /**
  32593. * @function DatasetThiessenAnalystParameters.prototype.destroy
  32594. * @override
  32595. */
  32596. destroy() {
  32597. super.destroy();
  32598. var me = this;
  32599. if (me.filterQueryParameter) {
  32600. me.filterQueryParameter.destroy();
  32601. me.filterQueryParameter = null;
  32602. }
  32603. }
  32604. /**
  32605. * @function DatasetThiessenAnalystParameters.toObject
  32606. * @param {DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  32607. * @param {DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  32608. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  32609. * @returns JSON 对象。
  32610. */
  32611. static toObject(datasetThiessenAnalystParameters, tempObj) {
  32612. for (var name in datasetThiessenAnalystParameters) {
  32613. if (name === "clipRegion") {
  32614. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  32615. } else {
  32616. tempObj[name] = datasetThiessenAnalystParameters[name];
  32617. }
  32618. }
  32619. }
  32620. }
  32621. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceService.js
  32622. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32623. * This program are made available under the terms of the Apache License, Version 2.0
  32624. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32625. /**
  32626. * @class DatasourceService
  32627. * @deprecatedclass SuperMap.DatasourceService
  32628. * @category iServer Data Datasource
  32629. * @classdesc 数据源查询服务类。
  32630. * @param {string} url - 服务地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  32631. * @param {Object} options - 参数。
  32632. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  32633. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  32634. * @param {string} options.datasource - 要查询的数据集所在的数据源名称。
  32635. * @param {string} options.dataset - 要查询的数据集名称。
  32636. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32637. * @param {Object} [options.headers] - 请求头。
  32638. * @extends {CommonServiceBase}
  32639. * @usage
  32640. */
  32641. class DatasourceService extends CommonServiceBase {
  32642. constructor(url, options) {
  32643. super(url, options);
  32644. if (options) {
  32645. Util_Util.extend(this, options);
  32646. }
  32647. this.eventCount = 0;
  32648. this.CLASS_NAME = "SuperMap.DatasourceService";
  32649. }
  32650. /**
  32651. * @function DatasourceService.prototype.destroy
  32652. * @override
  32653. */
  32654. destroy() {
  32655. this.eventCount = 0;
  32656. super.destroy();
  32657. }
  32658. /**
  32659. * @function DatasourceService.prototype.getDatasourceService
  32660. * @description 获取指定数据源信息。
  32661. */
  32662. getDatasourceService(datasourceName, callback) {
  32663. let url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}`);
  32664. this.processAsync(url, "GET", callback);
  32665. }
  32666. /**
  32667. * @function DatasourceService.prototype.getDatasourcesService
  32668. * @description 获取所有数据源信息。
  32669. */
  32670. getDatasourcesService(callback) {
  32671. let url = Util_Util.urlPathAppend(this.url,`datasources`);
  32672. this.processAsync(url, "GET", callback);
  32673. }
  32674. /**
  32675. * @function DatasourceService.prototype.setDatasourceService
  32676. * @description 更新数据源信息。
  32677. */
  32678. setDatasourceService(params, callback) {
  32679. if (!params) {
  32680. return;
  32681. }
  32682. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params.datasourceName}`);
  32683. this.processAsync(url, "PUT", callback, params);
  32684. }
  32685. processAsync(url, method, callback, params) {
  32686. let eventId = ++this.eventCount;
  32687. let eventListeners = {
  32688. scope: this,
  32689. processCompleted: function(result) {
  32690. if (eventId === result.result.eventId && callback) {
  32691. delete result.result.eventId;
  32692. callback(result);
  32693. this.events && this.events.un(eventListeners);
  32694. return false;
  32695. }
  32696. },
  32697. processFailed: function(result) {
  32698. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  32699. callback(result);
  32700. this.events && this.events.un(eventListeners);
  32701. return false;
  32702. }
  32703. }
  32704. }
  32705. this.events.on(eventListeners);
  32706. var me = this;
  32707. let requestConfig = {
  32708. url,
  32709. method,
  32710. scope: me,
  32711. success(result, options) {
  32712. result.eventId = eventId;
  32713. this.serviceProcessCompleted(result, options);
  32714. },
  32715. failure(result, options) {
  32716. if (result.error) {
  32717. result.error.eventId = eventId;
  32718. }
  32719. result.eventId = eventId;
  32720. this.serviceProcessFailed(result, options);
  32721. }
  32722. }
  32723. params && (requestConfig.data = Util_Util.toJSON(params));
  32724. me.request(requestConfig);
  32725. }
  32726. }
  32727. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  32728. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32729. * This program are made available under the terms of the Apache License, Version 2.0
  32730. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32731. /**
  32732. * @class DensityKernelAnalystParameters
  32733. * @deprecatedclass SuperMap.DensityKernelAnalystParameters
  32734. * @category iServer SpatialAnalyst DensityAnalyst
  32735. * @classdesc 核密度分析参数类。
  32736. * @param {Object} options - 参数。
  32737. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  32738. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  32739. * @param {string} options.resultGridName - 指定结果数据集名称。
  32740. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  32741. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  32742. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  32743. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  32744. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  32745. * @usage
  32746. */
  32747. class DensityKernelAnalystParameters {
  32748. constructor(options) {
  32749. /**
  32750. * @member {string} DensityKernelAnalystParameters.prototype.dataset
  32751. * @description 要用来做核密度分析数据源中数据集的名称。
  32752. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  32753. * 注:核密度分析支持点数据集和线数据集。
  32754. */
  32755. this.dataset = null;
  32756. /**
  32757. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [DensityKernelAnalystParameters.prototype.bounds]
  32758. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  32759. * 如果缺省,则默认为原数据集的范围。
  32760. */
  32761. this.bounds = null;
  32762. /**
  32763. * @member {string} DensityKernelAnalystParameters.prototype.fieldName
  32764. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  32765. */
  32766. this.fieldName = null;
  32767. /**
  32768. * @member {number} [DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  32769. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  32770. */
  32771. this.resultGridDatasetResolution = null;
  32772. /**
  32773. * @member {number} [DensityKernelAnalystParameters.prototype.searchRadius]
  32774. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  32775. */
  32776. this.searchRadius = null;
  32777. /**
  32778. * @member {string} [DensityKernelAnalystParameters.prototype.targetDatasource]
  32779. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  32780. */
  32781. this.targetDatasource = null;
  32782. /**
  32783. * @member {string} DensityKernelAnalystParameters.prototype.resultGridName
  32784. * @description 指定结果数据集名称。
  32785. */
  32786. this.resultGridName = null;
  32787. /**
  32788. * @member {boolean} [DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  32789. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  32790. */
  32791. this.deleteExistResultDataset = false;
  32792. Util_Util.extend(this, options);
  32793. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  32794. }
  32795. /**
  32796. * @function DensityKernelAnalystParameters.prototype.destroy
  32797. * @description 释放资源,将引用资源的属性置空。
  32798. */
  32799. destroy() {
  32800. var me = this;
  32801. me.dataset = null;
  32802. me.bounds = null;
  32803. me.fieldName = null;
  32804. me.resultGridDatasetResolution = null;
  32805. me.searchRadius = null;
  32806. me.targetDatasource = null;
  32807. me.resultGridName = null;
  32808. me.deleteExistResultDataset = null;
  32809. }
  32810. /**
  32811. * @function DensityKernelAnalystParameters.toObject
  32812. * @param {DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  32813. * @param {DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  32814. * @description 将核密度分析参数对象转换成 JSON 对象。
  32815. * @returns JSON 对象。
  32816. */
  32817. static toObject(densityKernelAnalystParameters, tempObj) {
  32818. for (var name in densityKernelAnalystParameters) {
  32819. if (name !== "dataset") {
  32820. tempObj[name] = densityKernelAnalystParameters[name];
  32821. }
  32822. }
  32823. }
  32824. }
  32825. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  32826. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32827. * This program are made available under the terms of the Apache License, Version 2.0
  32828. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32829. /**
  32830. * @class DensityAnalystService
  32831. * @deprecatedclass SuperMap.DensityAnalystService
  32832. * @category iServer SpatialAnalyst DensityAnalyst
  32833. * @classdesc
  32834. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  32835. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  32836. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  32837. * @param {Object} options - 参数。
  32838. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32839. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32840. * @param {Object} [options.headers] - 请求头。
  32841. * @extends {SpatialAnalystBase}
  32842. * @example 例如:
  32843. * var myDensityAnalystService = new DensityAnalystService(url);
  32844. * myDensityAnalystService.on({
  32845. * "processCompleted": processCompleted,
  32846. * "processFailed": processFailed
  32847. * }
  32848. * );
  32849. * @usage
  32850. */
  32851. class DensityAnalystService extends SpatialAnalystBase {
  32852. constructor(url, options) {
  32853. super(url, options);
  32854. /**
  32855. * @member {string} DensityAnalystService.prototype.mode
  32856. * @description 密度分析类型。
  32857. */
  32858. this.mode = null;
  32859. if (options) {
  32860. Util_Util.extend(this, options);
  32861. }
  32862. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  32863. }
  32864. /**
  32865. * @function DensityAnalystService.prototype.destroy
  32866. * @description 释放资源,将引用资源的属性置空。
  32867. */
  32868. destroy() {
  32869. super.destroy();
  32870. this.mode = null;
  32871. }
  32872. /**
  32873. * @function DensityAnalystService.prototype.processAsync
  32874. * @description 负责将客户端的查询参数传递到服务端。
  32875. * @param {DensityKernelAnalystParameters} parameter - 核密度分析参数。
  32876. */
  32877. processAsync(parameter) {
  32878. var me = this;
  32879. var parameterObject = new Object();
  32880. if (parameter instanceof DensityKernelAnalystParameters) {
  32881. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  32882. me.mode = "kernel";
  32883. }
  32884. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  32885. var jsonParameters = Util_Util.toJSON(parameterObject);
  32886. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  32887. me.request({
  32888. method: "POST",
  32889. data: jsonParameters,
  32890. scope: me,
  32891. success: me.serviceProcessCompleted,
  32892. failure: me.serviceProcessFailed
  32893. });
  32894. }
  32895. }
  32896. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  32897. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32898. * This program are made available under the terms of the Apache License, Version 2.0
  32899. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32900. /**
  32901. * @class EditFeaturesParameters
  32902. * @deprecatedclass SuperMap.EditFeaturesParameters
  32903. * @category iServer Data Feature
  32904. * @classdesc 数据集添加、修改、删除参数类。
  32905. * @param {Object} options - 参数。
  32906. * @param {Array.<FeatureVector|GeoJSONObject|ol.Feature>} options.features - 当前需要创建或者是修改的要素集。
  32907. * @param {boolean} [options.returnContent=false] - 是否返回要素内容。如果为true则返回创建要素的 ID 数组,否则返回 featureResult 资源的 URI。
  32908. * @param {EditType} [options.editType=EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  32909. * @param {Array.<string|number>} [options.IDs] - 删除要素时的要素的 ID 数组。
  32910. * @usage
  32911. */
  32912. class EditFeaturesParameters {
  32913. constructor(options) {
  32914. /**
  32915. * @member {string} EditFeaturesParameters.prototype.dataSourceName
  32916. * @description 当前需要创建或者是修改的要素的数据源。
  32917. */
  32918. this.dataSourceName = null;
  32919. /**
  32920. * @member {string} EditFeaturesParameters.prototype.dataSetName
  32921. * @description 当前需要创建或者是修改的要素的数据集。
  32922. */
  32923. this.dataSetName = null;
  32924. /**
  32925. * @member {Array.<FeatureVector|GeoJSONObject|ol.Feature>} EditFeaturesParameters.prototype.features
  32926. * @description 当前需要创建或者是修改的要素集。
  32927. */
  32928. this.features = null;
  32929. /**
  32930. * @member {EditType} [EditFeaturesParameters.prototype.editType=EditType.ADD]
  32931. * @description 要素集更新类型 (add、update、delete)。
  32932. */
  32933. this.editType = EditType.ADD;
  32934. /**
  32935. * @member {Array.<string|number>} [EditFeaturesParameters.prototype.IDs]
  32936. * @description 执行删除时要素集 ID 集合。
  32937. */
  32938. this.IDs = null;
  32939. /**
  32940. * @member {boolean} [EditFeaturesParameters.prototype.returnContent=false]
  32941. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  32942. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  32943. */
  32944. this.returnContent = false;
  32945. /**
  32946. * @member {boolean} [EditFeaturesParameters.prototype.isUseBatch=false]
  32947. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  32948. */
  32949. this.isUseBatch = false;
  32950. Util_Util.extend(this, options);
  32951. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  32952. }
  32953. /**
  32954. * @function EditFeaturesParameters.prototype.destroy
  32955. * @description 释放资源,将引用资源的属性置空。
  32956. */
  32957. destroy() {
  32958. var me = this;
  32959. me.dataSourceName = null;
  32960. me.dataSetName = null;
  32961. me.features = null;
  32962. me.editType = null;
  32963. me.IDs = null;
  32964. me.returnContent = null;
  32965. }
  32966. /**
  32967. * @function EditFeaturesParameters.prototype.toJsonParameters
  32968. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  32969. * @param {EditFeaturesParameters} params - 地物编辑参数。
  32970. * @returns {string} JSON 字符串。
  32971. */
  32972. static toJsonParameters(params) {
  32973. var feature,
  32974. len,
  32975. features,
  32976. editType = params.editType;
  32977. if (editType === EditType.DELETE) {
  32978. if (params.IDs === null) {
  32979. return;
  32980. }
  32981. features = {ids: params.IDs};
  32982. } else {
  32983. features = [];
  32984. if (params.features) {
  32985. len = params.features.length;
  32986. for (var i = 0; i < len; i++) {
  32987. feature = params.features[i];
  32988. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  32989. features.push(feature);
  32990. }
  32991. }
  32992. }
  32993. return Util_Util.toJSON(features);
  32994. }
  32995. }
  32996. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  32997. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32998. * This program are made available under the terms of the Apache License, Version 2.0
  32999. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33000. /**
  33001. * @class EditFeaturesService
  33002. * @deprecatedclass SuperMap.EditFeaturesService
  33003. * @category iServer Data Feature
  33004. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  33005. * @extends {CommonServiceBase}
  33006. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  33007. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  33008. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  33009. * @param {Object} options - 参数。
  33010. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  33011. * @param {DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  33012. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33013. * @param {Object} [options.headers] - 请求头。
  33014. * @example
  33015. * var myService = new EditFeaturesService(url, {eventListeners: {
  33016. * "processCompleted": editFeatureCompleted,
  33017. * "processFailed": editFeatureError
  33018. * }
  33019. * };
  33020. * @usage
  33021. */
  33022. class EditFeaturesService extends CommonServiceBase {
  33023. constructor(url, options) {
  33024. super(url, options);
  33025. /**
  33026. * @member {boolean} [EditFeaturesService.prototype.returnContent=false]
  33027. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  33028. */
  33029. this.returnContent = false;
  33030. /**
  33031. * @member {boolean} [EditFeaturesService.prototype.isUseBatch=false]
  33032. * @description 是否使用批量添加要素功能,要素添加时有效。
  33033. * 批量添加能够提高要素编辑效率。
  33034. * true 表示批量添加;false 表示不使用批量添加。
  33035. */
  33036. this.isUseBatch = false;
  33037. if (options) {
  33038. Util_Util.extend(this, options);
  33039. }
  33040. this.url = Util_Util.urlPathAppend(this.url, 'features');
  33041. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  33042. }
  33043. /**
  33044. * @function EditFeaturesService.prototype.destroy
  33045. * @override
  33046. */
  33047. destroy() {
  33048. super.destroy();
  33049. var me = this;
  33050. me.returnContent = null;
  33051. me.isUseBatch = null;
  33052. me.fromIndex = null;
  33053. me.toIndex = null;
  33054. }
  33055. /**
  33056. * @function EditFeaturesService.prototype.processAsync
  33057. * @description 负责将客户端的更新参数传递到服务端。
  33058. * @param {EditFeaturesParameters} params - 编辑要素参数。
  33059. */
  33060. processAsync(params) {
  33061. if (!(params instanceof EditFeaturesParameters)) {
  33062. return;
  33063. }
  33064. var me = this,
  33065. method = "POST",
  33066. ids = "",
  33067. editType = params.editType,
  33068. jsonParameters = null;
  33069. me.returnContent = params.returnContent;
  33070. me.isUseBatch = params.isUseBatch;
  33071. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  33072. if (editType === EditType.DELETE) {
  33073. ids = Util_Util.toJSON(params.IDs);
  33074. jsonParameters = ids;
  33075. var urlWithIds = Util_Util.urlAppend(me.url, Util_Util.getParameterString({ids}))
  33076. if(FetchRequest.urlIsLong(urlWithIds)) {
  33077. me.url = Util_Util.urlAppend(me.url, Util_Util.getParameterString({_method: 'DELETE'}));
  33078. method = "POST";
  33079. } else{
  33080. me.url = urlWithIds;
  33081. method = "DELETE";
  33082. }
  33083. } else if (editType === EditType.UPDATE) {
  33084. method = "PUT";
  33085. } else {
  33086. if (me.isUseBatch) {
  33087. me.url = Util_Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  33088. me.returnContent = false;
  33089. }
  33090. if (me.returnContent) {
  33091. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  33092. method = "POST";
  33093. }
  33094. }
  33095. me.request({
  33096. method: method,
  33097. data: jsonParameters,
  33098. scope: me,
  33099. success: me.serviceProcessCompleted,
  33100. failure: me.serviceProcessFailed
  33101. });
  33102. }
  33103. }
  33104. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  33105. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33106. * This program are made available under the terms of the Apache License, Version 2.0
  33107. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33108. /**
  33109. * @class FacilityAnalyst3DParameters
  33110. * @deprecatedclass SuperMap.FacilityAnalyst3DParameters
  33111. * @category iServer FacilityAnalyst3D
  33112. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  33113. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  33114. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  33115. * @param {Object} options - 参数。
  33116. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  33117. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33118. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33119. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33120. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33121. * @usage
  33122. */
  33123. class FacilityAnalyst3DParameters {
  33124. constructor(options) {
  33125. /**
  33126. * @member {number} [FacilityAnalyst3DParameters.prototype.edgeID]
  33127. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33128. */
  33129. this.edgeID = null;
  33130. /**
  33131. * @member {number} [FacilityAnalyst3DParameters.prototype.nodeID]
  33132. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33133. */
  33134. this.nodeID = null;
  33135. /**
  33136. * @member {string} FacilityAnalyst3DParameters.prototype.weightName
  33137. * @description 指定的权值字段信息对象的名称。
  33138. */
  33139. this.weightName = null;
  33140. /**
  33141. * @member {boolean} [FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  33142. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33143. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33144. */
  33145. this.isUncertainDirectionValid = false;
  33146. Util_Util.extend(this, options);
  33147. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  33148. }
  33149. /**
  33150. * @function FacilityAnalyst3DParameters.prototype.destroy
  33151. * @description 释放资源,将资源的属性置空。
  33152. */
  33153. destroy() {
  33154. var me = this;
  33155. me.edgeID = null;
  33156. me.nodeID = null;
  33157. me.weightName = null;
  33158. me.isUncertainDirectionValid = null;
  33159. }
  33160. }
  33161. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  33162. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33163. * This program are made available under the terms of the Apache License, Version 2.0
  33164. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33165. /**
  33166. * @class FacilityAnalystSinks3DParameters
  33167. * @deprecatedclass SuperMap.FacilityAnalystSinks3DParameters
  33168. * @category iServer FacilityAnalyst3D Sinks
  33169. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  33170. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  33171. * @extends {FacilityAnalyst3DParameters}
  33172. * @param {Object} options - 参数。
  33173. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  33174. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33175. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33176. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33177. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33178. * @usage
  33179. */
  33180. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  33181. constructor(options) {
  33182. super(options);
  33183. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  33184. }
  33185. /**
  33186. * @function FacilityAnalystSinks3DParameters.prototype.destroy
  33187. * @override
  33188. */
  33189. destroy() {
  33190. super.destroy();
  33191. }
  33192. }
  33193. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  33194. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33195. * This program are made available under the terms of the Apache License, Version 2.0
  33196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33197. /**
  33198. * @class FacilityAnalystSinks3DService
  33199. * @deprecatedclass SuperMap.FacilityAnalystSinks3DService
  33200. * @category iServer FacilityAnalyst3D Sinks
  33201. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  33202. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  33203. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  33204. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  33205. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  33206. * @extends {CommonServiceBase}
  33207. * @example
  33208. * var myFacilityAnalystSinks3DService = new FacilityAnalystSinks3DService(url, {
  33209. * eventListeners: {
  33210. * "processCompleted": facilityAnalystSinks3DCompleted,
  33211. * "processFailed": facilityAnalystSinks3DError
  33212. * }
  33213. * });
  33214. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  33215. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  33216. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  33217. * @param {Object} options - 参数。
  33218. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33219. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33220. * @param {Object} [options.headers] - 请求头。
  33221. * @usage
  33222. */
  33223. class FacilityAnalystSinks3DService extends CommonServiceBase {
  33224. constructor(url, options) {
  33225. super(url, options);
  33226. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  33227. }
  33228. /**
  33229. * @function FacilityAnalystSinks3DService.prototype.destroy
  33230. * @override
  33231. */
  33232. destroy() {
  33233. CommonServiceBase.prototype.destroy.apply(this, arguments);
  33234. }
  33235. /**
  33236. * @function FacilityAnalystSinks3DService.prototype.processAsync
  33237. * @description 负责将客户端的查询参数传递到服务端。
  33238. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  33239. */
  33240. processAsync(params) {
  33241. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  33242. return;
  33243. }
  33244. var me = this, jsonObject;
  33245. me.url = Util_Util.urlPathAppend(me.url, 'sinks');
  33246. jsonObject = {
  33247. edgeID: params.edgeID,
  33248. nodeID: params.nodeID,
  33249. weightName: params.weightName,
  33250. isUncertainDirectionValid: params.isUncertainDirectionValid
  33251. };
  33252. me.request({
  33253. method: "GET",
  33254. params: jsonObject,
  33255. scope: me,
  33256. success: me.serviceProcessCompleted,
  33257. failure: me.serviceProcessFailed
  33258. });
  33259. }
  33260. }
  33261. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  33262. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33263. * This program are made available under the terms of the Apache License, Version 2.0
  33264. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33265. /**
  33266. * @class FacilityAnalystSources3DParameters
  33267. * @deprecatedclass SuperMap.FacilityAnalystSources3DParameters
  33268. * @category iServer FacilityAnalyst3D Sources
  33269. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  33270. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  33271. * @extends {FacilityAnalyst3DParameters}
  33272. * @param {Object} options - 参数。
  33273. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  33274. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33275. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33276. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33277. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33278. * @usage
  33279. */
  33280. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  33281. constructor(options) {
  33282. super(options);
  33283. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  33284. }
  33285. /**
  33286. * @function FacilityAnalystSources3DParameters.prototype.destroy
  33287. * @override
  33288. */
  33289. destroy() {
  33290. super.destroy();
  33291. }
  33292. }
  33293. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  33294. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33295. * This program are made available under the terms of the Apache License, Version 2.0
  33296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33297. /**
  33298. * @class FacilityAnalystSources3DService
  33299. * @deprecatedclass SuperMap.FacilityAnalystSources3DService
  33300. * @category iServer FacilityAnalyst3D Sources
  33301. * @classdesc 最近设施分析服务类(源查找资源)
  33302. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  33303. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  33304. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  33305. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  33306. * @extends {CommonServiceBase}
  33307. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  33308. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  33309. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  33310. * @param {Object} options - 参数。
  33311. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33312. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33313. * @param {Object} [options.headers] - 请求头。
  33314. * @usage
  33315. */
  33316. class FacilityAnalystSources3DService extends CommonServiceBase {
  33317. constructor(url, options) {
  33318. super(url, options);
  33319. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  33320. }
  33321. /**
  33322. * @function FacilityAnalystSources3DService.prototype.destroy
  33323. * @override
  33324. */
  33325. destroy() {
  33326. super.destroy();
  33327. }
  33328. /**
  33329. * @function FacilityAnalystSources3DService.prototype.processAsync
  33330. * @description 负责将客户端的查询参数传递到服务端。
  33331. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  33332. */
  33333. processAsync(params) {
  33334. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  33335. return;
  33336. }
  33337. var me = this, jsonObject;
  33338. me.url = Util_Util.urlPathAppend(me.url, 'sources');
  33339. jsonObject = {
  33340. edgeID: params.edgeID,
  33341. nodeID: params.nodeID,
  33342. weightName: params.weightName,
  33343. isUncertainDirectionValid: params.isUncertainDirectionValid
  33344. };
  33345. me.request({
  33346. method: "GET",
  33347. params: jsonObject,
  33348. scope: me,
  33349. success: me.serviceProcessCompleted,
  33350. failure: me.serviceProcessFailed
  33351. });
  33352. }
  33353. }
  33354. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  33355. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33356. * This program are made available under the terms of the Apache License, Version 2.0
  33357. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33358. /**
  33359. * @class FacilityAnalystStreamParameters
  33360. * @deprecatedclass SuperMap.FacilityAnalystStreamParameters
  33361. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  33362. * @classdesc 上游/下游关键设施查找资源参数类。
  33363. * @param {Object} options - 参数。
  33364. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  33365. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  33366. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33367. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33368. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  33369. * @usage
  33370. */
  33371. class FacilityAnalystStreamParameters {
  33372. constructor(options) {
  33373. /**
  33374. * @member {Array.<number>} [FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  33375. * @description 指定的设施点 ID 数组。
  33376. */
  33377. this.sourceNodeIDs = null;
  33378. /**
  33379. * @member {number} [FacilityAnalystStreamParameters.prototype.edgeID]
  33380. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33381. */
  33382. this.edgeID = null;
  33383. /**
  33384. * @member {number} [FacilityAnalystStreamParameters.prototype.nodeID]
  33385. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33386. */
  33387. this.nodeID = null;
  33388. /**
  33389. * @member {boolean} [FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  33390. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33391. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33392. */
  33393. this.isUncertainDirectionValid = false;
  33394. /**
  33395. * @member {number} FacilityAnalystStreamParameters.prototype.queryType
  33396. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  33397. */
  33398. this.queryType = null;
  33399. Util_Util.extend(this, options);
  33400. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  33401. }
  33402. /**
  33403. * @function FacilityAnalystStreamParameters.prototype.destroy
  33404. * @description 释放资源,将引用资源的属性置空。
  33405. */
  33406. destroy() {
  33407. var me = this;
  33408. me.edgeID = null;
  33409. me.nodeID = null;
  33410. me.weightName = null;
  33411. me.isUncertainDirectionValid = null;
  33412. me.type = null;
  33413. }
  33414. }
  33415. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  33416. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33417. * This program are made available under the terms of the Apache License, Version 2.0
  33418. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33419. /**
  33420. * @class FacilityAnalystStreamService
  33421. * @deprecatedclass SuperMap.FacilityAnalystStreamService
  33422. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  33423. * @classdesc 上游/下游 关键设施查找资源服务类:即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  33424. * @extends NetworkAnalystServiceBase
  33425. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  33426. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  33427. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  33428. * @param {Object} options - 参数。
  33429. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33430. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33431. * @param {Object} [options.headers] - 请求头。
  33432. * @usage
  33433. */
  33434. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  33435. constructor(url, options) {
  33436. super(url, options);
  33437. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  33438. }
  33439. /**
  33440. * @function FacilityAnalystStreamService.prototype.destroy
  33441. * @override
  33442. */
  33443. destroy() {
  33444. super.destroy();
  33445. }
  33446. /**
  33447. * @function FacilityAnalystStreamService.prototype.processAsync
  33448. * @description 负责将客户端的查询参数传递到服务端。
  33449. * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  33450. */
  33451. processAsync(params) {
  33452. if (!(params instanceof FacilityAnalystStreamParameters)) {
  33453. return;
  33454. }
  33455. var me = this,
  33456. jsonObject;
  33457. //URL 通过参数类型来判断是 上游 还是下游 查询
  33458. if (params.queryType === 0) {
  33459. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  33460. } else if (params.queryType === 1) {
  33461. me.url = Util_Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  33462. } else {
  33463. return;
  33464. }
  33465. jsonObject = {
  33466. sourceNodeIDs: params.sourceNodeIDs,
  33467. isUncertainDirectionValid: params.isUncertainDirectionValid
  33468. };
  33469. if (params.edgeID !== null && params.nodeID !== null) {
  33470. return;
  33471. }
  33472. if (params.edgeID === null && params.nodeID === null) {
  33473. return;
  33474. }
  33475. if (params.edgeID !== null) {
  33476. jsonObject.edgeID = params.edgeID;
  33477. } else {
  33478. jsonObject.nodeID = params.nodeID;
  33479. }
  33480. me.request({
  33481. method: "GET",
  33482. params: jsonObject,
  33483. scope: me,
  33484. success: me.serviceProcessCompleted,
  33485. failure: me.serviceProcessFailed
  33486. });
  33487. }
  33488. }
  33489. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  33490. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33491. * This program are made available under the terms of the Apache License, Version 2.0
  33492. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33493. /**
  33494. * @class FacilityAnalystTracedown3DParameters
  33495. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DParameters
  33496. * @category iServer FacilityAnalyst3D TraceDownResult
  33497. * @classdesc 下游追踪资源参数类。
  33498. * @extends {FacilityAnalyst3DParameters}
  33499. * @param {Object} options - 参数。
  33500. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  33501. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  33502. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  33503. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33504. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33505. * @usage
  33506. */
  33507. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  33508. constructor(options) {
  33509. super(options);
  33510. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  33511. }
  33512. /**
  33513. * @function FacilityAnalystTracedown3DParameters.prototype.destroy
  33514. * @override
  33515. */
  33516. destroy() {
  33517. super.destroy();
  33518. }
  33519. }
  33520. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  33521. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33522. * This program are made available under the terms of the Apache License, Version 2.0
  33523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33524. /**
  33525. * @class FacilityAnalystTracedown3DService
  33526. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DService
  33527. * @category iServer FacilityAnalyst3D TraceDownResult
  33528. * @classdesc 下游追踪资源服务类
  33529. * @extends {CommonServiceBase}
  33530. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  33531. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  33532. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  33533. * @param {Object} options - 参数。
  33534. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33535. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33536. * @param {Object} [options.headers] - 请求头。
  33537. * @usage
  33538. */
  33539. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  33540. constructor(url, options) {
  33541. super(url, options);
  33542. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  33543. }
  33544. /**
  33545. * @function FacilityAnalystTracedown3DService.prototype.destroy
  33546. * @override
  33547. */
  33548. destroy() {
  33549. super.destroy();
  33550. }
  33551. /**
  33552. * @function FacilityAnalystTracedown3DService.prototype.processAsync
  33553. * @description 负责将客户端的查询参数传递到服务端。
  33554. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  33555. */
  33556. processAsync(params) {
  33557. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  33558. return;
  33559. }
  33560. var me = this, jsonObject;
  33561. me.url = Util_Util.urlPathAppend(me.url, 'tracedownresult');
  33562. jsonObject = {
  33563. edgeID: params.edgeID,
  33564. nodeID: params.nodeID,
  33565. weightName: params.weightName,
  33566. isUncertainDirectionValid: params.isUncertainDirectionValid
  33567. };
  33568. me.request({
  33569. method: "GET",
  33570. params: jsonObject,
  33571. scope: me,
  33572. success: me.serviceProcessCompleted,
  33573. failure: me.serviceProcessFailed
  33574. });
  33575. }
  33576. }
  33577. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  33578. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33579. * This program are made available under the terms of the Apache License, Version 2.0
  33580. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33581. /**
  33582. * @class FacilityAnalystTraceup3DParameters
  33583. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DParameters
  33584. * @category iServer FacilityAnalyst3D TraceUpResult
  33585. * @classdesc 上游追踪资源参数类。
  33586. * @extends {FacilityAnalyst3DParameters}
  33587. * @param {Object} options - 参数。
  33588. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  33589. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  33590. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  33591. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33592. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33593. * @usage
  33594. */
  33595. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  33596. constructor(options) {
  33597. super(options);
  33598. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  33599. }
  33600. /**
  33601. * @function FacilityAnalystTraceup3DParameters.prototype.destroy
  33602. * @override
  33603. */
  33604. destroy() {
  33605. super.destroy();
  33606. }
  33607. }
  33608. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  33609. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33610. * This program are made available under the terms of the Apache License, Version 2.0
  33611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33612. /**
  33613. * @class FacilityAnalystTraceup3DService
  33614. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DService
  33615. * @category iServer FacilityAnalyst3D TraceUpResult
  33616. * @classdesc 上游追踪资源服务类
  33617. * @extends {CommonServiceBase}
  33618. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  33619. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  33620. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  33621. * @param {Object} options - 参数。
  33622. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33623. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33624. * @param {Object} [options.headers] - 请求头。
  33625. * @usage
  33626. */
  33627. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  33628. constructor(url, options) {
  33629. super(url, options);
  33630. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  33631. }
  33632. /**
  33633. * @function FacilityAnalystTraceup3DService.prototype.destroy
  33634. * @override
  33635. */
  33636. destroy() {
  33637. super.destroy();
  33638. }
  33639. /**
  33640. * @function FacilityAnalystTraceup3DService.prototype.processAsync
  33641. * @description 负责将客户端的查询参数传递到服务端。
  33642. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  33643. */
  33644. processAsync(params) {
  33645. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  33646. return;
  33647. }
  33648. var me = this, jsonObject;
  33649. me.url = Util_Util.urlPathAppend(me.url, 'traceupresult');
  33650. jsonObject = {
  33651. edgeID: params.edgeID,
  33652. nodeID: params.nodeID,
  33653. weightName: params.weightName,
  33654. isUncertainDirectionValid: params.isUncertainDirectionValid
  33655. };
  33656. me.request({
  33657. method: "GET",
  33658. params: jsonObject,
  33659. scope: me,
  33660. success: me.serviceProcessCompleted,
  33661. failure: me.serviceProcessFailed
  33662. });
  33663. }
  33664. }
  33665. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  33666. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33667. * This program are made available under the terms of the Apache License, Version 2.0
  33668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33669. /**
  33670. * @class FacilityAnalystUpstream3DParameters
  33671. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DParameters
  33672. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  33673. * @classdesc 上游关键设施查找资源参数类。
  33674. * @extends {FacilityAnalyst3DParameters}
  33675. * @param {Object} options - 参数。
  33676. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  33677. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  33678. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  33679. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  33680. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  33681. * @usage
  33682. */
  33683. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  33684. constructor(options) {
  33685. super(options);
  33686. options = options || {};
  33687. this.sourceNodeIDs = null;
  33688. Util_Util.extend(this, options);
  33689. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  33690. }
  33691. /**
  33692. * @function FacilityAnalystUpstream3DParameters.prototype.destroy
  33693. * @override
  33694. */
  33695. destroy() {
  33696. super.destroy();
  33697. this.sourceNodeIDs = null;
  33698. }
  33699. }
  33700. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  33701. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33702. * This program are made available under the terms of the Apache License, Version 2.0
  33703. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33704. /**
  33705. * @class FacilityAnalystUpstream3DService
  33706. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DService
  33707. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  33708. * @classdesc 上游关键设施查找资源服务类
  33709. * @extends {CommonServiceBase}
  33710. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  33711. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  33712. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  33713. * @param {Object} options - 参数。
  33714. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33715. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33716. * @param {Object} [options.headers] - 请求头。
  33717. * @usage
  33718. */
  33719. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  33720. constructor(url, options) {
  33721. super(url, options);
  33722. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  33723. }
  33724. /**
  33725. * @function FacilityAnalystUpstream3DService.prototype.destroy
  33726. * @override
  33727. */
  33728. destroy() {
  33729. super.destroy();
  33730. }
  33731. /**
  33732. * @function FacilityAnalystUpstream3DService.prototype.processAsync
  33733. * @description 负责将客户端的查询参数传递到服务端。
  33734. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  33735. */
  33736. processAsync(params) {
  33737. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  33738. return;
  33739. }
  33740. var me = this, jsonObject;
  33741. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  33742. jsonObject = {
  33743. sourceNodeIDs: params.sourceNodeIDs,
  33744. edgeID: params.edgeID,
  33745. nodeID: params.nodeID,
  33746. isUncertainDirectionValid: params.isUncertainDirectionValid
  33747. };
  33748. me.request({
  33749. method: "GET",
  33750. params: jsonObject,
  33751. scope: me,
  33752. success: me.serviceProcessCompleted,
  33753. failure: me.serviceProcessFailed
  33754. });
  33755. }
  33756. }
  33757. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  33758. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33759. * This program are made available under the terms of the Apache License, Version 2.0
  33760. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33761. /**
  33762. * @class FieldParameters
  33763. * @deprecatedclass SuperMap.FieldParameters
  33764. * @category iServer Data Field
  33765. * @classdesc 字段信息查询参数类。
  33766. * @param {Object} options - 参数。
  33767. * @param {string} options.datasource - 数据源名称。
  33768. * @param {string} options.dataset - 数据集名称。
  33769. * @usage
  33770. */
  33771. class FieldParameters {
  33772. constructor(options) {
  33773. /**
  33774. * @member {string} FieldParameters.prototype.datasource
  33775. * @description 要查询的数据集所在的数据源名称。
  33776. */
  33777. this.datasource = null;
  33778. /**
  33779. * @member {string} FieldParameters.prototype.dataset
  33780. * @description 要查询的数据集名称。
  33781. */
  33782. this.dataset = null;
  33783. if (options) {
  33784. Util_Util.extend(this, options);
  33785. }
  33786. this.CLASS_NAME = "SuperMap.FieldParameters";
  33787. }
  33788. /**
  33789. * @function FieldParameters.prototype.destroy
  33790. * @description 释放资源,将引用资源的属性置空。
  33791. */
  33792. destroy() {
  33793. var me = this;
  33794. me.datasource = null;
  33795. me.dataset = null;
  33796. }
  33797. }
  33798. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  33799. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33800. * This program are made available under the terms of the Apache License, Version 2.0
  33801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33802. /**
  33803. * @class FieldStatisticsParameters
  33804. * @deprecatedclass SuperMap.FieldStatisticsParameters
  33805. * @category iServer Data Field
  33806. * @classdesc 字段统计信息查询参数类。
  33807. * @param {Object} options - 参数。
  33808. * @param {string} options.datasource - 数据源名称。
  33809. * @param {string} options.dataset - 数据集名称。
  33810. * @param {string} options.fieldName - 字段名。
  33811. * @param {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} statisticMode - 字段统计方法类型。
  33812. * @extends {FieldParameters}
  33813. * @usage
  33814. */
  33815. class FieldStatisticsParameters extends FieldParameters {
  33816. constructor(options) {
  33817. super(options);
  33818. /**
  33819. * @member {string} FieldStatisticsParameters.prototype.fieldName
  33820. * @description 字段名。
  33821. */
  33822. this.fieldName = null;
  33823. /**
  33824. * @member {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} FieldStatisticsParameters.prototype.statisticMode
  33825. * @description 字段统计方法类型。
  33826. */
  33827. this.statisticMode = null;
  33828. if (options) {
  33829. Util_Util.extend(this, options);
  33830. }
  33831. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  33832. }
  33833. /**
  33834. * @function FieldStatisticsParameters.prototype.destroy
  33835. * @description 释放资源,将引用资源的属性置空。
  33836. */
  33837. destroy() {
  33838. var me = this;
  33839. me.fieldName = null;
  33840. me.statisticMode = null;
  33841. }
  33842. }
  33843. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  33844. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33845. * This program are made available under the terms of the Apache License, Version 2.0
  33846. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33847. /**
  33848. * @class FieldStatisticService
  33849. * @deprecatedclass SuperMap.FieldStatisticService
  33850. * @category iServer Data Field
  33851. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  33852. * @extends {CommonServiceBase}
  33853. * @param {string} url - 服务地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  33854. * @param {Object} options - 参数。
  33855. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  33856. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  33857. * @param {string} options.datasource - 数据集所在的数据源名称。
  33858. * @param {string} options.dataset - 数据集名称。
  33859. * @param {string} options.field - 查询统计的目标字段名称。
  33860. * @param {StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  33861. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33862. * @param {Object} [options.headers] - 请求头。
  33863. * @example
  33864. * var myService = new FieldStatisticService(url, {eventListeners: {
  33865. * "processCompleted": fieldStatisticCompleted,
  33866. * "processFailed": fieldStatisticError
  33867. * },
  33868. * datasource: "World",
  33869. * dataset: "Countries",
  33870. * field: "SmID",
  33871. * statisticMode: StatisticMode.AVERAGE
  33872. * };
  33873. * @usage
  33874. */
  33875. class FieldStatisticService extends CommonServiceBase {
  33876. constructor(url, options) {
  33877. super(url, options);
  33878. /**
  33879. * @member {string} FieldStatisticService.prototype.datasource
  33880. * @description 数据集所在的数据源名称。
  33881. */
  33882. this.datasource = null;
  33883. /**
  33884. * @member {string} FieldStatisticService.prototype.dataset
  33885. * @description 数据集名称。
  33886. */
  33887. this.dataset = null;
  33888. /**
  33889. * @member {string} FieldStatisticService.prototype.field
  33890. * @description 查询统计的目标字段名称。
  33891. */
  33892. this.field = null;
  33893. /**
  33894. * @member {StatisticMode} FieldStatisticService.prototype.statisticMode
  33895. * @description 字段查询统计的方法类型。
  33896. */
  33897. this.statisticMode = null;
  33898. if (options) {
  33899. Util_Util.extend(this, options);
  33900. }
  33901. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  33902. }
  33903. /**
  33904. * @function FieldStatisticService.prototype.destroy
  33905. * @override
  33906. */
  33907. destroy() {
  33908. super.destroy();
  33909. var me = this;
  33910. me.datasource = null;
  33911. me.dataset = null;
  33912. me.field = null;
  33913. me.statisticMode = null;
  33914. }
  33915. /**
  33916. * @function FieldStatisticService.prototype.processAsync
  33917. * @description 执行服务,进行指定字段的查询统计。
  33918. */
  33919. processAsync() {
  33920. var me = this,
  33921. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  33922. me.url = Util_Util.urlPathAppend(me.url, fieldStatisticURL);
  33923. me.request({
  33924. method: "GET",
  33925. data: null,
  33926. scope: me,
  33927. success: me.serviceProcessCompleted,
  33928. failure: me.serviceProcessFailed
  33929. });
  33930. }
  33931. }
  33932. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  33933. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33934. * This program are made available under the terms of the Apache License, Version 2.0
  33935. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33936. /**
  33937. * @class FindClosestFacilitiesParameters
  33938. * @deprecatedclass SuperMap.FindClosestFacilitiesParameters
  33939. * @category iServer NetworkAnalyst ClosestFacility
  33940. * @classdesc 最近设施分析参数类。
  33941. * @param {Object} options - 参数。
  33942. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  33943. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  33944. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  33945. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  33946. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  33947. * @param {number} [options.maxWeight=0] - 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  33948. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  33949. * @usage
  33950. */
  33951. class FindClosestFacilitiesParameters {
  33952. constructor(options) {
  33953. /**
  33954. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} FindClosestFacilitiesParameters.prototype.event
  33955. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  33956. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  33957. */
  33958. this.event = null;
  33959. /**
  33960. * @member {number} [FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  33961. * @description 要查找的设施点数量。
  33962. */
  33963. this.expectFacilityCount = 1;
  33964. /**
  33965. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [FindClosestFacilitiesParameters.prototype.facilities=false]
  33966. * @description 设施点集合,一般为提供服务的服务设施位置。
  33967. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  33968. */
  33969. this.facilities = null;
  33970. /**
  33971. * @member {boolean} [FindClosestFacilitiesParameters.prototype.fromEvent=false]
  33972. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  33973. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  33974. */
  33975. this.fromEvent = false;
  33976. /**
  33977. * @member {boolean} [FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  33978. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  33979. */
  33980. this.isAnalyzeById = false;
  33981. /**
  33982. * @member {number} [FindClosestFacilitiesParameters.prototype.maxWeight=0]
  33983. * @description 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  33984. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  33985. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  33986. */
  33987. this.maxWeight = 0;
  33988. /**
  33989. * @member {TransportationAnalystParameter} [FindClosestFacilitiesParameters.prototype.parameter]
  33990. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  33991. * 它为 TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  33992. * 则返回结果空间信息等都为空。
  33993. */
  33994. this.parameter = new TransportationAnalystParameter();
  33995. Util_Util.extend(this, options);
  33996. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  33997. }
  33998. /**
  33999. * @function FindClosestFacilitiesParameters.prototype.destroy
  34000. * @description 释放资源,将引用资源的属性置空。
  34001. */
  34002. destroy() {
  34003. var me = this;
  34004. me.event = null;
  34005. me.expectFacilityCount = null;
  34006. me.facilities = null;
  34007. me.fromEvent = null;
  34008. me.isAnalyzeById = null;
  34009. me.maxWeight = null;
  34010. if (me.parameter) {
  34011. me.parameter.destroy();
  34012. me.parameter = null;
  34013. }
  34014. }
  34015. }
  34016. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  34017. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34018. * This program are made available under the terms of the Apache License, Version 2.0
  34019. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34020. /**
  34021. * @class FindClosestFacilitiesService
  34022. * @deprecatedclass SuperMap.FindClosestFacilitiesService
  34023. * @category iServer NetworkAnalyst ClosestFacility
  34024. * @classdesc 最近设施分析服务类。
  34025. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  34026. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34027. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  34028. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  34029. * @extends {NetworkAnalystServiceBase}
  34030. * @example
  34031. * var myfindClosestFacilitiesService = new FindClosestFacilitiesService(url, {
  34032. * eventListeners: {
  34033. * "processCompleted": findClosestFacilitiesCompleted,
  34034. * "processFailed": findClosestFacilitiesError
  34035. * }
  34036. * });
  34037. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34038. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34039. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34040. * @param {Object} options - 参数。
  34041. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34042. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34043. * @param {Object} [options.headers] - 请求头。
  34044. * @usage
  34045. */
  34046. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  34047. constructor(url, options) {
  34048. super(url, options);
  34049. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  34050. }
  34051. /**
  34052. * @function FindClosestFacilitiesService.prototype.destroy
  34053. * @override
  34054. */
  34055. destroy() {
  34056. super.destroy();
  34057. }
  34058. /**
  34059. * @function FindClosestFacilitiesService.prototype.processAsync
  34060. * @description 负责将客户端的查询参数传递到服务端。
  34061. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  34062. */
  34063. processAsync(params) {
  34064. if (!(params instanceof FindClosestFacilitiesParameters)) {
  34065. return;
  34066. }
  34067. var me = this,
  34068. jsonObject;
  34069. me.url = Util_Util.urlPathAppend(me.url, 'closestfacility');
  34070. jsonObject = {
  34071. expectFacilityCount: params.expectFacilityCount,
  34072. fromEvent: params.fromEvent,
  34073. maxWeight: params.maxWeight,
  34074. parameter: Util_Util.toJSON(params.parameter),
  34075. event: Util_Util.toJSON(params.event),
  34076. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  34077. };
  34078. me.request({
  34079. method: "GET",
  34080. params: jsonObject,
  34081. scope: me,
  34082. success: me.serviceProcessCompleted,
  34083. failure: me.serviceProcessFailed
  34084. });
  34085. }
  34086. /**
  34087. * @function FindClosestFacilitiesService.prototype.getJson
  34088. * @description 将对象转化为JSON字符串。
  34089. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  34090. * @param {Array.<Object>} params - 分析参数数组
  34091. * @returns {Object} 转化后的JSON字符串。
  34092. */
  34093. getJson(isAnalyzeById, params) {
  34094. var jsonString = "[",
  34095. len = params ? params.length : 0;
  34096. if (isAnalyzeById === false) {
  34097. for (let i = 0; i < len; i++) {
  34098. if (i > 0) {
  34099. jsonString += ",";
  34100. }
  34101. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  34102. }
  34103. } else if (isAnalyzeById === true) {
  34104. for (let i = 0; i < len; i++) {
  34105. if (i > 0) {
  34106. jsonString += ",";
  34107. }
  34108. jsonString += params[i];
  34109. }
  34110. }
  34111. jsonString += ']';
  34112. return jsonString;
  34113. }
  34114. /**
  34115. * @function FindClosestFacilitiesService.prototype.toGeoJSONResult
  34116. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  34117. * @param {Object} result - 服务器返回的结果对象。
  34118. */
  34119. toGeoJSONResult(result) {
  34120. if (!result || !result.facilityPathList) {
  34121. return result;
  34122. }
  34123. var geoJSONFormat = new GeoJSON();
  34124. result.facilityPathList.map(function (path) {
  34125. if (path.route) {
  34126. path.route = geoJSONFormat.toGeoJSON(path.route);
  34127. }
  34128. if (path.pathGuideItems) {
  34129. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  34130. }
  34131. if (path.edgeFeatures) {
  34132. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  34133. }
  34134. if (path.nodeFeatures) {
  34135. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  34136. }
  34137. return path;
  34138. });
  34139. return result;
  34140. }
  34141. }
  34142. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  34143. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34144. * This program are made available under the terms of the Apache License, Version 2.0
  34145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34146. /**
  34147. * @class FindLocationParameters
  34148. * @deprecatedclass SuperMap.FindLocationParameters
  34149. * @category iServer NetworkAnalyst Location
  34150. * @classdesc 选址分区分析参数类。
  34151. * @param {Object} options - 参数。
  34152. * @param {string} options.turnWeightField - 转向权值字段的名称。
  34153. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  34154. * @param {Array.<SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  34155. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  34156. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  34157. * @usage
  34158. */
  34159. class FindLocationParameters {
  34160. constructor(options) {
  34161. /**
  34162. * @member {number} [FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  34163. * @description 期望用于最终设施选址的资源供给中心数量。
  34164. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  34165. */
  34166. this.expectedSupplyCenterCount = null;
  34167. /**
  34168. * @member {boolean} [FindLocationParameters.prototype.isFromCenter=false]
  34169. * @description 是否从中心点开始分配资源。
  34170. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  34171. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  34172. */
  34173. this.isFromCenter = false;
  34174. /**
  34175. * @member {Array.<SupplyCenter>} FindLocationParameters.prototype.supplyCenters
  34176. * @description 资源供给中心集合。
  34177. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  34178. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  34179. */
  34180. this.supplyCenters = null;
  34181. /**
  34182. * @member {string} FindLocationParameters.prototype.turnWeightField
  34183. * @description 转向权值字段的名称。
  34184. */
  34185. this.turnWeightField = null;
  34186. /**
  34187. * @member {string} FindLocationParameters.prototype.weightName
  34188. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  34189. */
  34190. this.weightName = null;
  34191. Util_Util.extend(this, options);
  34192. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  34193. }
  34194. /**
  34195. * @function FindLocationParameters.prototype.destroy
  34196. * @description 释放资源,将引用资源的属性置空。
  34197. */
  34198. destroy() {
  34199. var me = this;
  34200. me.expectedSupplyCenterCount = null;
  34201. me.isFromCenter = null;
  34202. me.turnWeightField = null;
  34203. me.weightName = null;
  34204. if (me.supplyCenters) {
  34205. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  34206. supplyCenters[i].destroy();
  34207. }
  34208. me.supplyCenters = null;
  34209. }
  34210. }
  34211. }
  34212. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  34213. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34214. * This program are made available under the terms of the Apache License, Version 2.0
  34215. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34216. /**
  34217. * @class FindLocationService
  34218. * @deprecatedclass SuperMap.FindLocationService
  34219. * @category iServer NetworkAnalyst Location
  34220. * @classdesc 选址分区分析服务类。
  34221. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  34222. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  34223. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  34224. * @extends {NetworkAnalystServiceBase}
  34225. * @example
  34226. * (start code)
  34227. * var findLocationService = new FindLocationService(url, {
  34228. * eventListeners: {
  34229. * "processCompleted": findLocationCompleted,
  34230. * "processFailed": findLocationError
  34231. * }
  34232. * });
  34233. * (end)
  34234. * @param {string} url - 服务地址。
  34235. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  34236. * @param {Object} options - 参数。
  34237. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34238. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34239. * @param {Object} [options.headers] - 请求头。
  34240. * @usage
  34241. */
  34242. class FindLocationService extends NetworkAnalystServiceBase {
  34243. constructor(url, options) {
  34244. super(url, options);
  34245. this.CLASS_NAME = "SuperMap.FindLocationService";
  34246. }
  34247. /**
  34248. * @function FindLocationService.prototype.destroy
  34249. * @override
  34250. */
  34251. destroy() {
  34252. super.destroy();
  34253. }
  34254. /**
  34255. * @function FindLocationService.prototype.processAsync
  34256. * @description 负责将客户端的查询参数传递到服务端。
  34257. * @param {FindLocationParameters} params - 选址分区分析服务参数类
  34258. */
  34259. processAsync(params) {
  34260. if (!(params instanceof FindLocationParameters)) {
  34261. return;
  34262. }
  34263. var me = this,
  34264. jsonObject;
  34265. me.url = Util_Util.urlPathAppend(me.url, 'location');
  34266. jsonObject = {
  34267. isFromCenter: params.isFromCenter,
  34268. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  34269. weightName: params.weightName,
  34270. turnWeightField: params.turnWeightField,
  34271. returnEdgeFeature: true,
  34272. returnEdgeGeometry: true,
  34273. returnNodeFeature: true,
  34274. mapParameter: Util_Util.toJSON(params.mapParameter),
  34275. supplyCenters: me.getCentersJson(params.supplyCenters)
  34276. };
  34277. me.request({
  34278. method: "GET",
  34279. params: jsonObject,
  34280. scope: me,
  34281. success: me.serviceProcessCompleted,
  34282. failure: me.serviceProcessFailed
  34283. });
  34284. }
  34285. /**
  34286. * @function FindLocationService.prototype.getCentersJson
  34287. * @description 将数组对象转化为JSON字符串。
  34288. * @param {Array} params - 需要转换的参数
  34289. * @returns {string} 转化后的JSON字符串。
  34290. */
  34291. getCentersJson(params) {
  34292. var json = "[",
  34293. len = params ? params.length : 0;
  34294. for (var i = 0; i < len; i++) {
  34295. if (i > 0) {
  34296. json += ",";
  34297. }
  34298. json += Util_Util.toJSON(params[i]);
  34299. }
  34300. json += "]";
  34301. return json;
  34302. }
  34303. /**
  34304. * @function FindLocationService.prototype.toGeoJSONResult
  34305. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  34306. * @param {Object} result - 服务器返回的结果对象。
  34307. */
  34308. toGeoJSONResult(result) {
  34309. if (!result) {
  34310. return null;
  34311. }
  34312. var geoJSONFormat = new GeoJSON();
  34313. if (result.demandResults) {
  34314. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  34315. }
  34316. if (result.supplyResults) {
  34317. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  34318. }
  34319. return result;
  34320. }
  34321. }
  34322. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  34323. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34324. * This program are made available under the terms of the Apache License, Version 2.0
  34325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34326. /**
  34327. * @class FindMTSPPathsParameters
  34328. * @deprecatedclass SuperMap.FindMTSPPathsParameters
  34329. * @category iServer NetworkAnalyst MTSPPath
  34330. * @classdesc 多旅行商分析参数类。
  34331. * @param {Object} options - 参数。
  34332. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 配送中心集合。
  34333. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  34334. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  34335. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  34336. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  34337. * @usage
  34338. */
  34339. class FindMTSPPathsParameters {
  34340. constructor(options) {
  34341. /**
  34342. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.centers
  34343. * @description 配送中心集合。
  34344. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  34345. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  34346. */
  34347. this.centers = null;
  34348. /**
  34349. * @member {boolean} [FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  34350. * @description 配送模式是否为总花费最小方案。
  34351. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  34352. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  34353. */
  34354. this.hasLeastTotalCost = false;
  34355. /**
  34356. * @member {boolean} [FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  34357. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  34358. */
  34359. this.isAnalyzeById = false;
  34360. /**
  34361. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.nodes
  34362. * @description 配送目标集合。
  34363. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  34364. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  34365. */
  34366. this.nodes = null;
  34367. /**
  34368. * @member {TransportationAnalystParameter} [FindMTSPPathsParameters.prototype.parameter]
  34369. * @description 交通网络分析通用参数。
  34370. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  34371. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  34372. */
  34373. this.parameter = new TransportationAnalystParameter();
  34374. Util_Util.extend(this, options);
  34375. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  34376. }
  34377. /**
  34378. * @function FindMTSPPathsParameters.prototype.destroy
  34379. * @description 释放资源,将引用资源的属性置空。
  34380. */
  34381. destroy() {
  34382. var me = this;
  34383. me.centers = null;
  34384. me.hasLeastTotalCost = null;
  34385. me.isAnalyzeById = null;
  34386. me.nodes = null;
  34387. me.maxWeight = null;
  34388. if (me.parameter) {
  34389. me.parameter.destroy();
  34390. me.parameter = null;
  34391. }
  34392. }
  34393. }
  34394. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  34395. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34396. * This program are made available under the terms of the Apache License, Version 2.0
  34397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34398. /**
  34399. * @class FindMTSPPathsService
  34400. * @deprecatedclass SuperMap.FindMTSPPathsService
  34401. * @category iServer NetworkAnalyst MTSPPath
  34402. * @classdesc 多旅行商分析服务类
  34403. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  34404. * 查找经济有效的配送路径,并给出相应的行走路线。
  34405. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  34406. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  34407. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取。
  34408. * @extends {NetworkAnalystServiceBase}
  34409. * @example
  34410. * var myFindMTSPPathsService = new FindMTSPPathsService(url, {
  34411. * eventListeners: {
  34412. * "processCompleted": findMTSPPathsCompleted,
  34413. * "processFailed": findMTSPPathsError
  34414. * }
  34415. * });
  34416. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34417. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34418. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34419. * @param {Object} options - 互服务时所需可选参数。如:
  34420. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34421. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34422. * @param {Object} [options.headers] - 请求头。
  34423. * @usage
  34424. */
  34425. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  34426. constructor(url, options) {
  34427. super(url, options);
  34428. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  34429. }
  34430. /**
  34431. * @function FindMTSPPathsService.prototype.destroy
  34432. * @override
  34433. */
  34434. destroy() {
  34435. super.destroy();
  34436. }
  34437. /**
  34438. * @function FindMTSPPathsService..prototype.processAsync
  34439. * @description 负责将客户端的查询参数传递到服务端。
  34440. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  34441. */
  34442. processAsync(params) {
  34443. if (!(params instanceof FindMTSPPathsParameters)) {
  34444. return;
  34445. }
  34446. var me = this,
  34447. jsonObject,
  34448. //end = me.url.substr(me.url.length - 1, 1),
  34449. centers = me.getJson(params.isAnalyzeById, params.centers),
  34450. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  34451. me.url = Util_Util.urlPathAppend(me.url, 'mtsppath');
  34452. jsonObject = {
  34453. centers: centers,
  34454. nodes: nodes,
  34455. parameter: Util_Util.toJSON(params.parameter),
  34456. hasLeastTotalCost: params.hasLeastTotalCost
  34457. };
  34458. me.request({
  34459. method: "GET",
  34460. params: jsonObject,
  34461. scope: me,
  34462. success: me.serviceProcessCompleted,
  34463. failure: me.serviceProcessFailed
  34464. });
  34465. }
  34466. /**
  34467. * @function FindMTSPPathsService.prototype.getJson
  34468. * @description 将对象转化为JSON字符串。
  34469. * @param {boolean} isAnalyzeById - 是否通过id分析
  34470. * @param {Array} params - 需要转换的数字
  34471. * @returns {Object} 转化后的JSON字符串。
  34472. */
  34473. getJson(isAnalyzeById, params) {
  34474. var jsonString = "[",
  34475. len = params ? params.length : 0;
  34476. if (isAnalyzeById === false) {
  34477. for (let i = 0; i < len; i++) {
  34478. if (i > 0) {
  34479. jsonString += ",";
  34480. }
  34481. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  34482. }
  34483. } else if (isAnalyzeById === true) {
  34484. for (let i = 0; i < len; i++) {
  34485. if (i > 0) {
  34486. jsonString += ",";
  34487. }
  34488. jsonString += params[i];
  34489. }
  34490. }
  34491. jsonString += ']';
  34492. return jsonString;
  34493. }
  34494. /**
  34495. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  34496. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  34497. * @param {Object} result - 服务器返回的结果对象。
  34498. */
  34499. toGeoJSONResult(result) {
  34500. if (!result || !result.pathList) {
  34501. return null;
  34502. }
  34503. var geoJSONFormat = new GeoJSON();
  34504. result.pathList.map(function (path) {
  34505. if (path.route) {
  34506. path.route = geoJSONFormat.toGeoJSON(path.route);
  34507. }
  34508. if (path.pathGuideItems) {
  34509. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  34510. }
  34511. if (path.edgeFeatures) {
  34512. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  34513. }
  34514. if (path.nodeFeatures) {
  34515. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  34516. }
  34517. return path;
  34518. });
  34519. return result;
  34520. }
  34521. }
  34522. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  34523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34524. * This program are made available under the terms of the Apache License, Version 2.0
  34525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34526. /**
  34527. * @class FindPathParameters
  34528. * @deprecatedclass SuperMap.FindPathParameters
  34529. * @category iServer NetworkAnalyst Path
  34530. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  34531. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  34532. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  34533. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  34534. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  34535. * 阻抗值通过 {@link TransportationAnalystParameter#weightFieldName}设置。
  34536. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link TransportationAnalystParameter#turnWeightField} 设置。
  34537. *
  34538. * @param {Object} options - 参数。
  34539. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  34540. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  34541. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  34542. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  34543. * @usage
  34544. */
  34545. class FindPathParameters {
  34546. constructor(options) {
  34547. /**
  34548. * @member {boolean} [FindPathParameters.prototype.isAnalyzeById=false]
  34549. * @description 是否通过节点 ID 指定路径分析的结点。
  34550. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  34551. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindPathParameters.nodes = [ID1,ID2,...];
  34552. * 反之表示通过结点坐标指定途经点,即 FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  34553. */
  34554. this.isAnalyzeById = false;
  34555. /**
  34556. * @member {boolean} [FindPathParameters.prototype.hasLeastEdgeCount=false]
  34557. * @description 是否按照弧段数最少的进行最佳路径分析。
  34558. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  34559. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  34560. */
  34561. this.hasLeastEdgeCount = null;
  34562. /**
  34563. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindPathParameters.prototype.nodes
  34564. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  34565. * 当 FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  34566. * 当 FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  34567. */
  34568. this.nodes = null;
  34569. /**
  34570. * @member {TransportationAnalystParameter} FindPathParameters.prototype.parameter
  34571. * @description 交通网络分析通用参数。
  34572. */
  34573. this.parameter = new TransportationAnalystParameter();
  34574. Util_Util.extend(this, options);
  34575. this.CLASS_NAME = "SuperMap.FindPathParameters";
  34576. }
  34577. /**
  34578. * @function FindPathParameters.prototype.destroy
  34579. * @description 释放资源,将引用资源的属性置空。
  34580. */
  34581. destroy() {
  34582. var me = this;
  34583. me.isAnalyzeById = null;
  34584. me.hasLeastEdgeCount = null;
  34585. me.nodes = null;
  34586. if (me.parameter) {
  34587. me.parameter.destroy();
  34588. me.parameter = null;
  34589. }
  34590. }
  34591. }
  34592. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  34593. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34594. * This program are made available under the terms of the Apache License, Version 2.0
  34595. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34596. /**
  34597. * @class FindPathService
  34598. * @deprecatedclass SuperMap.FindPathService
  34599. * @category iServer NetworkAnalyst Path
  34600. * @classdesc 最佳路径分析服务类。
  34601. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  34602. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  34603. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  34604. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  34605. * @extends {NetworkAnalystServiceBase}
  34606. * @example
  34607. * var myFindPathService = new FindPathService(url, {
  34608. * eventListeners: {
  34609. * "processCompleted": findPathCompleted,
  34610. * "processFailed": findPathError
  34611. * }
  34612. * });
  34613. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34614. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34615. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34616. * @param {Object} options - 参数。
  34617. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34618. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34619. * @param {Object} [options.headers] - 请求头。
  34620. * @usage
  34621. */
  34622. class FindPathService extends NetworkAnalystServiceBase {
  34623. constructor(url, options) {
  34624. super(url, options);
  34625. this.CLASS_NAME = "SuperMap.FindPathService";
  34626. }
  34627. /**
  34628. * @function FindPathService.prototype.destroy
  34629. * @override
  34630. */
  34631. destroy() {
  34632. super.destroy();
  34633. }
  34634. /**
  34635. * @function FindPathService.prototype.processAsync
  34636. * @description 负责将客户端的查询参数传递到服务端。
  34637. * @param {FindPathParameters} params - 最佳路径分析服务参数类
  34638. */
  34639. processAsync(params) {
  34640. if (!(params instanceof FindPathParameters)) {
  34641. return;
  34642. }
  34643. var me = this, jsonObject;
  34644. me.url = Util_Util.urlPathAppend(me.url, 'path');
  34645. jsonObject = {
  34646. hasLeastEdgeCount: params.hasLeastEdgeCount,
  34647. parameter: Util_Util.toJSON(params.parameter),
  34648. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  34649. };
  34650. me.request({
  34651. method: "GET",
  34652. params: jsonObject,
  34653. scope: me,
  34654. success: me.serviceProcessCompleted,
  34655. failure: me.serviceProcessFailed
  34656. });
  34657. }
  34658. /**
  34659. * @function FindPathService.prototype.getJson
  34660. * @description 将对象转化为JSON字符串。
  34661. * @param {boolean} isAnalyzeById - 是否通过id分析
  34662. * @param {Array} params - 需要转换的数字
  34663. * @returns {Object} 转化后的JSON字符串。
  34664. */
  34665. getJson(isAnalyzeById, params) {
  34666. var jsonString = "[",
  34667. len = params ? params.length : 0;
  34668. if (isAnalyzeById === false) {
  34669. for (let i = 0; i < len; i++) {
  34670. if (i > 0) {
  34671. jsonString += ",";
  34672. }
  34673. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  34674. }
  34675. } else if (isAnalyzeById === true) {
  34676. for (let i = 0; i < len; i++) {
  34677. if (i > 0) {
  34678. jsonString += ",";
  34679. }
  34680. jsonString += params[i];
  34681. }
  34682. }
  34683. jsonString += ']';
  34684. return jsonString;
  34685. }
  34686. /**
  34687. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  34688. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  34689. * @param {Object} result - 服务器返回的结果对象。
  34690. */
  34691. toGeoJSONResult(result) {
  34692. if (!result || !result.pathList || result.pathList.length < 1) {
  34693. return null;
  34694. }
  34695. var geoJSONFormat = new GeoJSON();
  34696. result.pathList.forEach(function (path) {
  34697. if (path.route) {
  34698. path.route = geoJSONFormat.toGeoJSON(path.route);
  34699. }
  34700. if (path.pathGuideItems) {
  34701. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  34702. }
  34703. if (path.edgeFeatures) {
  34704. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  34705. }
  34706. if (path.nodeFeatures) {
  34707. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  34708. }
  34709. });
  34710. return result;
  34711. }
  34712. }
  34713. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  34714. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34715. * This program are made available under the terms of the Apache License, Version 2.0
  34716. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34717. /**
  34718. * @class FindServiceAreasParameters
  34719. * @deprecatedclass SuperMap.FindServiceAreasParameters
  34720. * @category iServer NetworkAnalyst ServiceArea
  34721. * @classdesc 服务区分析参数类。
  34722. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  34723. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  34724. * @param {Object} options - 参数。
  34725. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  34726. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 服务站点数组。
  34727. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  34728. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  34729. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  34730. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  34731. * @usage
  34732. */
  34733. class FindServiceAreasParameters {
  34734. constructor(options) {
  34735. /**
  34736. * @member {boolean} [FindServiceAreasParameters.prototype.isAnalyzeById=false]
  34737. * @description 是否通过节点 ID 指定路径分析的结点。
  34738. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  34739. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindServiceAreasParameters.centers = [ID1,ID2,...];
  34740. * 反之表示通过结点坐标指定途经点,即 FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  34741. */
  34742. this.isAnalyzeById = false;
  34743. /**
  34744. * @member {boolean} [FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  34745. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  34746. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  34747. */
  34748. this.isCenterMutuallyExclusive = false;
  34749. /**
  34750. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindServiceAreasParameters.prototype.centers
  34751. * @description 服务站点数组。
  34752. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  34753. */
  34754. this.centers = null;
  34755. /**
  34756. * @member {boolean} [FindServiceAreasParameters.prototype.isFromCenter=false]
  34757. * @description 是否从中心点开始分析。
  34758. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  34759. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  34760. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  34761. */
  34762. this.isFromCenter = false;
  34763. /**
  34764. * APIProperty: weights
  34765. * @member {Array.<number>} FindServiceAreasParameters.prototype.weights
  34766. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  34767. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  34768. */
  34769. this.weights = null;
  34770. /**
  34771. * @member {TransportationAnalystParameter} FindServiceAreasParameters.prototype.parameter
  34772. * @description 交通网络分析通用参数。
  34773. */
  34774. this.parameter = new TransportationAnalystParameter();
  34775. Util_Util.extend(this, options);
  34776. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  34777. }
  34778. /**
  34779. * @function FindServiceAreasParameters.prototype.destroy
  34780. * @description 释放资源,将引用资源的属性置空。
  34781. */
  34782. destroy() {
  34783. var me = this;
  34784. me.isAnalyzeById = null;
  34785. me.isCenterMutuallyExclusive = null;
  34786. me.centers = null;
  34787. me.isFromCenter = null;
  34788. me.weights = null;
  34789. if (me.parameter) {
  34790. me.parameter.destroy();
  34791. me.parameter = null;
  34792. }
  34793. }
  34794. }
  34795. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  34796. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34797. * This program are made available under the terms of the Apache License, Version 2.0
  34798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34799. /**
  34800. * @class FindServiceAreasService
  34801. * @deprecatedclass SuperMap.FindServiceAreasService
  34802. * @category iServer NetworkAnalyst ServiceArea
  34803. * @classdesc 服务区分析服务类。
  34804. * 服务区分析是以指定服务站点为中心,
  34805. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  34806. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  34807. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  34808. * @extends {NetworkAnalystServiceBase}
  34809. * @example
  34810. * var myFindServiceAreasService = new FindServiceAreasService(url, {
  34811. * eventListeners: {
  34812. * "processCompleted": findServiceAreasCompleted,
  34813. * "processFailed": findServiceAreasError
  34814. * }
  34815. * });
  34816. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34817. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34818. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34819. * @param {Object} options - 互服务时所需可选参数。如:
  34820. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  34821. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34822. * @param {Object} [options.headers] - 请求头。
  34823. * @usage
  34824. */
  34825. class FindServiceAreasService extends NetworkAnalystServiceBase {
  34826. constructor(url, options) {
  34827. super(url, options);
  34828. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  34829. }
  34830. /**
  34831. * @function FindServiceAreasService.prototype.destroy
  34832. * @override
  34833. */
  34834. destroy() {
  34835. super.destroy();
  34836. }
  34837. /**
  34838. * @function FindServiceAreasService.prototype.processAsync
  34839. * @description 负责将客户端的查询参数传递到服务端。
  34840. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类
  34841. */
  34842. processAsync(params) {
  34843. if (!(params instanceof FindServiceAreasParameters)) {
  34844. return;
  34845. }
  34846. var me = this, jsonObject;
  34847. me.url = Util_Util.urlPathAppend(me.url, 'servicearea');
  34848. jsonObject = {
  34849. isFromCenter: params.isFromCenter,
  34850. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  34851. parameter: Util_Util.toJSON(params.parameter),
  34852. centers: me.getJson(params.isAnalyzeById, params.centers),
  34853. weights: me.getJson(true, params.weights)
  34854. };
  34855. me.request({
  34856. method: "GET",
  34857. params: jsonObject,
  34858. scope: me,
  34859. success: me.serviceProcessCompleted,
  34860. failure: me.serviceProcessFailed
  34861. });
  34862. }
  34863. /**
  34864. * @function FindServiceAreasService.prototype.getJson
  34865. * @description 将对象转化为JSON字符串。
  34866. * @param {boolean} isAnalyzeById - 是否通过id分析
  34867. * @param {Array} params - 需要转换的数字
  34868. * @returns {Object} 转化后的JSON字符串。
  34869. */
  34870. getJson(isAnalyzeById, params) {
  34871. var jsonString = "[",
  34872. len = params ? params.length : 0;
  34873. if (isAnalyzeById === false) {
  34874. for (let i = 0; i < len; i++) {
  34875. if (i > 0) {
  34876. jsonString += ",";
  34877. }
  34878. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  34879. }
  34880. } else if (isAnalyzeById === true) {
  34881. for (let i = 0; i < len; i++) {
  34882. if (i > 0) {
  34883. jsonString += ",";
  34884. }
  34885. jsonString += params[i];
  34886. }
  34887. }
  34888. jsonString += ']';
  34889. return jsonString;
  34890. }
  34891. /**
  34892. * @function FindServiceAreasService.prototype.toGeoJSONResult
  34893. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  34894. * @param {Object} result - 服务器返回的结果对象。
  34895. */
  34896. toGeoJSONResult(result) {
  34897. if (!result || !result.serviceAreaList) {
  34898. return result;
  34899. }
  34900. var geoJSONFormat = new GeoJSON();
  34901. result.serviceAreaList.map(function (serviceArea) {
  34902. if (serviceArea.serviceRegion) {
  34903. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  34904. }
  34905. if (serviceArea.edgeFeatures) {
  34906. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  34907. }
  34908. if (serviceArea.nodeFeatures) {
  34909. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  34910. }
  34911. if (serviceArea.routes) {
  34912. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  34913. }
  34914. return serviceArea;
  34915. });
  34916. return result;
  34917. }
  34918. }
  34919. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  34920. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34921. * This program are made available under the terms of the Apache License, Version 2.0
  34922. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34923. /**
  34924. * @class FindTSPPathsParameters
  34925. * @deprecatedclass SuperMap.FindTSPPathsParameters
  34926. * @category iServer NetworkAnalyst TSPPath
  34927. * @classdesc 旅行商分析参数类。
  34928. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  34929. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  34930. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同。
  34931. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  34932. * @param {Object} options - 参数。
  34933. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  34934. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  34935. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  34936. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  34937. * @usage
  34938. */
  34939. class FindTSPPathsParameters {
  34940. constructor(options) {
  34941. /**
  34942. * @member {boolean} [FindTSPPathsParameters.prototype.endNodeAssigned=false]
  34943. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  34944. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  34945. */
  34946. this.endNodeAssigned = false;
  34947. /**
  34948. * @member {boolean} [FindTSPPathsParameters.prototype.isAnalyzeById=false]
  34949. * @description 是否通过节点 ID 号来指定途经点。
  34950. */
  34951. this.isAnalyzeById = false;
  34952. /**
  34953. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindTSPPathsParameters.prototype.nodes
  34954. * @description 旅行商分析途经点数组。
  34955. * 当 FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  34956. * 当 FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  34957. */
  34958. this.nodes = null;
  34959. /**
  34960. * @member {TransportationAnalystParameter} [FindTSPPathsParameters.prototype.parameter]
  34961. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  34962. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  34963. * 字段,则返回结果空间信息等都为空。
  34964. */
  34965. this.parameter = new TransportationAnalystParameter();
  34966. Util_Util.extend(this, options);
  34967. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  34968. }
  34969. /**
  34970. * @function FindTSPPathsParameters.prototype.destroy
  34971. * @description 释放资源,将引用资源的属性置空。
  34972. */
  34973. destroy() {
  34974. var me = this;
  34975. me.endNodeAssigned = null;
  34976. me.isAnalyzeById = null;
  34977. me.nodes = null;
  34978. if (me.parameter) {
  34979. me.parameter.destroy();
  34980. me.parameter = null;
  34981. }
  34982. }
  34983. }
  34984. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  34985. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34986. * This program are made available under the terms of the Apache License, Version 2.0
  34987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34988. /**
  34989. * @class FindTSPPathsService
  34990. * @deprecatedclass SuperMap.FindTSPPathsService
  34991. * @category iServer NetworkAnalyst TSPPath
  34992. * @classdesc 旅行商分析服务类
  34993. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  34994. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  34995. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  34996. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  34997. * @extends {NetworkAnalystServiceBase}
  34998. * @example
  34999. * (start code)
  35000. * var myFindTSPPathsService = new FindTSPPathsService(url, {
  35001. * eventListeners: {
  35002. * "processCompleted": findTSPPathsCompleted,
  35003. * "processFailed": findTSPPathsError
  35004. * }
  35005. * });
  35006. * (end)
  35007. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  35008. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  35009. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  35010. * @param {Object} options - 参数。
  35011. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35012. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35013. * @param {Object} [options.headers] - 请求头。
  35014. * @usage
  35015. */
  35016. class FindTSPPathsService extends NetworkAnalystServiceBase {
  35017. constructor(url, options) {
  35018. super(url, options);
  35019. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  35020. }
  35021. /**
  35022. * @function FindTSPPathsService.prototype.destroy
  35023. * @override
  35024. */
  35025. destroy() {
  35026. super.destroy();
  35027. }
  35028. /**
  35029. * @function FindTSPPathsService.prototype.processAsync
  35030. * @description 负责将客户端的查询参数传递到服务端。
  35031. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  35032. */
  35033. processAsync(params) {
  35034. if (!(params instanceof FindTSPPathsParameters)) {
  35035. return;
  35036. }
  35037. var me = this, jsonObject;
  35038. me.url = Util_Util.urlPathAppend(me.url, 'tsppath');
  35039. jsonObject = {
  35040. parameter: Util_Util.toJSON(params.parameter),
  35041. endNodeAssigned: params.endNodeAssigned,
  35042. nodes: me.getNodesJson(params)
  35043. };
  35044. me.request({
  35045. method: "GET",
  35046. params: jsonObject,
  35047. scope: me,
  35048. success: me.serviceProcessCompleted,
  35049. failure: me.serviceProcessFailed
  35050. });
  35051. }
  35052. /**
  35053. * @function FindTSPPathsService.prototype.getNodesJson
  35054. * @description 将节点对象转化为JSON字符串。
  35055. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  35056. * @returns {string} 转化后的JSON字符串。
  35057. */
  35058. getNodesJson(params) {
  35059. var jsonParameters = "", nodesString, i, len, nodes;
  35060. if (params.isAnalyzeById === false) {
  35061. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  35062. if (i > 0) {
  35063. nodesString += ",";
  35064. }
  35065. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  35066. }
  35067. nodesString += ']';
  35068. jsonParameters += nodesString;
  35069. } else if (params.isAnalyzeById === true) {
  35070. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  35071. for (let i = 0; i < len; i++) {
  35072. if (i > 0) {
  35073. nodeIDsString += ",";
  35074. }
  35075. nodeIDsString += nodes[i];
  35076. }
  35077. nodeIDsString += ']';
  35078. jsonParameters += nodeIDsString;
  35079. }
  35080. return jsonParameters;
  35081. }
  35082. /**
  35083. * @function FindTSPPathsService.prototype.toGeoJSONResult
  35084. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35085. * @param {Object} result - 服务器返回的结果对象。
  35086. */
  35087. toGeoJSONResult(result) {
  35088. if (!result || !result.tspPathList) {
  35089. return null;
  35090. }
  35091. var geoJSONFormat = new GeoJSON();
  35092. result.tspPathList.forEach(function (path) {
  35093. if (path.route) {
  35094. path.route = geoJSONFormat.toGeoJSON(path.route);
  35095. }
  35096. if (path.pathGuideItems) {
  35097. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  35098. }
  35099. if (path.edgeFeatures) {
  35100. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  35101. }
  35102. if (path.nodeFeatures) {
  35103. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  35104. }
  35105. });
  35106. return result;
  35107. }
  35108. }
  35109. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  35110. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35111. * This program are made available under the terms of the Apache License, Version 2.0
  35112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35113. /**
  35114. * @class GenerateSpatialDataParameters
  35115. * @deprecatedclass SuperMap.GenerateSpatialDataParameters
  35116. * @category iServer SpatialAnalyst GenerateSpatialData
  35117. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  35118. * @param {Object} options - 参数。
  35119. * @param {string} options.routeTable - 路由数据集。
  35120. * @param {string} options.routeIDField - 路由数据集的标识字段。
  35121. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  35122. * @param {DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  35123. * @param {string} [options.attributeFilter] - 属性过滤条件。
  35124. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  35125. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  35126. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  35127. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  35128. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  35129. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  35130. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  35131. * @usage
  35132. */
  35133. class GenerateSpatialDataParameters {
  35134. constructor(options) {
  35135. /**
  35136. * @member {string} GenerateSpatialDataParameters.prototype.routeTable
  35137. * @description 路由数据集。
  35138. */
  35139. this.routeTable = null;
  35140. /**
  35141. * @member {string} GenerateSpatialDataParameters.prototype.routeIDField
  35142. * @description 路由数据集的标识字段。
  35143. */
  35144. this.routeIDField = null;
  35145. /**
  35146. * @member {string} [GenerateSpatialDataParameters.prototype.attributeFilter]
  35147. * @description 属性过滤条件。
  35148. * 当 {@link GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  35149. */
  35150. this.attributeFilter = null;
  35151. /**
  35152. * @member {string} GenerateSpatialDataParameters.prototype.eventTable
  35153. * @description 用于生成空间数据的事件表名。
  35154. */
  35155. this.eventTable = null;
  35156. /**
  35157. * @member {string} GenerateSpatialDataParameters.prototype.eventRouteIDField
  35158. * @description 用于生成空间数据的事件表的路由标识字段。
  35159. */
  35160. this.eventRouteIDField = null;
  35161. /**
  35162. * @member {string} [GenerateSpatialDataParameters.prototype.measureField]
  35163. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  35164. */
  35165. this.measureField = null;
  35166. /**
  35167. * @member {string} [GenerateSpatialDataParameters.prototype.measureStartField]
  35168. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  35169. */
  35170. this.measureStartField = null;
  35171. /**
  35172. * @member {string} [GenerateSpatialDataParameters.prototype.measureEndField]
  35173. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  35174. */
  35175. this.measureEndField = null;
  35176. /**
  35177. * @member {string} [GenerateSpatialDataParameters.prototype.measureOffsetField]
  35178. * @description 刻度偏移量字段。
  35179. */
  35180. this.measureOffsetField = null;
  35181. /**
  35182. * @member {string} [GenerateSpatialDataParameters.prototype.errorInfoField]
  35183. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  35184. */
  35185. this.errorInfoField = null;
  35186. /**
  35187. * @member {Array.<string>} [GenerateSpatialDataParameters.prototype.retainedFields]
  35188. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  35189. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  35190. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  35191. */
  35192. this.retainedFields = null;
  35193. /**
  35194. * @member {DataReturnOption} GenerateSpatialDataParameters.prototype.dataReturnOption
  35195. * @description 设置数据返回的选项。
  35196. */
  35197. this.dataReturnOption = null;
  35198. if (options) {
  35199. Util_Util.extend(this, options);
  35200. }
  35201. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  35202. }
  35203. /**
  35204. * @function GenerateSpatialDataParameters.prototype.destroy
  35205. * @description 释放资源,将引用资源的属性置空。
  35206. */
  35207. destroy() {
  35208. var me = this;
  35209. if (me.routeTable) {
  35210. me.routeTable = null;
  35211. }
  35212. me.routeIDField = null;
  35213. me.attributeFilter = null;
  35214. me.eventTable = null;
  35215. me.eventRouteIDField = null;
  35216. me.measureField = null;
  35217. me.measureStartField = null;
  35218. me.measureEndField = null;
  35219. me.measureOffsetField = null;
  35220. me.errorInfoField = null;
  35221. if (me.dataReturnOption) {
  35222. me.dataReturnOption.destroy();
  35223. me.dataReturnOption = null;
  35224. }
  35225. }
  35226. }
  35227. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  35228. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35229. * This program are made available under the terms of the Apache License, Version 2.0
  35230. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35231. /**
  35232. * @class GenerateSpatialDataService
  35233. * @deprecatedclass SuperMap.GenerateSpatialDataService
  35234. * @category iServer SpatialAnalyst GenerateSpatialData
  35235. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  35236. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  35237. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  35238. * @param {Object} options - 参数。</br>
  35239. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35240. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35241. * @param {Object} [options.headers] - 请求头。
  35242. * @extends {SpatialAnalystBase}
  35243. * @example 实例化该类如下例所示:
  35244. * (start code)
  35245. * function GenerateSpatialData(){
  35246. *
  35247. * //配置数据返回选项(option)
  35248. * var option = new DataReturnOption({
  35249. * expectCount: 1000,
  35250. * dataset: "generateSpatialData",
  35251. * deleteExistResultDataset: true,
  35252. * dataReturnMode: DataReturnMode.DATASET_ONLY
  35253. * }),
  35254. * //配置动态分段参数(Parameters)
  35255. * parameters = new GenerateSpatialDataParameters({
  35256. * routeTable: "RouteDT_road@Changchun",
  35257. * routeIDField: "RouteID",
  35258. * eventTable: "LinearEventTabDT@Changchun",
  35259. * eventRouteIDField: "RouteID",
  35260. * measureField: "",
  35261. * measureStartField: "LineMeasureFrom",
  35262. * measureEndField: "LineMeasureTo",
  35263. * measureOffsetField: "",
  35264. * errorInfoField: "",
  35265. * retainedFields:[],
  35266. * dataReturnOption: option
  35267. * }),
  35268. * //配置动态分段iService
  35269. * iService = new GenerateSpatialDataService(Changchun_spatialanalyst, {
  35270. * eventListeners: {
  35271. * processCompleted: generateCompleted,
  35272. * processFailed: generateFailded
  35273. * }
  35274. * });
  35275. * //执行
  35276. * iService.processAsync(parameters);
  35277. * function Completed(generateSpatialDataEventArgs){//todo};
  35278. * function Error(generateSpatialDataEventArgs){//todo};
  35279. * (end)
  35280. * @usage
  35281. */
  35282. class GenerateSpatialDataService extends SpatialAnalystBase {
  35283. constructor(url, options) {
  35284. super(url, options);
  35285. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  35286. }
  35287. /**
  35288. * @function GenerateSpatialDataService.prototype.destroy
  35289. * @override
  35290. */
  35291. destroy() {
  35292. super.destroy();
  35293. }
  35294. /**
  35295. * @function GenerateSpatialDataService.prototype.processAsync
  35296. * @description 负责将客户端的动态分段服务参数传递到服务端。
  35297. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  35298. */
  35299. processAsync(params) {
  35300. if (!(params instanceof GenerateSpatialDataParameters)) {
  35301. return;
  35302. }
  35303. var me = this,
  35304. jsonParameters;
  35305. jsonParameters = me.getJsonParameters(params);
  35306. me.request({
  35307. method: "POST",
  35308. data: jsonParameters,
  35309. scope: me,
  35310. success: me.serviceProcessCompleted,
  35311. failure: me.serviceProcessFailed
  35312. });
  35313. }
  35314. /**
  35315. * @function GenerateSpatialDataService.prototype.getJsonParameters
  35316. * @description 将参数转化为 JSON 字符串。
  35317. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  35318. * @returns {string}转化后的JSON字符串。
  35319. */
  35320. getJsonParameters(params) {
  35321. var jsonParameters = "",
  35322. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  35323. me = this;
  35324. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  35325. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  35326. jsonParameters = Util_Util.toJSON(params);
  35327. return jsonParameters;
  35328. }
  35329. }
  35330. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  35331. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35332. * This program are made available under the terms of the Apache License, Version 2.0
  35333. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35334. /**
  35335. * @class GeoHashGridAggParameter
  35336. * @deprecatedclass SuperMap.GeoHashGridAggParameter
  35337. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  35338. * @category iServer Data FeatureResults
  35339. * @param {Object} options - 可选参数。
  35340. * @param {number} [options.precision=5] - 精度。
  35341. * @extends {BucketAggParameter}
  35342. * @usage
  35343. */
  35344. class GeoHashGridAggParameter extends BucketAggParameter {
  35345. constructor(options) {
  35346. super();
  35347. /**
  35348. * @member {number} [GeoHashGridAggParameter.prototype.precision=5]
  35349. * @description 网格中数字的精度。
  35350. */
  35351. this.precision = 5;
  35352. Util_Util.extend(this, options);
  35353. /**
  35354. * @member {BucketAggType} [GeoHashGridAggParameter.prototype.aggType=BucketAggType.GEOHASH_GRID]
  35355. * @description 格网聚合类型。
  35356. */
  35357. this.aggType = BucketAggType.GEOHASH_GRID;
  35358. this.CLASS_NAME = 'SuperMap.GeoHashGridAggParameter';
  35359. }
  35360. destroy() {
  35361. super.destroy();
  35362. this.aggType = null;
  35363. this.precision = null;
  35364. }
  35365. /**
  35366. * @function GeoHashGridAggParameter.toJsonParameters
  35367. * @description 将对象转为 JSON 格式。
  35368. * @param param 转换对象。
  35369. * @returns {Object}
  35370. */
  35371. static toJsonParameters(param) {
  35372. var parameters = {
  35373. aggName: param.aggName,
  35374. aggFieldName: param.aggFieldName,
  35375. aggType: param.aggType,
  35376. precision: param.precision
  35377. };
  35378. return Util_Util.toJson(parameters);
  35379. }
  35380. }
  35381. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  35382. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35383. * This program are made available under the terms of the Apache License, Version 2.0
  35384. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35385. /**
  35386. * @class GeometryOverlayAnalystParameters
  35387. * @deprecatedclass SuperMap.GeometryOverlayAnalystParameters
  35388. * @category iServer SpatialAnalyst OverlayAnalyst
  35389. * @classdesc
  35390. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  35391. * @param {Object} options - 参数。
  35392. * @param {GeoJSONObject} options.operateGeometry - 叠加分析的操作几何对象。<br>
  35393. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  35394. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。<br>
  35395. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。<br>
  35396. * @param {GeoJSONObject} options.sourceGeometry - 叠加分析的源几何对象。
  35397. * @param {Array.<GeoJSONFeature>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  35398. * @param {Array.<GeoJSONFeature>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  35399. * @param {OverlayOperationType} [options.operation] - 叠加操作枚举值。
  35400. * @extends {OverlayAnalystParameters}
  35401. * @usage
  35402. */
  35403. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  35404. constructor(options) {
  35405. super(options);
  35406. if (options && options.operateGeometry) {
  35407. this.operateGeometry = options.operateGeometry;
  35408. }
  35409. if (options && options.sourceGeometry) {
  35410. this.sourceGeometry = options.sourceGeometry;
  35411. }
  35412. if (options && options.operateGeometries) {
  35413. this.operateGeometries = options.operateGeometries;
  35414. }
  35415. if (options && options.sourceGeometries) {
  35416. this.sourceGeometries = options.sourceGeometries;
  35417. }
  35418. if (options) {
  35419. Util_Util.extend(this, options);
  35420. }
  35421. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  35422. }
  35423. /**
  35424. * @function GeometryOverlayAnalystParameters.prototype.destroy
  35425. * @override
  35426. */
  35427. destroy() {
  35428. super.destroy();
  35429. var me = this;
  35430. if (me.sourceGeometry) {
  35431. me.sourceGeometry.destroy();
  35432. me.sourceGeometry = null;
  35433. }
  35434. if (me.sourceGeometries) {
  35435. me.sourceGeometries.destroy();
  35436. me.sourceGeometries = null;
  35437. }
  35438. if (me.sourceGeometry) {
  35439. me.sourceGeometry.destroy();
  35440. me.sourceGeometry = null;
  35441. }
  35442. if (me.operateGeometries) {
  35443. me.operateGeometries.destroy();
  35444. me.operateGeometries = null;
  35445. }
  35446. }
  35447. /**
  35448. * @function GeometryOverlayAnalystParameters.toObject
  35449. * @param {GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  35450. * @param {GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  35451. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  35452. * @returns {Object} JSON 对象。
  35453. */
  35454. static toObject(geometryOverlayAnalystParameters, tempObj) {
  35455. for (var name in geometryOverlayAnalystParameters) {
  35456. if (name === "sourceGeometry") {
  35457. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  35458. } else if (name === "sourceGeometries") {
  35459. var sourceGeometries = [];
  35460. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  35461. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  35462. }
  35463. tempObj.sourceGeometries = sourceGeometries;
  35464. } else if (name === "operateGeometry") {
  35465. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  35466. } else if (name === "operateGeometries") {
  35467. var operateGeometries = [];
  35468. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  35469. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  35470. }
  35471. tempObj.operateGeometries = operateGeometries;
  35472. } else {
  35473. tempObj[name] = geometryOverlayAnalystParameters[name];
  35474. }
  35475. }
  35476. }
  35477. }
  35478. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  35479. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35480. * This program are made available under the terms of the Apache License, Version 2.0
  35481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35482. /**
  35483. * @class GeometrySurfaceAnalystParameters
  35484. * @deprecatedclass SuperMap.GeometrySurfaceAnalystParameters
  35485. * @category iServer SpatialAnalyst SurfaceAnalyst
  35486. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  35487. * @param {Object} options - 参数。
  35488. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 表面分析的坐标点数组。
  35489. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  35490. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  35491. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  35492. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  35493. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  35494. * @extends {SurfaceAnalystParameters}
  35495. * @usage
  35496. */
  35497. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  35498. constructor(options) {
  35499. super(options);
  35500. /**
  35501. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometrySurfaceAnalystParameters.prototype.points
  35502. * @description 获取或设置用于表面分析的坐标点数组。
  35503. */
  35504. this.points = null;
  35505. /**
  35506. * @member {Array.<number>} GeometrySurfaceAnalystParameters.prototype.zValues
  35507. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  35508. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  35509. */
  35510. this.zValues = null;
  35511. if (options) {
  35512. Util_Util.extend(this, options);
  35513. }
  35514. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  35515. }
  35516. /**
  35517. * @function GeometrySurfaceAnalystParameters.prototype.destroy
  35518. * @override
  35519. */
  35520. destroy() {
  35521. super.destroy();
  35522. var me = this;
  35523. if (me.points) {
  35524. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  35525. points[i].destroy();
  35526. }
  35527. me.points = null;
  35528. }
  35529. me.zValues = null;
  35530. }
  35531. }
  35532. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  35533. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35534. * This program are made available under the terms of the Apache License, Version 2.0
  35535. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35536. /**
  35537. * @class GeometryThiessenAnalystParameters
  35538. * @deprecatedclass SuperMap.GeometryThiessenAnalystParameters
  35539. * @constructs GeometryThiessenAnalystParameters
  35540. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  35541. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  35542. * @param {Object} options - 参数。
  35543. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 使用点数组进行分析时使用的几何对象。
  35544. * @extends {ThiessenAnalystParameters}
  35545. * @usage
  35546. */
  35547. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  35548. constructor(options) {
  35549. super(options);
  35550. /**
  35551. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometryThiessenAnalystParameters.prototype.points
  35552. * @description 使用点数组进行分析时使用的几何对象。
  35553. */
  35554. this.points = null;
  35555. if (options) {
  35556. Util_Util.extend(this, options);
  35557. }
  35558. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  35559. }
  35560. /**
  35561. * @function GeometryThiessenAnalystParameters.prototype.destroy
  35562. * @override
  35563. */
  35564. destroy() {
  35565. super.destroy();
  35566. var me = this;
  35567. if (me.points) {
  35568. for (var i = me.points.length - 1; i >= 0; i--) {
  35569. me.points[i].destroy();
  35570. }
  35571. me.points = null;
  35572. }
  35573. }
  35574. /**
  35575. * @function GeometryThiessenAnalystParameters.toObject
  35576. * @param {GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  35577. * @param {GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  35578. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  35579. * @returns {Object} JSON 对象。
  35580. */
  35581. static toObject(geometryThiessenAnalystParameters, tempObj) {
  35582. for (var name in geometryThiessenAnalystParameters) {
  35583. if (name === "clipRegion") {
  35584. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  35585. } else {
  35586. tempObj[name] = geometryThiessenAnalystParameters[name];
  35587. }
  35588. }
  35589. }
  35590. }
  35591. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  35592. /**
  35593. * @class GeoprocessingService
  35594. * @deprecatedclass SuperMap.GeoprocessingService
  35595. * @category iServer ProcessingAutomationService
  35596. * @classdesc 处理自动化服务接口的基类。
  35597. * @version 10.1.0
  35598. * @extends {CommonServiceBase}
  35599. * @param {string} url - 服务地址。
  35600. * @param {Object} options - 参数。
  35601. * @param {Events} options.events - 处理所有事件的对象。
  35602. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  35603. * @usage
  35604. */
  35605. class GeoprocessingService extends CommonServiceBase {
  35606. constructor(url, options) {
  35607. options = options || {};
  35608. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  35609. super(url, options);
  35610. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  35611. this.headers = {};
  35612. this.crossOrigin = true;
  35613. this.eventCount = 0;
  35614. }
  35615. /**
  35616. * @function GeoprocessingService.prototype.getTools
  35617. * @description 获取处理自动化工具列表。
  35618. * @param {string} identifier - 处理自动化工具ID。
  35619. */
  35620. getTools(callback) {
  35621. this._processAsync({ url: `${this.url}/list`, callback });
  35622. }
  35623. /**
  35624. * @function GeoprocessingService.prototype.getTool
  35625. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  35626. * @param {string} identifier - 处理自动化工具ID。
  35627. */
  35628. getTool(identifier, callback) {
  35629. this._processAsync({ url: `${this.url}/${identifier}`, callback });
  35630. }
  35631. /**
  35632. * @function GeoprocessingService.prototype.execute
  35633. * @description 同步执行处理自动化工具。
  35634. * @param {string} identifier - 处理自动化工具ID。
  35635. * @param {Object} parameter - 处理自动化工具的输入参数。
  35636. * @param {Object} environment - 处理自动化工具的环境参数。
  35637. */
  35638. execute(identifier, parameter, environment, callback) {
  35639. parameter = parameter ? parameter : null;
  35640. environment = environment ? environment : null;
  35641. const executeParamter = { parameter, environment };
  35642. this._processAsync({ url: `${this.url}/${identifier}/execute`, executeParamter, callback });
  35643. }
  35644. /**
  35645. * @function GeoprocessingService.prototype.submitJob
  35646. * @description 异步执行处理自动化工具。
  35647. * @param {string} identifier - 处理自动化工具ID。
  35648. * @param {Object} parameter - 处理自动化工具的输入参数。
  35649. * @param {Object} environments - 处理自动化工具的环境参数。
  35650. */
  35651. submitJob(identifier, parameter, environments, callback) {
  35652. parameter = parameter ? parameter : null;
  35653. environments = environments ? environments : null;
  35654. const asyncParamter = JSON.stringify({ parameter: parameter, environments: environments });
  35655. this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, params: asyncParamter });
  35656. }
  35657. /**
  35658. * @function GeoprocessingService.prototype.waitForJobCompletion
  35659. * @description 获取处理自动化异步执行状态信息。
  35660. * @param {string} jobId - 处理自动化任务ID。
  35661. * @param {string} identifier - 处理自动化工具ID。
  35662. * @param {Object} options - 状态信息参数。
  35663. * @param {number} options.interval - 定时器时间间隔。
  35664. * @param {function} options.statusCallback - 任务状态的回调函数。
  35665. */
  35666. waitForJobCompletion(jobId, identifier, options, callback) {
  35667. const me = this;
  35668. const timer = setInterval(function () {
  35669. const serviceProcessCompleted = function (serverResult, options) {
  35670. const state = serverResult.state.runState;
  35671. if (options.statusCallback) {
  35672. options.statusCallback(state);
  35673. }
  35674. switch (state) {
  35675. case 'FINISHED':
  35676. clearInterval(timer);
  35677. me.events.triggerEvent('processCompleted', {
  35678. result: serverResult,
  35679. options
  35680. });
  35681. break;
  35682. case 'FAILED':
  35683. clearInterval(timer);
  35684. me.events.triggerEvent('processFailed', {
  35685. result: serverResult,
  35686. options
  35687. });
  35688. break;
  35689. case 'CANCELED':
  35690. clearInterval(timer);
  35691. me.events.triggerEvent('processFailed', {
  35692. result: serverResult,
  35693. options
  35694. });
  35695. break;
  35696. }
  35697. };
  35698. me._processAsync({ url: `${me.url}/${identifier}/jobs/${jobId}`, serviceProcessCompleted, callback });
  35699. }, options.interval);
  35700. }
  35701. /**
  35702. * @function GeoprocessingService.prototype.getJobInfo
  35703. * @description 获取处理自动化任务的执行信息。
  35704. * @param {string} identifier - 处理自动化工具ID。
  35705. * @param {string} jobId - 处理自动化任务ID。
  35706. */
  35707. getJobInfo(identifier, jobId, callback) {
  35708. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}`, callback });
  35709. }
  35710. /**
  35711. * @function GeoprocessingService.prototype.cancelJob
  35712. * @description 取消处理自动化任务的异步执行。
  35713. * @param {string} identifier - 处理自动化工具ID。
  35714. * @param {string} jobId - 处理自动化任务ID。
  35715. */
  35716. cancelJob(identifier, jobId, callback) {
  35717. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}/cancel`, callback });
  35718. }
  35719. /**
  35720. * @function GeoprocessingService.prototype.getJobs
  35721. * @description 获取处理自动化服务任务列表。
  35722. * @param {string} identifier - 处理自动化工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  35723. */
  35724. getJobs(identifier, callback) {
  35725. let url = `${this.url}/jobs`;
  35726. if (identifier) {
  35727. url = `${this.url}/${identifier}/jobs`;
  35728. }
  35729. this._processAsync({ url, callback });
  35730. }
  35731. /**
  35732. * @function GeoprocessingService.prototype.getResults
  35733. * @description 处理自动化工具执行的结果等,支持结果过滤。
  35734. * @param {string} identifier - 处理自动化工具ID。
  35735. * @param {string} jobId - 处理自动化任务ID。
  35736. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  35737. */
  35738. getResults(identifier, jobId, filter, callback) {
  35739. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  35740. if (filter) {
  35741. url = `${url}/${filter}`;
  35742. }
  35743. this._processAsync({ url, callback });
  35744. }
  35745. _processAsync({ url, method, callback, paramter, serviceProcessCompleted, serviceProcessFailed }) {
  35746. let eventId = ++this.eventCount;
  35747. let eventListeners = {
  35748. scope: this,
  35749. processCompleted: function(result) {
  35750. if (eventId === result.result.eventId && callback) {
  35751. delete result.result.eventId;
  35752. callback(result);
  35753. this.events && this.events.un(eventListeners);
  35754. return false;
  35755. }
  35756. },
  35757. processFailed: function(result) {
  35758. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  35759. callback(result);
  35760. this.events && this.events.un(eventListeners);
  35761. return false;
  35762. }
  35763. }
  35764. }
  35765. this.events.on(eventListeners);
  35766. this.request({
  35767. url: url,
  35768. method: method || 'GET',
  35769. params: paramter,
  35770. headers: { 'Content-type': 'application/json' },
  35771. scope: this,
  35772. success(result, options) {
  35773. result.eventId = eventId;
  35774. const callback = serviceProcessCompleted || this.serviceProcessCompleted.bind(this);
  35775. callback(result, options);
  35776. },
  35777. failure(result, options) {
  35778. if (result.error) {
  35779. result.error.eventId = eventId;
  35780. }
  35781. result.eventId = eventId;
  35782. const callback = serviceProcessFailed || this.serviceProcessFailed.bind(this);
  35783. callback(result, options);
  35784. }
  35785. });
  35786. }
  35787. }
  35788. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  35789. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35790. * This program are made available under the terms of the Apache License, Version 2.0
  35791. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35792. /**
  35793. * @class GeoRelationAnalystParameters
  35794. * @deprecatedclass SuperMap.GeoRelationAnalystParameters
  35795. * @category iServer SpatialAnalyst GeoRelationAnalyst
  35796. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  35797. * @param {Object} options - 参数。
  35798. * @param {FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  35799. * @param {FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  35800. * @param {SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  35801. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  35802. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  35803. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  35804. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  35805. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  35806. * @usage
  35807. */
  35808. class GeoRelationAnalystParameters {
  35809. constructor(options) {
  35810. /**
  35811. * @member {string} GeoRelationAnalystParameters.prototype.dataset
  35812. * @description 源数据集名称。
  35813. */
  35814. this.dataset = null;
  35815. /**
  35816. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.sourceFilter
  35817. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  35818. */
  35819. this.sourceFilter = null;
  35820. /**
  35821. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.referenceFilter
  35822. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  35823. */
  35824. this.referenceFilter = null;
  35825. /**
  35826. * @member {SpatialRelationType} GeoRelationAnalystParameters.prototype.spatialRelationType
  35827. * @description 指定的空间关系类型。
  35828. */
  35829. this.spatialRelationType = null;
  35830. /**
  35831. * @member {boolean} [GeoRelationAnalystParameters.prototype.isBorderInside]
  35832. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  35833. */
  35834. this.isBorderInside = null;
  35835. /**
  35836. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnFeature]
  35837. * @description 是否返回 Feature 信息。
  35838. */
  35839. this.returnFeature = null;
  35840. /**
  35841. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  35842. * @description 是否仅返回满足指定空间关系的空间对象。
  35843. */
  35844. this.returnGeoRelatedOnly = null;
  35845. /**
  35846. * @member {number} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  35847. * @description 分析结果起始记录位置。
  35848. */
  35849. this.startRecord = 0;
  35850. /**
  35851. * @member {number} [GeoRelationAnalystParameters.prototype.expectCount=500]
  35852. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  35853. */
  35854. this.expectCount = 500;
  35855. if (options) {
  35856. Util_Util.extend(this, options);
  35857. }
  35858. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  35859. }
  35860. /**
  35861. * @function GeoRelationAnalystParameters.prototype.destroy
  35862. * @description 释放资源,将引用资源的属性置空。
  35863. */
  35864. destroy() {
  35865. var me = this;
  35866. if (me.sourceFilter) {
  35867. me.sourceFilter.destroy();
  35868. }
  35869. me.sourceFilter = null;
  35870. if (me.referenceFilter) {
  35871. me.referenceFilter.destroy();
  35872. }
  35873. me.referenceFilter = null;
  35874. me.dataset = null;
  35875. me.spatialRelationType = null;
  35876. me.isBorderInside = null;
  35877. me.returnFeature = null;
  35878. me.returnGeoRelatedOnly = null;
  35879. me.startRecord = null;
  35880. me.expectCount = null;
  35881. }
  35882. }
  35883. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  35884. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35885. * This program are made available under the terms of the Apache License, Version 2.0
  35886. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35887. /**
  35888. * @class GeoRelationAnalystService
  35889. * @deprecatedclass SuperMap.GeoRelationAnalystService
  35890. * @category iServer SpatialAnalyst GeoRelationAnalyst
  35891. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  35892. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  35893. * @param {Object} options - 参数。
  35894. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35895. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35896. * @param {Object} [options.headers] - 请求头。
  35897. * @extends {SpatialAnalystBase}
  35898. * @example 实例化该类如下例所示:
  35899. * (start code)
  35900. * function datasetGeoRelationAnalystProcess() {
  35901. * var referenceFilter = new FilterParameter({
  35902. * name:"Frame_R@Changchun",
  35903. * attributeFilter:"SmID>0"});
  35904. * var sourceFilter = new FilterParameter({
  35905. * attributeFilter:"SmID>0"});
  35906. * //初始化服务类
  35907. * var datasetGeoRelationService = new GeoRelationAnalystService(
  35908. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  35909. * //构建参数类
  35910. * datasetGeoRelationParameters = new GeoRelationAnalystParameters({
  35911. * dataset: "Park@Changchun",
  35912. * startRecord: 0,
  35913. * expectCount: 20,
  35914. * sourceFilter: sourceFilter,
  35915. * referenceFilter: referenceFilter,
  35916. * spatialRelationType: SpatialRelationType.INTERSECT,
  35917. * isBorderInside: true,
  35918. * returnFeature: true,
  35919. * returnGeoRelatedOnly: true
  35920. * });
  35921. * datasetGeoRelationService.events.on({
  35922. * "processCompleted": datasetGeoRelationAnalystCompleted,
  35923. * "processFailed": datasetGeoRelationAnalystFailed});
  35924. * //执行
  35925. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  35926. * }
  35927. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  35928. * function Error(datasetGeoRelationAnalystFailed){//todo};
  35929. * (end)
  35930. * @usage
  35931. */
  35932. class GeoRelationAnalystService extends SpatialAnalystBase {
  35933. constructor(url, options) {
  35934. super(url, options);
  35935. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  35936. }
  35937. /**
  35938. * @function GeoRelationAnalystService.prototype.destroy
  35939. * @override
  35940. */
  35941. destroy() {
  35942. super.destroy();
  35943. }
  35944. /**
  35945. * @function GeoRelationAnalystService.prototype.processAsync
  35946. * @description 负责将客户端的空间关系分析参数传递到服务端
  35947. * @param {GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  35948. */
  35949. processAsync(parameter) {
  35950. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  35951. return;
  35952. }
  35953. var me = this;
  35954. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  35955. var jsonParameters = Util_Util.toJSON(parameter);
  35956. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  35957. me.request({
  35958. method: "POST",
  35959. data: jsonParameters,
  35960. scope: me,
  35961. success: me.serviceProcessCompleted,
  35962. failure: me.serviceProcessFailed
  35963. });
  35964. }
  35965. }
  35966. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetService.js
  35967. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35968. * This program are made available under the terms of the Apache License, Version 2.0
  35969. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35970. /**
  35971. * @class DatasetService
  35972. * @deprecatedclass SuperMap.DatasetService
  35973. * @category iServer Data Dataset
  35974. * @classdesc 数据集查询服务。
  35975. * @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  35976. * @param {Object} options - 参数。
  35977. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  35978. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  35979. * @param {string}options.datasource - 数据源名称。
  35980. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35981. * @param {Object} [options.headers] - 请求头。
  35982. * @usage
  35983. */
  35984. class DatasetService extends CommonServiceBase {
  35985. constructor(url, options) {
  35986. super(url, options);
  35987. if(!options){
  35988. return;
  35989. }
  35990. /**
  35991. * @member {string} DatasetService.prototype.datasource
  35992. * @description 要查询的数据集所在的数据源名称。
  35993. */
  35994. this.datasource = null;
  35995. /**
  35996. * @member {string} DatasetService.prototype.dataset
  35997. * @description 要查询的数据集名称。
  35998. */
  35999. this.dataset = null;
  36000. this.eventCount = 0;
  36001. if (options) {
  36002. Util_Util.extend(this, options);
  36003. }
  36004. this.CLASS_NAME = "SuperMap.DatasetService";
  36005. }
  36006. /**
  36007. * @function DatasetService.prototype.destroy
  36008. * @override
  36009. */
  36010. destroy() {
  36011. super.destroy();
  36012. var me = this;
  36013. me.datasource = null;
  36014. me.dataset = null;
  36015. }
  36016. /**
  36017. * @function DatasetService.prototype.getDatasetsService
  36018. * @description 执行服务,查询数据集服务。
  36019. */
  36020. getDatasetsService(params, callback) {
  36021. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params}/datasets`);
  36022. this.processAsync(url, 'GET', callback);
  36023. }
  36024. /**
  36025. * @function DatasetService.prototype.getDatasetService
  36026. * @description 执行服务,查询数据集信息服务。
  36027. */
  36028. getDatasetService(datasourceName, datasetName, callback) {
  36029. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  36030. this.processAsync(url, 'GET', callback);
  36031. }
  36032. /**
  36033. * @function DatasetService.prototype.setDatasetService
  36034. * @description 执行服务,更改数据集信息服务。
  36035. */
  36036. setDatasetService(params, callback) {
  36037. if (!params) {
  36038. return;
  36039. }
  36040. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${params.datasourceName}/datasets/name/${params.datasetName}`);
  36041. delete params.datasourceName;
  36042. this.processAsync(url, 'PUT', callback, params);
  36043. }
  36044. /**
  36045. * @function DatasetService.prototype.deleteDatasetService
  36046. * @description 执行服务,删除数据集信息服务。
  36047. */
  36048. deleteDatasetService(datasourceName, datasetName, callback) {
  36049. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  36050. this.processAsync(url, 'DELETE', callback);
  36051. }
  36052. processAsync(url, method, callback, params) {
  36053. let eventId = ++this.eventCount;
  36054. let eventListeners = {
  36055. scope: this,
  36056. processCompleted: function(result) {
  36057. if (eventId === result.result.eventId && callback) {
  36058. delete result.result.eventId;
  36059. callback(result);
  36060. this.events && this.events.un(eventListeners);
  36061. return false;
  36062. }
  36063. },
  36064. processFailed: function(result) {
  36065. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  36066. callback(result);
  36067. this.events && this.events.un(eventListeners);
  36068. return false;
  36069. }
  36070. }
  36071. }
  36072. this.events.on(eventListeners);
  36073. var me = this;
  36074. let requestConfig = {
  36075. url,
  36076. method,
  36077. scope: me,
  36078. success(result, options) {
  36079. result.eventId = eventId;
  36080. me.serviceProcessCompleted(result, options);
  36081. },
  36082. failure(result, options) {
  36083. if (result.error) {
  36084. result.error.eventId = eventId;
  36085. }
  36086. result.eventId = eventId;
  36087. me.serviceProcessFailed(result, options);
  36088. }
  36089. }
  36090. params && (requestConfig.data = Util_Util.toJSON(params));
  36091. me.request(requestConfig);
  36092. }
  36093. }
  36094. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  36095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36096. * This program are made available under the terms of the Apache License, Version 2.0
  36097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36098. /**
  36099. * @class GetFeaturesParametersBase
  36100. * @deprecatedclass SuperMap.GetFeaturesParametersBase
  36101. * @category iServer Data FeatureResults
  36102. * @classdesc 要素查询参数基类。
  36103. * @param {Object} options - 参数。
  36104. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  36105. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  36106. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  36107. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  36108. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  36109. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36110. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36111. * @usage
  36112. */
  36113. class GetFeaturesParametersBase {
  36114. constructor(options) {
  36115. /**
  36116. * @member {Array.<string>} GetFeaturesParametersBase.prototype.datasetName
  36117. * @description 数据集集合中的数据集名称列表。
  36118. */
  36119. this.datasetNames = null;
  36120. /**
  36121. * @member {string} GetFeaturesParametersBase.prototype.targetEpsgCode
  36122. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  36123. */
  36124. this.targetEpsgCode = null;
  36125. /**
  36126. * @member {Object} GetFeaturesParametersBase.prototype.targetPrj
  36127. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36128. */
  36129. this.targetPrj = null;
  36130. /**
  36131. * @member {boolean} [GetFeaturesParametersBase.prototype.returnContent=true]
  36132. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  36133. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  36134. * 如果为 false,则返回的是查询结果资源的 URI。
  36135. */
  36136. this.returnContent = true;
  36137. /**
  36138. * @member {number} [GetFeaturesParametersBase.prototype.fromIndex=0]
  36139. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  36140. */
  36141. this.fromIndex = 0;
  36142. /**
  36143. * @member {number} [GetFeaturesParametersBase.prototype.toIndex=19]
  36144. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  36145. */
  36146. this.toIndex = 19;
  36147. /**
  36148. * @member {boolean} [GetFeaturesParametersBase.prototype.returnCountOnly=false]
  36149. * @description 只返回查询结果的总数。
  36150. */
  36151. this.returnCountOnly = false;
  36152. /**
  36153. * @member {number} [GetFeaturesParametersBase.prototype.maxFeatures=1000]
  36154. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  36155. */
  36156. this.maxFeatures = null;
  36157. /**
  36158. * @member {number} [GetFeaturesParametersBase.prototype.hasGeometry=true]
  36159. * @description 返回结果是否包含Geometry。
  36160. */
  36161. this.hasGeometry = true;
  36162. /**
  36163. * @member {MetricsAggParameter|GeoHashGridAggParameter} GetFeaturesParametersBase.prototype.aggregations
  36164. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36165. */
  36166. this.aggregations = null;
  36167. Util_Util.extend(this, options);
  36168. this.CLASS_NAME = 'SuperMap.GetFeaturesParametersBase';
  36169. }
  36170. /**
  36171. *
  36172. * @function GetFeaturesParametersBase.prototype.destroy
  36173. * @description 释放资源,将引用资源的属性置空。
  36174. */
  36175. destroy() {
  36176. var me = this;
  36177. me.datasetNames = null;
  36178. me.returnContent = null;
  36179. me.fromIndex = null;
  36180. me.toIndex = null;
  36181. me.hasGeometry = null;
  36182. me.maxFeatures = null;
  36183. me.targetEpsgCode = null;
  36184. me.targetPrj = null;
  36185. if (me.aggregation) {
  36186. me.aggregation = null;
  36187. }
  36188. }
  36189. }
  36190. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  36191. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36192. * This program are made available under the terms of the Apache License, Version 2.0
  36193. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36194. /**
  36195. * @class GetFeaturesByBoundsParameters
  36196. * @deprecatedclass SuperMap.GetFeaturesByBoundsParameters
  36197. * @category iServer Data FeatureResults
  36198. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  36199. * @param {Object} options - 参数。
  36200. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 查询的范围对象。
  36201. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  36202. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  36203. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  36204. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  36205. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  36206. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  36207. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  36208. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  36209. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36210. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36211. * @extends {GetFeaturesParametersBase}
  36212. * @usage
  36213. */
  36214. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  36215. constructor(options) {
  36216. super(options);
  36217. /**
  36218. * @member {string} GetFeaturesByBoundsParameters.prototype.getFeatureMode
  36219. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  36220. */
  36221. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  36222. /**
  36223. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} GetFeaturesByBoundsParameters.prototype.bounds
  36224. * @description 用于查询的范围对象。
  36225. *
  36226. */
  36227. this.bounds = null;
  36228. /**
  36229. * @member {Array.<string>} GetFeaturesByBoundsParameters.prototype.fields
  36230. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  36231. */
  36232. this.fields = null;
  36233. /**
  36234. * @member {string} GetFeaturesByBoundsParameters.prototype.attributeFilter
  36235. * @description 范围查询属性过滤条件。
  36236. */
  36237. this.attributeFilter = null;
  36238. /**
  36239. * @member {SpatialQueryMode} [GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  36240. * @description 空间查询模式常量。
  36241. */
  36242. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  36243. Util_Util.extend(this, options);
  36244. this.CLASS_NAME = 'SuperMap.GetFeaturesByBoundsParameters';
  36245. }
  36246. /**
  36247. * @function GetFeaturesByBoundsParameters.prototype.destroy
  36248. * @override
  36249. */
  36250. destroy() {
  36251. super.destroy();
  36252. var me = this;
  36253. if (me.bounds) {
  36254. me.bounds.destroy();
  36255. me.bounds = null;
  36256. }
  36257. if (me.fields) {
  36258. while (me.fields.length > 0) {
  36259. me.fields.pop();
  36260. }
  36261. me.fields = null;
  36262. }
  36263. me.attributeFilter = null;
  36264. me.spatialQueryMode = null;
  36265. me.getFeatureMode = null;
  36266. }
  36267. /**
  36268. * @function GetFeaturesByBoundsParameters.toJsonParameters
  36269. * @description 将 {@link GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  36270. * @param {GetFeaturesByBoundsParameters} params - 范围查询参数。
  36271. * @returns {string} 转化后的 JSON 字符串。
  36272. *
  36273. */
  36274. static toJsonParameters(params) {
  36275. var filterParameter, bounds, parasByBounds;
  36276. bounds = {
  36277. leftBottom: { x: params.bounds.left, y: params.bounds.bottom },
  36278. rightTop: { x: params.bounds.right, y: params.bounds.top }
  36279. };
  36280. parasByBounds = {
  36281. datasetNames: params.datasetNames,
  36282. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  36283. bounds: bounds,
  36284. spatialQueryMode: params.spatialQueryMode
  36285. };
  36286. if (params.fields) {
  36287. filterParameter = new FilterParameter();
  36288. filterParameter.name = params.datasetNames;
  36289. filterParameter.fields = params.fields;
  36290. parasByBounds.queryParameter = filterParameter;
  36291. }
  36292. if (params.attributeFilter) {
  36293. parasByBounds.attributeFilter = params.attributeFilter;
  36294. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  36295. }
  36296. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  36297. parasByBounds.maxFeatures = params.maxFeatures;
  36298. }
  36299. if (typeof params.hasGeometry === 'boolean') {
  36300. parasByBounds.hasGeometry = params.hasGeometry;
  36301. }
  36302. if (params.targetEpsgCode) {
  36303. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  36304. }
  36305. if (!params.targetEpsgCode && params.targetPrj) {
  36306. parasByBounds.targetPrj = params.targetPrj;
  36307. }
  36308. if (params.aggregations) {
  36309. parasByBounds.aggregations = params.aggregations;
  36310. }
  36311. return Util_Util.toJSON(parasByBounds);
  36312. }
  36313. }
  36314. GetFeaturesByBoundsParameters.getFeatureMode = {
  36315. BOUNDS: 'BOUNDS',
  36316. BOUNDS_ATTRIBUTEFILTER: 'BOUNDS_ATTRIBUTEFILTER'
  36317. };
  36318. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  36319. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36320. * This program are made available under the terms of the Apache License, Version 2.0
  36321. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36322. /**
  36323. * @class GetFeaturesServiceBase
  36324. * @deprecatedclass SuperMap.GetFeaturesServiceBase
  36325. * @category iServer Data FeatureResults
  36326. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  36327. * @extends CommonServiceBase
  36328. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  36329. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  36330. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  36331. * @param {Object} options - 参数。
  36332. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  36333. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  36334. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36335. * @param {Object} [options.headers] - 请求头。
  36336. * @example
  36337. * var myService = new GetFeaturesServiceBase(url, {
  36338. * eventListeners: {
  36339. * "processCompleted": getFeatureCompleted,
  36340. * "processFailed": getFeatureError
  36341. * }
  36342. * });
  36343. * @usage
  36344. */
  36345. class GetFeaturesServiceBase extends CommonServiceBase {
  36346. constructor(url, options) {
  36347. super(url, options);
  36348. options = options || {};
  36349. /**
  36350. * @member {boolean} [GetFeaturesServiceBase.prototype.returnContent=true]
  36351. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  36352. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  36353. * 如果为 false,则返回的是查询结果资源的 URI。
  36354. */
  36355. this.returnContent = true;
  36356. /**
  36357. * @member {number} [GetFeaturesServiceBase.prototype.fromIndex=0]
  36358. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  36359. */
  36360. this.fromIndex = 0;
  36361. /**
  36362. * @member {number} [GetFeaturesServiceBase.prototype.toIndex=19]
  36363. * @description 查询结果的最大索引号。
  36364. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  36365. */
  36366. this.toIndex = 19;
  36367. /**
  36368. * @member {number} [GetFeaturesServiceBase.prototype.hasGeometry=true]
  36369. * @description 返回结果是否包含Geometry。
  36370. */
  36371. this.hasGeometry = true;
  36372. /**
  36373. * @member {number} [GetFeaturesServiceBase.prototype.maxFeatures=1000]
  36374. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  36375. */
  36376. this.maxFeatures = null;
  36377. /**
  36378. * @member {string} [GetFeaturesServiceBase.prototype.format=DataFormat.GEOJSON]
  36379. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。
  36380. * 参数格式为 "ISERVER","GEOJSON","FGB"。
  36381. */
  36382. this.format = DataFormat.GEOJSON;
  36383. Util_Util.extend(this, options);
  36384. this.url = Util_Util.urlPathAppend(this.url, 'featureResults');
  36385. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  36386. }
  36387. /**
  36388. * @function GetFeaturesServiceBase.prototype.destroy
  36389. * @description 释放资源,将引用资源的属性置空。
  36390. */
  36391. destroy() {
  36392. super.destroy();
  36393. var me = this;
  36394. me.returnContent = null;
  36395. me.fromIndex = null;
  36396. me.toIndex = null;
  36397. me.maxFeatures = null;
  36398. me.format = null;
  36399. me.hasGeometry = null;
  36400. }
  36401. /**
  36402. * @function GetFeaturesServiceBase.prototype.processAsync
  36403. * @description 将客户端的查询参数传递到服务端。
  36404. * @param {Object} params - 查询参数。
  36405. */
  36406. processAsync(params) {
  36407. if (!params) {
  36408. return;
  36409. }
  36410. var me = this,
  36411. jsonParameters = null,
  36412. firstPara = true;
  36413. me.returnContent = params.returnContent;
  36414. me.fromIndex = params.fromIndex;
  36415. me.toIndex = params.toIndex;
  36416. me.maxFeatures = params.maxFeatures;
  36417. me.hasGeometry = params.hasGeometry;
  36418. if (me.returnContent) {
  36419. firstPara = false;
  36420. }
  36421. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  36422. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  36423. me.url = Util_Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  36424. }
  36425. if (params.returnCountOnly) {
  36426. me.url = Util_Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  36427. }
  36428. jsonParameters = me.getJsonParameters(params);
  36429. me.request({
  36430. method: "POST",
  36431. data: jsonParameters,
  36432. scope: me,
  36433. success: me.serviceProcessCompleted,
  36434. failure: me.serviceProcessFailed
  36435. });
  36436. }
  36437. /**
  36438. * @function GetFeaturesServiceBase.prototype.getFeatureComplete
  36439. * @description 查询完成,执行此方法。
  36440. * @param {Object} result - 服务器返回的结果对象。
  36441. */
  36442. serviceProcessCompleted(result, options) {
  36443. var me = this;
  36444. result = Util_Util.transformResult(result);
  36445. if (me.format === DataFormat.GEOJSON && result.features) {
  36446. var geoJSONFormat = new GeoJSON();
  36447. result.features = geoJSONFormat.toGeoJSON(result.features);
  36448. }
  36449. me.events.triggerEvent("processCompleted", {result: result, options});
  36450. }
  36451. dataFormat() {
  36452. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  36453. }
  36454. }
  36455. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  36456. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36457. * This program are made available under the terms of the Apache License, Version 2.0
  36458. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36459. /**
  36460. * @class GetFeaturesByBoundsService
  36461. * @deprecatedclass SuperMap.GetFeaturesByBoundsService
  36462. * @category iServer Data FeatureResults
  36463. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  36464. * @description 数据集范围查询服务类构造函数。
  36465. * @extends {GetFeaturesServiceBase}
  36466. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  36467. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  36468. * @param {Object} options - 参数。
  36469. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  36470. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  36471. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36472. * @param {Object} [options.headers] - 请求头。
  36473. * @example
  36474. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  36475. * eventListeners: {
  36476. * "processCompleted": getFeatureCompleted,
  36477. * "processFailed": getFeatureError
  36478. * }
  36479. * });
  36480. * function getFeatureCompleted(object){//todo};
  36481. * function getFeatureError(object){//todo}
  36482. * @usage
  36483. */
  36484. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  36485. constructor(url, options) {
  36486. super(url, options);
  36487. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  36488. }
  36489. /**
  36490. * @function GetFeaturesByBoundsService.prototype.destroy
  36491. * @override
  36492. */
  36493. destroy() {
  36494. super.destroy();
  36495. }
  36496. /**
  36497. * @function GetFeaturesByBoundsService.prototype.getJsonParameters
  36498. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  36499. * @param params {GetFeaturesByBoundsParameters}
  36500. * @returns {string} 转化后的 JSON 字符串。
  36501. *
  36502. */
  36503. getJsonParameters(params) {
  36504. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  36505. }
  36506. }
  36507. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  36508. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36509. * This program are made available under the terms of the Apache License, Version 2.0
  36510. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36511. /**
  36512. * @class GetFeaturesByBufferParameters
  36513. * @deprecatedclass SuperMap.GetFeaturesByBufferParameters
  36514. * @category iServer Data FeatureResults
  36515. * @classdesc 数据集缓冲区查询参数类。
  36516. * @param {Object} options - 参数。
  36517. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  36518. * @param {GeoJSONObject} options.geometry - 空间查询条件。
  36519. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  36520. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  36521. * @param {string} [options.attributeFilter] - 属性查询条件。
  36522. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  36523. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  36524. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  36525. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  36526. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36527. * @extends {GetFeaturesParametersBase}
  36528. * @usage
  36529. */
  36530. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  36531. constructor(options) {
  36532. super(options);
  36533. /**
  36534. * @member {number} GetFeaturesByBufferParameters.prototype.bufferDistance
  36535. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  36536. */
  36537. this.bufferDistance = null;
  36538. /**
  36539. * @member {string} GetFeaturesByBufferParameters.prototype.attributeFilter
  36540. * @description 属性查询条件。
  36541. */
  36542. this.attributeFilter = null;
  36543. /**
  36544. * @member {GeoJSONObject} GetFeaturesByBufferParameters.prototype.geometry
  36545. * @description 空间查询条件。<br>
  36546. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  36547. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  36548. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  36549. */
  36550. this.geometry = null;
  36551. /**
  36552. * @member {Array.<string>} GetFeaturesByBufferParameters.prototype.fields
  36553. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  36554. */
  36555. this.fields = null;
  36556. Util_Util.extend(this, options);
  36557. this.CLASS_NAME = 'SuperMap.GetFeaturesByBufferParameters';
  36558. }
  36559. /**
  36560. * @function GetFeaturesByBufferParameters.prototype.destroy
  36561. * @override
  36562. */
  36563. destroy() {
  36564. super.destroy();
  36565. var me = this;
  36566. me.bufferDistance = null;
  36567. me.attributeFilter = null;
  36568. if (me.fields) {
  36569. while (me.fields.length > 0) {
  36570. me.fields.pop();
  36571. }
  36572. me.fields = null;
  36573. }
  36574. if (me.geometry) {
  36575. me.geometry.destroy();
  36576. me.geometry = null;
  36577. }
  36578. }
  36579. /**
  36580. * @function GetFeaturesByBufferParameters.toJsonParameters
  36581. * @description 将 GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  36582. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  36583. * @returns {string} 转化后的 JSON 字符串。
  36584. */
  36585. static toJsonParameters(params) {
  36586. var filterParameter, paramsByBuffer, geometry;
  36587. geometry = ServerGeometry.fromGeometry(params.geometry);
  36588. paramsByBuffer = {
  36589. datasetNames: params.datasetNames,
  36590. getFeatureMode: 'BUFFER',
  36591. bufferDistance: params.bufferDistance,
  36592. geometry: geometry
  36593. };
  36594. if (params.fields) {
  36595. filterParameter = new FilterParameter();
  36596. filterParameter.name = params.datasetNames;
  36597. filterParameter.fields = params.fields;
  36598. paramsByBuffer.queryParameter = filterParameter;
  36599. }
  36600. if (params.attributeFilter) {
  36601. paramsByBuffer.attributeFilter = params.attributeFilter;
  36602. paramsByBuffer.getFeatureMode = 'BUFFER_ATTRIBUTEFILTER';
  36603. }
  36604. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  36605. paramsByBuffer.maxFeatures = params.maxFeatures;
  36606. }
  36607. if (typeof params.hasGeometry === 'boolean') {
  36608. paramsByBuffer.hasGeometry = params.hasGeometry;
  36609. }
  36610. if (params.targetEpsgCode) {
  36611. paramsByBuffer.targetEpsgCode = params.targetEpsgCode;
  36612. }
  36613. if (!params.targetEpsgCode && params.targetPrj) {
  36614. paramsByBuffer.targetPrj = params.targetPrj;
  36615. }
  36616. return Util_Util.toJSON(paramsByBuffer);
  36617. }
  36618. }
  36619. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  36620. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36621. * This program are made available under the terms of the Apache License, Version 2.0
  36622. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36623. /**
  36624. * @class GetFeaturesByBufferService
  36625. * @deprecatedclass SuperMap.GetFeaturesByBufferService
  36626. * @category iServer Data FeatureResults
  36627. * @classdesc 数据服务中数据集缓冲区查询服务类。
  36628. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  36629. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  36630. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  36631. * @param {Object} options - 参数。
  36632. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  36633. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  36634. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36635. * @param {Object} [options.headers] - 请求头。
  36636. * @extends {GetFeaturesServiceBase}
  36637. * @example
  36638. * var myGetFeaturesByBufferService = new GetFeaturesByBufferService(url, {
  36639. * eventListeners: {
  36640. * "processCompleted": GetFeaturesCompleted,
  36641. * "processFailed": GetFeaturesError
  36642. * }
  36643. * });
  36644. * function GetFeaturesCompleted(object){//todo};
  36645. * function GetFeaturesError(object){//todo};
  36646. * @usage
  36647. */
  36648. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  36649. constructor(url, options) {
  36650. super(url, options);
  36651. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  36652. }
  36653. /**
  36654. * @function GetFeaturesByBufferService.prototype.destroy
  36655. * @override
  36656. */
  36657. destroy() {
  36658. super.destroy();
  36659. }
  36660. /**
  36661. * @function GetFeaturesByBufferService.prototype.getJsonParameters
  36662. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  36663. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  36664. * @returns {Object} 转化后的 JSON 字符串。
  36665. */
  36666. getJsonParameters(params) {
  36667. if (!(params instanceof GetFeaturesByBufferParameters)) {
  36668. return;
  36669. }
  36670. return GetFeaturesByBufferParameters.toJsonParameters(params);
  36671. }
  36672. }
  36673. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  36674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36675. * This program are made available under the terms of the Apache License, Version 2.0
  36676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36677. /**
  36678. * @class GetFeaturesByGeometryParameters
  36679. * @deprecatedclass SuperMap.GetFeaturesByGeometryParameters
  36680. * @category iServer Data FeatureResults
  36681. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  36682. * @param {Object} options - 参数。
  36683. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  36684. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  36685. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  36686. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  36687. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  36688. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  36689. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  36690. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  36691. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  36692. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36693. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36694. * @extends {GetFeaturesParametersBase}
  36695. * @usage
  36696. */
  36697. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  36698. constructor(options) {
  36699. super(options);
  36700. /**
  36701. * @member {string} GetFeaturesByGeometryParameters.prototype.getFeatureMode
  36702. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  36703. */
  36704. this.getFeatureMode = 'SPATIAL';
  36705. /**
  36706. * @member {GeoJSONObject} GetFeaturesByGeometryParameters.prototype.geometry
  36707. * @description 用于查询的几何对象。 </br>
  36708. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  36709. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  36710. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  36711. */
  36712. this.geometry = null;
  36713. /**
  36714. * @member {Array.<string>} GetFeaturesByGeometryParameters.prototype.fields
  36715. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  36716. */
  36717. this.fields = null;
  36718. /**
  36719. * @member {string} GetFeaturesByGeometryParameters.prototype.attributeFilter
  36720. * @description 几何查询属性过滤条件。
  36721. */
  36722. this.attributeFilter = null;
  36723. /**
  36724. * @member {SpatialQueryMode} [GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  36725. * @description 空间查询模式常量。
  36726. */
  36727. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  36728. Util_Util.extend(this, options);
  36729. this.CLASS_NAME = 'SuperMap.GetFeaturesByGeometryParameters';
  36730. }
  36731. /**
  36732. * @function GetFeaturesByGeometryParameters.prototype.destroy
  36733. * @description 释放资源,将引用资源的属性置空。
  36734. */
  36735. destroy() {
  36736. super.destroy();
  36737. var me = this;
  36738. if (me.geometry) {
  36739. me.geometry.destroy();
  36740. me.geometry = null;
  36741. }
  36742. if (me.fields) {
  36743. while (me.fields.length > 0) {
  36744. me.fields.pop();
  36745. }
  36746. me.fields = null;
  36747. }
  36748. me.attributeFilter = null;
  36749. me.spatialQueryMode = null;
  36750. me.getFeatureMode = null;
  36751. }
  36752. /**
  36753. * @function GetFeaturesByGeometryParameters.toJsonParameters
  36754. * @description 将 GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  36755. * @param {GetFeaturesByGeometryParameters} params - 查询参数对象。
  36756. * @returns {string} 转化后的 JSON 字符串。
  36757. */
  36758. static toJsonParameters(params) {
  36759. var filterParameter, geometry, parasByGeometry;
  36760. geometry = ServerGeometry.fromGeometry(params.geometry);
  36761. parasByGeometry = {
  36762. datasetNames: params.datasetNames,
  36763. getFeatureMode: 'SPATIAL',
  36764. geometry: geometry,
  36765. spatialQueryMode: params.spatialQueryMode
  36766. };
  36767. if (params.fields) {
  36768. filterParameter = new FilterParameter();
  36769. filterParameter.name = params.datasetNames;
  36770. filterParameter.fields = params.fields;
  36771. parasByGeometry.queryParameter = filterParameter;
  36772. }
  36773. if (params.attributeFilter) {
  36774. parasByGeometry.attributeFilter = params.attributeFilter;
  36775. parasByGeometry.getFeatureMode = 'SPATIAL_ATTRIBUTEFILTER';
  36776. }
  36777. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  36778. parasByGeometry.maxFeatures = params.maxFeatures;
  36779. }
  36780. if (typeof params.hasGeometry === 'boolean') {
  36781. parasByGeometry.hasGeometry = params.hasGeometry;
  36782. }
  36783. if (params.targetEpsgCode) {
  36784. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  36785. }
  36786. if (!params.targetEpsgCode && params.targetPrj) {
  36787. parasByGeometry.targetPrj = params.targetPrj;
  36788. }
  36789. if (params.aggregations) {
  36790. parasByGeometry.aggregations = params.aggregations;
  36791. }
  36792. return Util_Util.toJSON(parasByGeometry);
  36793. }
  36794. }
  36795. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  36796. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36797. * This program are made available under the terms of the Apache License, Version 2.0
  36798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36799. /**
  36800. * @class GetFeaturesByGeometryService
  36801. * @deprecatedclass SuperMap.GetFeaturesByGeometryService
  36802. * @category iServer Data FeatureResults
  36803. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  36804. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  36805. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  36806. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  36807. * @param {Object} options - 参数。
  36808. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  36809. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  36810. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36811. * @param {Object} [options.headers] - 请求头。
  36812. * @extends {GetFeaturesServiceBase}
  36813. * @example
  36814. * var myService = new GetFeaturesByGeometryService(url, {
  36815. * eventListeners: {
  36816. * "processCompleted": getFeatureCompleted,
  36817. * "processFailed": getFeatureError
  36818. * }
  36819. * });
  36820. * function getFeatureCompleted(object){//todo};
  36821. * function getFeatureError(object){//todo}
  36822. * @usage
  36823. */
  36824. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  36825. constructor(url, options) {
  36826. super(url, options);
  36827. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  36828. }
  36829. /**
  36830. * @function GetFeaturesByGeometryService.prototype.destroy
  36831. * @override
  36832. */
  36833. destroy() {
  36834. super.destroy();
  36835. }
  36836. /**
  36837. * @function GetFeaturesByGeometryService.prototype.getJsonParameters
  36838. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  36839. * @description 将查询参数转化为 JSON 字符串。
  36840. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  36841. * @returns {Object} 转化后的 JSON 字符串。
  36842. */
  36843. getJsonParameters(params) {
  36844. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  36845. }
  36846. }
  36847. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  36848. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36849. * This program are made available under the terms of the Apache License, Version 2.0
  36850. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36851. /**
  36852. * @class GetFeaturesByIDsParameters
  36853. * @deprecatedclass SuperMap.GetFeaturesByIDsParameters
  36854. * @category iServer Data FeatureResults
  36855. * @classdesc ID 查询参数类。
  36856. * @param {Object} options - 参数。
  36857. * @param {Array.<number>} options.IDs - 指定查询的元素 ID 信息。
  36858. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  36859. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  36860. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  36861. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  36862. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  36863. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  36864. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  36865. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36866. * @extends {GetFeaturesParametersBase}
  36867. * @usage
  36868. */
  36869. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  36870. constructor(options) {
  36871. super(options);
  36872. /**
  36873. * @member {string} GetFeaturesByIDsParameters.prototype.getFeatureMode
  36874. * @description 数据集查询模式。
  36875. */
  36876. this.getFeatureMode = 'ID';
  36877. /**
  36878. * @member {Array.<number>} GetFeaturesByIDsParameters.prototype.IDs
  36879. * @description 所要查询指定的元素 ID 信息。
  36880. */
  36881. this.IDs = null;
  36882. /**
  36883. * @member {Array.<string>} GetFeaturesByIDsParameters.prototype.fields
  36884. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  36885. */
  36886. this.fields = null;
  36887. Util_Util.extend(this, options);
  36888. this.CLASS_NAME = 'SuperMap.GetFeaturesByIDsParameters';
  36889. }
  36890. /**
  36891. * @function GetFeaturesByIDsParameters.prototype.destroy
  36892. * @override
  36893. */
  36894. destroy() {
  36895. super.destroy();
  36896. var me = this;
  36897. me.IDs = null;
  36898. me.getFeatureMode = null;
  36899. if (me.fields) {
  36900. while (me.fields.length > 0) {
  36901. me.fields.pop();
  36902. }
  36903. me.fields = null;
  36904. }
  36905. }
  36906. /**
  36907. * @function GetFeaturesByIDsParameters.toJsonParameters
  36908. * @description 将 GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  36909. * @param {GetFeaturesByIDsParameters} params - ID 查询参数对象。
  36910. * @returns {string} 转化后的 JSON 字符串。
  36911. */
  36912. static toJsonParameters(params) {
  36913. var parasByIDs, filterParameter;
  36914. parasByIDs = {
  36915. datasetNames: params.datasetNames,
  36916. getFeatureMode: 'ID',
  36917. ids: params.IDs
  36918. };
  36919. if (params.fields) {
  36920. filterParameter = new FilterParameter();
  36921. filterParameter.name = params.datasetNames;
  36922. filterParameter.fields = params.fields;
  36923. parasByIDs.queryParameter = filterParameter;
  36924. }
  36925. if (params.targetEpsgCode) {
  36926. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  36927. }
  36928. if (typeof params.hasGeometry === 'boolean') {
  36929. parasByIDs.hasGeometry = params.hasGeometry;
  36930. }
  36931. if (!params.targetEpsgCode && params.targetPrj) {
  36932. parasByIDs.targetPrj = params.targetPrj;
  36933. }
  36934. if (params.aggregations) {
  36935. parasByIDs.aggregations = params.aggregations;
  36936. }
  36937. return Util_Util.toJSON(parasByIDs);
  36938. }
  36939. }
  36940. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  36941. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36942. * This program are made available under the terms of the Apache License, Version 2.0
  36943. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36944. /**
  36945. * @class GetFeaturesByIDsService
  36946. * @deprecatedclass SuperMap.GetFeaturesByIDsService
  36947. * @category iServer Data FeatureResults
  36948. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  36949. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  36950. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  36951. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  36952. * @param {Object} options - 参数。
  36953. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  36954. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  36955. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36956. * @param {Object} [options.headers] - 请求头。
  36957. * @extends {GetFeaturesServiceBase}
  36958. * @example
  36959. * var myGetFeaturesByIDsService = new GetFeaturesByIDsService(url, {
  36960. * eventListeners: {
  36961. * "processCompleted": getFeatureCompleted,
  36962. * "processFailed": getFeatureError
  36963. * }
  36964. * });
  36965. * function getFeatureCompleted(object){//todo};
  36966. * function getFeatureError(object){//todo}
  36967. * @usage
  36968. */
  36969. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  36970. constructor(url, options) {
  36971. super(url, options);
  36972. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  36973. }
  36974. /**
  36975. * @function GetFeaturesByIDsService.prototype.destroy
  36976. * @override
  36977. */
  36978. destroy() {
  36979. super.destroy();
  36980. }
  36981. /**
  36982. * @function GetFeaturesByIDsService.prototype.getJsonParameters
  36983. * @description 将查询参数转化为 JSON 字符串。
  36984. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  36985. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  36986. * @returns {string} 转化后的 JSON 字符串。
  36987. */
  36988. getJsonParameters(params) {
  36989. return GetFeaturesByIDsParameters.toJsonParameters(params);
  36990. }
  36991. }
  36992. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  36993. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36994. * This program are made available under the terms of the Apache License, Version 2.0
  36995. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36996. /**
  36997. * @class GetFeaturesBySQLParameters
  36998. * @deprecatedclass SuperMap.GetFeaturesBySQLParameters
  36999. * @category iServer Data FeatureResults
  37000. * @classdesc 数据集 SQL 查询参数类。
  37001. * @param {Object} options - 参数。
  37002. * @param {FilterParameter} options.queryParameter - 查询过滤条件参数。
  37003. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  37004. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  37005. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  37006. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  37007. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  37008. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37009. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  37010. * @extends {GetFeaturesParametersBase}
  37011. * @usage
  37012. */
  37013. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  37014. constructor(options) {
  37015. super(options);
  37016. /**
  37017. * @member {string} GetFeaturesBySQLParameters.prototype.getFeatureMode
  37018. * @description 数据集查询模式。
  37019. */
  37020. this.getFeatureMode = 'SQL';
  37021. /**
  37022. * @member {FilterParameter} GetFeaturesBySQLParameters.prototype.queryParameter
  37023. * @description 查询过滤条件参数类。
  37024. */
  37025. this.queryParameter = null;
  37026. Util_Util.extend(this, options);
  37027. this.CLASS_NAME = 'SuperMap.GetFeaturesBySQLParameters';
  37028. }
  37029. /**
  37030. * @function GetFeaturesBySQLParameters.prototype.destroy
  37031. * @override
  37032. */
  37033. destroy() {
  37034. super.destroy();
  37035. var me = this;
  37036. me.getFeatureMode = null;
  37037. if (me.queryParameter) {
  37038. me.queryParameter.destroy();
  37039. me.queryParameter = null;
  37040. }
  37041. }
  37042. /**
  37043. * @function GetFeaturesBySQLParameters.prototype.toJsonParameters
  37044. * @description 将 GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  37045. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  37046. * @returns {string} 转化后的 JSON 字符串。
  37047. */
  37048. static toJsonParameters(params) {
  37049. var paramsBySql = {
  37050. datasetNames: params.datasetNames,
  37051. getFeatureMode: 'SQL',
  37052. queryParameter: params.queryParameter
  37053. };
  37054. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  37055. paramsBySql.maxFeatures = params.maxFeatures;
  37056. }
  37057. if (typeof params.hasGeometry === 'boolean') {
  37058. paramsBySql.hasGeometry = params.hasGeometry;
  37059. }
  37060. if (params.aggregations) {
  37061. paramsBySql.aggregations = params.aggregations;
  37062. }
  37063. if (params.targetEpsgCode) {
  37064. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  37065. }
  37066. if (!params.targetEpsgCode && params.targetPrj) {
  37067. paramsBySql.targetPrj = params.targetPrj;
  37068. }
  37069. if (params.aggregations) {
  37070. paramsBySql.aggregations = params.aggregations;
  37071. }
  37072. return Util_Util.toJSON(paramsBySql);
  37073. }
  37074. }
  37075. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  37076. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37077. * This program are made available under the terms of the Apache License, Version 2.0
  37078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37079. /**
  37080. * @class GetFeaturesBySQLService
  37081. * @deprecatedclass SuperMap.GetFeaturesBySQLService
  37082. * @constructs GetFeaturesBySQLService
  37083. * @category iServer Data FeatureResults
  37084. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  37085. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  37086. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  37087. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  37088. * @param {Object} options - 参数。
  37089. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  37090. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  37091. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37092. * @param {Object} [options.headers] - 请求头。
  37093. * @extends {GetFeaturesServiceBase}
  37094. * @example
  37095. * var myGetFeaturesBySQLService = new GetFeaturesBySQLService(url, {
  37096. * eventListeners: {
  37097. * "processCompleted": GetFeaturesCompleted,
  37098. * "processFailed": GetFeaturesError
  37099. * }
  37100. * });
  37101. * function getFeaturesCompleted(object){//todo};
  37102. * function getFeaturesError(object){//todo};
  37103. * @usage
  37104. */
  37105. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  37106. constructor(url, options) {
  37107. super(url, options);
  37108. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  37109. }
  37110. /**
  37111. * @function GetFeaturesBySQLService.prototype.destroy
  37112. * @override
  37113. */
  37114. destroy() {
  37115. super.destroy();
  37116. }
  37117. /*
  37118. * @function GetFeaturesBySQLService.prototype.getJsonParameters
  37119. * @description 将查询参数转化为 JSON 字符串。
  37120. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  37121. * @param {GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  37122. * @returns {string} 转化后的 JSON 字符串。
  37123. */
  37124. getJsonParameters(params) {
  37125. return GetFeaturesBySQLParameters.toJsonParameters(params);
  37126. }
  37127. }
  37128. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  37129. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37130. * This program are made available under the terms of the Apache License, Version 2.0
  37131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37132. /**
  37133. * @class GetFieldsService
  37134. * @deprecatedclass SuperMap.GetFieldsService
  37135. * @category iServer Data Field
  37136. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  37137. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  37138. * @param {Object} options - 参数。
  37139. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  37140. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  37141. * @param {string}options.datasource - 数据源名称。
  37142. * @param {string}options.dataset - 数据集名称。
  37143. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37144. * @param {Object} [options.headers] - 请求头。
  37145. * @extends {CommonServiceBase}
  37146. * @example
  37147. * var myService = new GetFieldsService(url, {eventListeners: {
  37148. * "processCompleted": getFieldsCompleted,
  37149. * "processFailed": getFieldsError
  37150. * },
  37151. * datasource: "World",
  37152. * dataset: "Countries"
  37153. * };
  37154. * @usage
  37155. */
  37156. class GetFieldsService extends CommonServiceBase {
  37157. constructor(url, options) {
  37158. super(url, options);
  37159. /**
  37160. * @member {string} GetFieldsService.prototype.datasource
  37161. * @description 要查询的数据集所在的数据源名称。
  37162. */
  37163. this.datasource = null;
  37164. /**
  37165. * @member {string} GetFieldsService.prototype.dataset
  37166. * @description 要查询的数据集名称。
  37167. */
  37168. this.dataset = null;
  37169. if (options) {
  37170. Util_Util.extend(this, options);
  37171. }
  37172. this.CLASS_NAME = "SuperMap.GetFieldsService";
  37173. }
  37174. /**
  37175. * @function GetFieldsService.prototype.destroy
  37176. * @override
  37177. */
  37178. destroy() {
  37179. super.destroy();
  37180. var me = this;
  37181. me.datasource = null;
  37182. me.dataset = null;
  37183. }
  37184. /**
  37185. * @function GetFieldsService.prototype.processAsync
  37186. * @description 执行服务,查询指定数据集的字段信息。
  37187. */
  37188. processAsync() {
  37189. var me = this;
  37190. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  37191. me.request({
  37192. method: "GET",
  37193. data: null,
  37194. scope: me,
  37195. success: me.serviceProcessCompleted,
  37196. failure: me.serviceProcessFailed
  37197. });
  37198. }
  37199. }
  37200. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  37201. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37202. * This program are made available under the terms of the Apache License, Version 2.0
  37203. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37204. /**
  37205. * @class GetGridCellInfosParameters
  37206. * @deprecatedclass SuperMap.GetGridCellInfosParameters
  37207. * @category iServer Data Grid
  37208. * @classdesc 数据服务栅格查询参数类。
  37209. * @param {Object} options - 参数。
  37210. * @param {string} options.datasetName - 数据集名称。
  37211. * @param {string} options.dataSourceName - 数据源名称。
  37212. * @param {number} options.X - 地理位置 X 轴。
  37213. * @param {number} options.Y - 地理位置 Y 轴。
  37214. * @usage
  37215. */
  37216. class GetGridCellInfosParameters {
  37217. constructor(options) {
  37218. /**
  37219. * @member {string} GetGridCellInfosParameters.prototype.datasetName
  37220. * @description 数据集名称。
  37221. */
  37222. this.datasetName = null;
  37223. /**
  37224. * @member {string} GetGridCellInfosParameters.prototype.dataSourceName
  37225. * @description 数据源名称。
  37226. */
  37227. this.dataSourceName = null;
  37228. /**
  37229. * @member {number} GetGridCellInfosParameters.prototype.X
  37230. * @description 要查询的地理位置 X 轴。
  37231. */
  37232. this.X = null;
  37233. /**
  37234. * @member {number} GetGridCellInfosParameters.prototype.Y
  37235. * @description 要查询的地理位置 Y 轴。
  37236. */
  37237. this.Y = null;
  37238. Util_Util.extend(this, options);
  37239. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  37240. }
  37241. /**
  37242. * @function GetGridCellInfosParameters.prototype.destroy
  37243. * @description 释放资源,将引用的资源属性置空。
  37244. */
  37245. destroy() {
  37246. var me = this;
  37247. me.datasetName = null;
  37248. me.dataSourceName = null;
  37249. me.X = null;
  37250. me.Y = null;
  37251. }
  37252. }
  37253. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  37254. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37255. * This program are made available under the terms of the Apache License, Version 2.0
  37256. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37257. /**
  37258. * @class GetGridCellInfosService
  37259. * @deprecatedclass SuperMap.GetGridCellInfosService
  37260. * @category iServer Data Grid
  37261. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  37262. * @param {string} url - 服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  37263. * @param {Object} options - 参数。
  37264. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  37265. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  37266. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37267. * @param {Object} [options.headers] - 请求头。
  37268. * @extends {CommonServiceBase}
  37269. * @example
  37270. * var myService = new GetGridCellInfosService(url, {eventListeners: {
  37271. * "processCompleted": queryCompleted,
  37272. * "processFailed": queryError
  37273. * }
  37274. * });
  37275. * @usage
  37276. */
  37277. class GetGridCellInfosService extends CommonServiceBase {
  37278. constructor(url, options) {
  37279. super(url, options);
  37280. /**
  37281. * @member {string} GetGridCellInfosService.prototype.datasetName
  37282. * @description 数据集名称。
  37283. */
  37284. this.datasetName = null;
  37285. /**
  37286. * @member {string} GetGridCellInfosService.prototype.dataSourceName
  37287. * @description 数据源名称。
  37288. */
  37289. this.dataSourceName = null;
  37290. /**
  37291. * @member {string} GetGridCellInfosService.prototype.datasetType
  37292. * @description 数据集类型。
  37293. */
  37294. this.datasetType = null;
  37295. /**
  37296. * @member {number} GetGridCellInfosService.prototype.X
  37297. * @description 要查询的地理位置X轴
  37298. */
  37299. this.X = null;
  37300. /**
  37301. * @member {number} GetGridCellInfosService.prototype.Y
  37302. * @description 要查询的地理位置Y轴
  37303. */
  37304. this.Y = null;
  37305. if (options) {
  37306. Util_Util.extend(this, options);
  37307. }
  37308. this.eventCount = 0;
  37309. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  37310. }
  37311. /**
  37312. * @function GetGridCellInfosService.prototype.destroy
  37313. * @override
  37314. */
  37315. destroy() {
  37316. super.destroy();
  37317. var me = this;
  37318. me.X = null;
  37319. me.Y = null;
  37320. me.datasetName = null;
  37321. me.dataSourceName = null;
  37322. me.datasetType = null;
  37323. }
  37324. /**
  37325. * @function GetGridCellInfosService.prototype.processAsync
  37326. * @description 执行服务,查询数据集信息。
  37327. * @param {GetGridCellInfosParameters} params - 查询参数。
  37328. */
  37329. processAsync(params, callback) {
  37330. if (!(params instanceof GetGridCellInfosParameters)) {
  37331. return;
  37332. }
  37333. Util_Util.extend(this, params);
  37334. var me = this;
  37335. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  37336. me.queryRequest(me.getDatasetInfoCompleted.bind(me), me.getDatasetInfoFailed.bind(me), callback);
  37337. }
  37338. /**
  37339. * @function GetGridCellInfosService.prototype.queryRequest
  37340. * @description 执行服务,查询。
  37341. * @callback {function} successFun - 成功后执行的函数。
  37342. * @callback {function} failedFunc - 失败后执行的函数。
  37343. */
  37344. queryRequest(successFun, failedFunc, callback) {
  37345. let eventId = ++this.eventCount;
  37346. let eventListeners = {
  37347. scope: this,
  37348. processCompleted: function(result) {
  37349. if (eventId === result.result.eventId && callback) {
  37350. delete result.result.eventId;
  37351. callback(result);
  37352. this.events && this.events.un(eventListeners);
  37353. return false;
  37354. }
  37355. },
  37356. processFailed: function(result) {
  37357. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  37358. callback(result);
  37359. this.events && this.events.un(eventListeners);
  37360. return false;
  37361. }
  37362. }
  37363. }
  37364. this.events.on(eventListeners);
  37365. var me = this;
  37366. me.request({
  37367. method: "GET",
  37368. data: null,
  37369. scope: me,
  37370. success(result, options) {
  37371. result.eventId = eventId;
  37372. successFun(result, options, callback);
  37373. },
  37374. failure(result, options) {
  37375. if (result.error) {
  37376. result.error.eventId = eventId;
  37377. }
  37378. result.eventId = eventId;
  37379. failedFunc(result, options);
  37380. }
  37381. });
  37382. }
  37383. /**
  37384. * @function GetGridCellInfosService.prototype.getDatasetInfoCompleted
  37385. * @description 数据集查询完成,执行此方法。
  37386. * @param {Object} result - 服务器返回的结果对象。
  37387. */
  37388. getDatasetInfoCompleted(result, options, callback) {
  37389. var me = this;
  37390. result = Util_Util.transformResult(result);
  37391. me.datasetType = result.datasetInfo.type;
  37392. me.queryGridInfos(callback);
  37393. }
  37394. /**
  37395. * @function GetGridCellInfosService.prototype.queryGridInfos
  37396. * @description 执行服务,查询数据集栅格信息。
  37397. */
  37398. queryGridInfos(callback) {
  37399. var me = this;
  37400. me.url = Util_Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  37401. if (me.X != null && me.Y != null) {
  37402. me.url = Util_Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  37403. }
  37404. me.queryRequest(me.serviceProcessCompleted.bind(me), me.serviceProcessFailed.bind(me), callback);
  37405. }
  37406. /**
  37407. * @function GetGridCellInfosService.prototype.getDatasetInfoFailed
  37408. * @description 数据集查询失败,执行此方法。
  37409. * @param {Object} result - 服务器返回的结果对象。
  37410. */
  37411. getDatasetInfoFailed(result, options) {
  37412. var me = this;
  37413. me.serviceProcessFailed(result, options);
  37414. }
  37415. }
  37416. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  37417. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37418. * This program are made available under the terms of the Apache License, Version 2.0
  37419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37420. /**
  37421. * @class CommonTheme
  37422. * @aliasclass Theme
  37423. * @deprecatedclass SuperMap.Theme
  37424. * @category iServer Map Theme
  37425. * @classdesc 专题图基类。
  37426. * @param {string} type - 专题图类型。
  37427. * @param {Object} options - 可选参数。
  37428. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  37429. * @usage
  37430. */
  37431. class Theme {
  37432. constructor(type, options) {
  37433. if (!type) {
  37434. return this;
  37435. }
  37436. /**
  37437. * @member {ThemeMemoryData} CommonTheme.prototype.memoryData
  37438. * @description 专题图内存数据。<br>
  37439. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  37440. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  37441. */
  37442. this.memoryData = null;
  37443. /**
  37444. * @member {string} CommonTheme.prototype.type
  37445. * @description 专题图类型。
  37446. */
  37447. this.type = type;
  37448. if (options) {
  37449. Util_Util.extend(this, options);
  37450. }
  37451. this.CLASS_NAME = "SuperMap.Theme";
  37452. }
  37453. /**
  37454. * @function CommonTheme.prototype.destroy
  37455. * @description 释放资源,将引用资源的属性置空。
  37456. */
  37457. destroy() {
  37458. var me = this;
  37459. if (me.memoryData) {
  37460. me.memoryData.destroy();
  37461. me.memoryData = null;
  37462. }
  37463. me.type = null;
  37464. }
  37465. /**
  37466. * @function CommonTheme.prototype.toServerJSONObject
  37467. * @description 转换成对应的 JSON 格式对象。
  37468. * @returns {Object} 对应的 JSON 格式对象。
  37469. */
  37470. toServerJSONObject() {
  37471. //return 子类实现
  37472. return;
  37473. }
  37474. }
  37475. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  37476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37477. * This program are made available under the terms of the Apache License, Version 2.0
  37478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37479. /**
  37480. * @class ServerTextStyle
  37481. * @deprecatedclass SuperMap.ServerTextStyle
  37482. * @category iServer Map Theme
  37483. * @classdesc 服务端文本风格类。该类用于定义文本风格的相关属性。
  37484. * @param {Object} options - 可选参数。
  37485. * @param {TextAlignment} [options.align=TextAlignment.BASELINECENTER] - 文本的对齐方式。
  37486. * @param {ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  37487. * @param {ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  37488. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  37489. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  37490. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  37491. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  37492. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  37493. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  37494. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  37495. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  37496. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  37497. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  37498. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  37499. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  37500. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  37501. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  37502. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  37503. * @usage
  37504. */
  37505. class ServerTextStyle {
  37506. constructor(options) {
  37507. /**
  37508. * @member {TextAlignment} [ServerTextStyle.prototype.align= TextAlignment.BASELINECENTER]
  37509. * @description 文本的对齐方式。
  37510. */
  37511. this.align = TextAlignment.BASELINECENTER;
  37512. /**
  37513. * @member {ServerColor} [ServerTextStyle.prototype.backColor=(255, 255, 255)]
  37514. * @description 文本的背景色。
  37515. */
  37516. this.backColor = new ServerColor(255, 255, 255);
  37517. /**
  37518. * @member {ServerColor} [ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  37519. * @description 文本的前景色。
  37520. */
  37521. this.foreColor = new ServerColor(0, 0, 0);
  37522. /**
  37523. * @member {boolean} [ServerTextStyle.prototype.backOpaque=false]
  37524. * @description 文本背景是否不透明。true 表示文本背景不透明。
  37525. */
  37526. this.backOpaque = false;
  37527. /**
  37528. * @member {boolean} [ServerTextStyle.prototype.sizeFixed=true]
  37529. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  37530. */
  37531. this.sizeFixed = true;
  37532. /**
  37533. * @member {number} [ServerTextStyle.prototype.fontHeight=6]
  37534. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  37535. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  37536. */
  37537. this.fontHeight = 6;
  37538. /**
  37539. * @member {number} [ServerTextStyle.prototype.fontWidth=0]
  37540. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  37541. */
  37542. this.fontWidth = 0;
  37543. /**
  37544. * @member {number} [ServerTextStyle.prototype.fontWeight=400]
  37545. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  37546. */
  37547. this.fontWeight = 400;
  37548. /**
  37549. * @member {string} [ServerTextStyle.prototype.fontName="Times New Roman"]
  37550. * @description 文本字体的名称。
  37551. */
  37552. this.fontName = "Times New Roman";
  37553. /**
  37554. * @member {boolean} [ServerTextStyle.prototype.bold=false]
  37555. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  37556. */
  37557. this.bold = false;
  37558. /**
  37559. * @member {boolean} [ServerTextStyle.prototype.italic=false]
  37560. * @description 文本是否采用斜体。true 表示采用斜体。
  37561. */
  37562. this.italic = false;
  37563. /**
  37564. * @member {number} [ServerTextStyle.prototype.italicAngle=0]
  37565. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  37566. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  37567. */
  37568. this.italicAngle = 0;
  37569. /**
  37570. * @member {boolean} [ServerTextStyle.prototype.shadow=false]
  37571. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  37572. */
  37573. this.shadow = false;
  37574. /**
  37575. * @member {boolean} [ServerTextStyle.prototype.strikeout=false]
  37576. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  37577. */
  37578. this.strikeout = false;
  37579. /**
  37580. * @member {boolean} [ServerTextStyle.prototype.outline=false]
  37581. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  37582. */
  37583. this.outline = false;
  37584. /**
  37585. * @member {number} [ServerTextStyle.prototype.opaqueRate=0]
  37586. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  37587. */
  37588. this.opaqueRate = 0;
  37589. /**
  37590. * @member {boolean} [ServerTextStyle.prototype.underline=false]
  37591. * @description 文本字体是否加下划线。true 表示加下划线。
  37592. */
  37593. this.underline = false;
  37594. /**
  37595. * @member {number} [ServerTextStyle.prototype.rotation=0.0]
  37596. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  37597. */
  37598. this.rotation = 0.0;
  37599. if (options) {
  37600. Util_Util.extend(this, options);
  37601. }
  37602. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  37603. }
  37604. /**
  37605. * @function ServerTextStyle.prototype.destroy
  37606. * @description 释放资源,将引用资源的属性置空。
  37607. */
  37608. destroy() {
  37609. var me = this;
  37610. me.align = null;
  37611. if (me.backColor) {
  37612. me.backColor.destroy();
  37613. me.backColor = null;
  37614. }
  37615. if (me.foreColor) {
  37616. me.foreColor.destroy();
  37617. me.foreColor = null;
  37618. }
  37619. me.backOpaque = null;
  37620. me.sizeFixed = null;
  37621. me.fontHeight = null;
  37622. me.fontWidth = null;
  37623. me.fontWeight = null;
  37624. me.fontName = null;
  37625. me.bold = null;
  37626. me.italic = null;
  37627. me.italicAngle = null;
  37628. me.shadow = null;
  37629. me.strikeout = null;
  37630. me.outline = null;
  37631. me.opaqueRate = null;
  37632. me.underline = null;
  37633. me.rotation = null;
  37634. }
  37635. /**
  37636. * @function ServerTextStyle.fromObj
  37637. * @description 从传入对象获服务端文本风格类。
  37638. * @param {Object} obj - 传入对象
  37639. * @returns {ServerTextStyle} 返回服务端文本风格对象
  37640. */
  37641. static fromObj(obj) {
  37642. var res = new ServerTextStyle(obj);
  37643. Util_Util.copy(res, obj);
  37644. res.backColor = ServerColor.fromJson(obj.backColor);
  37645. res.foreColor = ServerColor.fromJson(obj.foreColor);
  37646. return res;
  37647. }
  37648. }
  37649. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  37650. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37651. * This program are made available under the terms of the Apache License, Version 2.0
  37652. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37653. /**
  37654. * @class ThemeLabelItem
  37655. * @deprecatedclass SuperMap.ThemeLabelItem
  37656. * @category iServer Map Theme
  37657. * @classdesc 分段标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注。
  37658. * 值得注意的是,分段标签专题图允许用户通过 rangeExpression 字段指定用于分段的数值型字段,
  37659. * 同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  37660. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  37661. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 ThemeLabelItem[0].start=0,
  37662. * ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  37663. * @param {Object} options - 可选参数。
  37664. * @param {string} [options.caption] - 子项的名称。
  37665. * @param {number} [options.end=0] - 子项的终止值。
  37666. * @param {number} [options.start=0] - 子项的分段起始值。
  37667. * @param {boolean} [options.visible=true] - 子项是否可见。
  37668. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  37669. * @usage
  37670. */
  37671. class ThemeLabelItem {
  37672. constructor(options) {
  37673. /**
  37674. * @member {string} [ThemeLabelItem.prototype.caption]
  37675. * @description 标签专题子项的标题。
  37676. */
  37677. this.caption = null;
  37678. /**
  37679. * @member {number} [ThemeLabelItem.prototype.end=0]
  37680. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  37681. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  37682. */
  37683. this.end = 0;
  37684. /**
  37685. * @member {number} [ThemeLabelItem.prototype.start=0]
  37686. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  37687. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  37688. */
  37689. this.start = 0;
  37690. /**
  37691. * @member {boolean} [ThemeLabelItem.prototype.visible=true]
  37692. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  37693. */
  37694. this.visible = true;
  37695. /**
  37696. * @member {ServerTextStyle} ThemeLabelItem.prototype.style
  37697. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  37698. * uniformMixedStyle(标签文本的复合风格),ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  37699. */
  37700. this.style = new ServerTextStyle();
  37701. if (options) {
  37702. Util_Util.extend(this, options);
  37703. }
  37704. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  37705. }
  37706. /**
  37707. * @function ThemeLabelItem.prototype.destroy
  37708. * @description 释放资源,将引用资源的属性置空。
  37709. */
  37710. destroy() {
  37711. var me = this;
  37712. me.caption = null;
  37713. me.end = null;
  37714. me.start = null;
  37715. if (me.style) {
  37716. me.style.destroy();
  37717. me.style = null;
  37718. }
  37719. me.visible = null;
  37720. }
  37721. /**
  37722. * @function ThemeLabelItem.fromObj
  37723. * @description 从传入对象获取分段标签专题图的子项类。
  37724. * @param {Object} obj - 传入对象。
  37725. * @returns {ThemeLabelItem} ThemeLabelItem 对象。
  37726. */
  37727. static fromObj(obj) {
  37728. if (!obj) {
  37729. return;
  37730. }
  37731. var t = new ThemeLabelItem();
  37732. Util_Util.copy(t, obj);
  37733. return t;
  37734. }
  37735. }
  37736. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  37737. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37738. * This program are made available under the terms of the Apache License, Version 2.0
  37739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37740. /**
  37741. * @class ThemeUniqueItem
  37742. * @deprecatedclass SuperMap.ThemeUniqueItem
  37743. * @category iServer Map Theme
  37744. * @classdesc 单值专题图子项类。单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  37745. * @param {Object} options - 参数。
  37746. * @param {string} options.unique - 子项的单值字段。
  37747. * @param {string} [options.caption] - 子项的标题。
  37748. * @param {ServerStyle} [options.style] - 子项的风格。
  37749. * @param {boolean} [options.visible=true] - 子项是否可见。
  37750. * @usage
  37751. */
  37752. class ThemeUniqueItem {
  37753. constructor(options) {
  37754. /**
  37755. * @member {string} [ThemeUniqueItem.prototype.caption]
  37756. * @description 单值专题图子项的标题。
  37757. */
  37758. this.caption = null;
  37759. /**
  37760. * @member {ServerStyle} [ThemeUniqueItem.prototype.style]
  37761. * @description 单值专题图子项的显示风格。
  37762. */
  37763. this.style = new ServerStyle();
  37764. /**
  37765. * @member {string} ThemeUniqueItem.prototype.unique
  37766. * @description 单值专题图子项的值,可以为数字、字符串等。
  37767. */
  37768. this.unique = null;
  37769. /**
  37770. * @member {boolean} [ThemeUniqueItem.prototype.visible=true]
  37771. * @description 单值专题图子项的可见性。
  37772. */
  37773. this.visible = true;
  37774. if (options) {
  37775. Util_Util.extend(this, options);
  37776. }
  37777. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  37778. }
  37779. /**
  37780. * @function ThemeUniqueItem.prototype.destroy
  37781. * @description 释放资源,将引用资源的属性置空。
  37782. */
  37783. destroy() {
  37784. var me = this;
  37785. me.caption = null;
  37786. me.unique = null;
  37787. if (me.style) {
  37788. me.style.destroy();
  37789. me.style = null;
  37790. }
  37791. me.visible = null;
  37792. }
  37793. /**
  37794. * @function ThemeUniqueItem.prototype.toServerJSONObject
  37795. * @description 转换成对应的 JSON 格式对象。
  37796. * @returns {Object} 对应的 JSON 格式对象。
  37797. */
  37798. toServerJSONObject() {
  37799. var obj = {};
  37800. obj = Util_Util.copyAttributes(obj, this);
  37801. if (obj.style) {
  37802. if (obj.style.toServerJSONObject) {
  37803. obj.style = obj.style.toServerJSONObject();
  37804. }
  37805. }
  37806. return obj;
  37807. }
  37808. /**
  37809. * @function ThemeUniqueItem.fromObj
  37810. * @description 从传入对象获取单值专题图子项类。
  37811. * @param {Object} obj - 传入对象。
  37812. * @returns {ThemeUniqueItem} ThemeUniqueItem 对象。
  37813. */
  37814. static fromObj(obj) {
  37815. var res = new ThemeUniqueItem();
  37816. Util_Util.copy(res, obj);
  37817. res.style = ServerStyle.fromJson(obj.style);
  37818. return res;
  37819. }
  37820. }
  37821. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  37822. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37823. * This program are made available under the terms of the Apache License, Version 2.0
  37824. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37825. /**
  37826. * @class ThemeOffset
  37827. * @deprecatedclass SuperMap.ThemeOffset
  37828. * @category iServer Map Theme
  37829. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  37830. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  37831. * @param {Object} options - 可选参数。
  37832. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  37833. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  37834. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  37835. * @usage
  37836. */
  37837. class ThemeOffset {
  37838. constructor(options) {
  37839. /**
  37840. * @member {boolean} [ThemeOffset.prototype.offsetFixed=false]
  37841. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,指文本或符号的偏移量不随地图的缩放而变化。
  37842. */
  37843. this.offsetFixed = false;
  37844. /**
  37845. * @member {string} [ThemeOffset.prototype.offsetX=0.0]
  37846. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  37847. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  37848. */
  37849. this.offsetX = "0.0";
  37850. /**
  37851. * @member {string} [ThemeOffset.prototype.offsetY=0.0]
  37852. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  37853. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  37854. */
  37855. this.offsetY = "0.0";
  37856. if (options) {
  37857. Util_Util.extend(this, options);
  37858. }
  37859. this.CLASS_NAME = "SuperMap.ThemeOffset";
  37860. }
  37861. /**
  37862. * @function ThemeOffset.prototype.destroy
  37863. * @description 释放资源,将引用资源的属性置空。
  37864. */
  37865. destroy() {
  37866. var me = this;
  37867. me.offsetFixed = null;
  37868. me.offsetX = null;
  37869. me.offsetY = null;
  37870. }
  37871. /**
  37872. * @function ThemeOffset.fromObj
  37873. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  37874. * @param {Object} obj - 传入对象。
  37875. * @returns {ThemeOffset} ThemeOffset 对象。
  37876. */
  37877. static fromObj(obj) {
  37878. if (!obj) {
  37879. return;
  37880. }
  37881. var res = new ThemeOffset();
  37882. Util_Util.copy(res, obj);
  37883. return res;
  37884. }
  37885. }
  37886. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  37887. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37888. * This program are made available under the terms of the Apache License, Version 2.0
  37889. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37890. /**
  37891. * @class LabelMixedTextStyle
  37892. * @deprecatedclass SuperMap.LabelMixedTextStyle
  37893. * @category iServer Map Theme
  37894. * @classdesc 标签文本复合风格类。
  37895. * 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段:</br>
  37896. * 1.利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  37897. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  37898. * 2.利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  37899. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  37900. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  37901. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  37902. * @param {Object} options - 可选参数。
  37903. * @param {ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  37904. * @param {string} [options.separator] - 文本的分隔符。
  37905. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  37906. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  37907. * @param {Array.<ServerTextStyle>} [options.styles] - 文本样式集合。
  37908. * @usage
  37909. */
  37910. class LabelMixedTextStyle {
  37911. constructor(options) {
  37912. /**
  37913. * @member {ServerTextStyle} LabelMixedTextStyle.prototype.defaultStyle
  37914. * @description 默认的文本复合风格,即 ServerTextStyle 各字段的默认值。
  37915. */
  37916. this.defaultStyle = null;
  37917. /**
  37918. * @member {string} LabelMixedTextStyle.prototype.separator
  37919. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  37920. * 比如文本 “5_109” 被 “ _ ” 分隔为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  37921. * 在显示时,“5” 和分隔符 “ _ ” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  37922. */
  37923. this.separator = null;
  37924. /**
  37925. * @member {boolean} [LabelMixedTextStyle.prototype.separatorEnabled=false]
  37926. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  37927. * 分段后,同一分段内的字符具有相同的显示风格。
  37928. */
  37929. this.separatorEnabled = false;
  37930. /**
  37931. * @member {Array.<number>} LabelMixedTextStyle.prototype.splitIndexes
  37932. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  37933. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  37934. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  37935. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  37936. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  37937. */
  37938. this.splitIndexes = null;
  37939. /**
  37940. * @member {Array.<ServerTextStyle>} LabelMixedTextStyle.prototype.styles
  37941. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  37942. * 如果有分段没有风格对应则使用 defaultStyle。
  37943. */
  37944. this.styles = new ServerTextStyle();
  37945. if (options) {
  37946. Util_Util.extend(this, options);
  37947. }
  37948. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  37949. }
  37950. /**
  37951. * @function LabelMixedTextStyle.prototype.destroy
  37952. * @description 释放资源,将引用资源的属性置空。
  37953. */
  37954. destroy() {
  37955. var me = this;
  37956. if (me.defaultStyle) {
  37957. me.defaultStyle.destroy();
  37958. me.defaultStyle = null;
  37959. }
  37960. me.separator = null;
  37961. me.separatorEnabled = null;
  37962. if (me.splitIndexes) {
  37963. me.splitIndexes = null;
  37964. }
  37965. if (me.styles) {
  37966. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  37967. styles[i].destroy();
  37968. }
  37969. me.styles = null;
  37970. }
  37971. }
  37972. /**
  37973. * @function LabelMixedTextStyle.fromObj
  37974. * @description 从传入对象获取标签文本复合风格类。
  37975. * @param {Object} obj - 传入对象。
  37976. * @returns {LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  37977. */
  37978. static fromObj(obj) {
  37979. if (!obj) {
  37980. return;
  37981. }
  37982. var res = new LabelMixedTextStyle();
  37983. var stys = obj.styles;
  37984. Util_Util.copy(res, obj);
  37985. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  37986. if (stys) {
  37987. res.styles = [];
  37988. for (var i = 0, len = stys.length; i < len; i++) {
  37989. res.styles.push(new ServerTextStyle(stys[i]));
  37990. }
  37991. }
  37992. return res;
  37993. }
  37994. }
  37995. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  37996. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37997. * This program are made available under the terms of the Apache License, Version 2.0
  37998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37999. /**
  38000. * @class ThemeLabelText
  38001. * @deprecatedclass SuperMap.ThemeLabelText
  38002. * @category iServer Map Theme
  38003. * @classdesc 标签中文本风格类。
  38004. * 通过该类可以设置标签中的文本字体大小和显示风格。
  38005. * @param {Object} options - 参数。
  38006. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  38007. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  38008. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  38009. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  38010. * @param {ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  38011. * @param {LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  38012. * @usage
  38013. */
  38014. class ThemeLabelText {
  38015. constructor(options) {
  38016. /**
  38017. * @member {number} [ThemeLabelText.prototype.maxTextHeight=0]
  38018. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  38019. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为毫米。
  38020. */
  38021. this.maxTextHeight = 0;
  38022. /**
  38023. * @member {number} [ThemeLabelText.prototype.maxTextWidth=0]
  38024. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  38025. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为毫米。
  38026. */
  38027. this.maxTextWidth = 0;
  38028. /**
  38029. * @member {number} [ThemeLabelText.prototype.minTextHeight=0]
  38030. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  38031. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为毫米。
  38032. */
  38033. this.minTextHeight = 0;
  38034. /**
  38035. * @member {number} [ThemeLabelText.prototype.minTextWidth=0]
  38036. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  38037. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为毫米。
  38038. */
  38039. this.minTextWidth = 0;
  38040. /**
  38041. * @member {ServerTextStyle} [ThemeLabelText.prototype.uniformStyle]
  38042. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  38043. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  38044. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  38045. */
  38046. this.uniformStyle = new ServerTextStyle();
  38047. /**
  38048. *@member {LabelMixedTextStyle} [ThemeLabelText.prototype.uniformMixedStyle]
  38049. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  38050. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  38051. */
  38052. this.uniformMixedStyle = null;
  38053. if (options) {
  38054. Util_Util.extend(this, options);
  38055. }
  38056. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  38057. }
  38058. /**
  38059. * @function ThemeLabelText.prototype.destroy
  38060. * @description 释放资源,将引用资源的属性置空。
  38061. */
  38062. destroy() {
  38063. var me = this;
  38064. me.maxTextHeight = null;
  38065. me.maxTextWidth = null;
  38066. me.minTextHeight = null;
  38067. me.minTextWidth = null;
  38068. if (me.uniformStyle) {
  38069. me.uniformStyle.destroy();
  38070. me.uniformStyle = null;
  38071. }
  38072. if (me.uniformMixedStyle) {
  38073. me.uniformMixedStyle.destroy();
  38074. me.uniformMixedStyle = null;
  38075. }
  38076. }
  38077. /**
  38078. * @function ThemeLabelText.fromObj
  38079. * @description 从传入对象获取标签中文本风格类。
  38080. * @param {Object} obj - 传入对象。
  38081. * @returns {ThemeLabelText} ThemeLabelText 对象。
  38082. */
  38083. static fromObj(obj) {
  38084. if (!obj) {
  38085. return;
  38086. }
  38087. var res = new ThemeLabelText();
  38088. Util_Util.copy(res, obj);
  38089. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  38090. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  38091. return res;
  38092. }
  38093. }
  38094. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  38095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38096. * This program are made available under the terms of the Apache License, Version 2.0
  38097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38098. /**
  38099. * @class ThemeLabelAlongLine
  38100. * @deprecatedclass SuperMap.ThemeLabelAlongLine
  38101. * @category iServer Map Theme
  38102. * @classdesc 标签沿线标注样式类。
  38103. * @param {Object} options - 可选参数。
  38104. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  38105. * @param {AlongLineDirection} [options.alongLineDirection=AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  38106. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  38107. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  38108. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  38109. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  38110. * @usage
  38111. */
  38112. class ThemeLabelAlongLine {
  38113. constructor(options) {
  38114. /**
  38115. * @member {boolean} [ThemeLabelAlongLine.prototype.isAlongLine=true]
  38116. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  38117. */
  38118. this.isAlongLine = true;
  38119. /**
  38120. * @member {AlongLineDirection} [ThemeLabelAlongLine.prototype.alongLineDirection=AlongLineDirection.LB_TO_RT]
  38121. * @description 标签沿线标注方向。
  38122. */
  38123. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  38124. /**
  38125. * @member {boolean} [ThemeLabelAlongLine.prototype.angleFixed=false]
  38126. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  38127. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  38128. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  38129. */
  38130. this.angleFixed = false;
  38131. /**
  38132. * @member {boolean} ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  38133. * @description 沿线循环标注时是否避免标签重复标注。
  38134. */
  38135. this.repeatedLabelAvoided = false;
  38136. /**
  38137. * @member {boolean} [ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  38138. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  38139. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  38140. */
  38141. this.repeatIntervalFixed = false;
  38142. /**
  38143. * @member {number} [ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  38144. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  38145. * 的时候,labelRepeatInterval 属性才有效。
  38146. */
  38147. this.labelRepeatInterval = 0;
  38148. if (options) {
  38149. Util_Util.extend(this, options);
  38150. }
  38151. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  38152. }
  38153. /**
  38154. * @function ThemeLabelAlongLine.prototype.destroy
  38155. * @description 释放资源,将引用资源的属性置空。
  38156. */
  38157. destroy() {
  38158. var me = this;
  38159. me.isAlongLine = null;
  38160. me.alongLineDirection = null;
  38161. me.angleFixed = null;
  38162. me.repeatedLabelAvoided = null;
  38163. me.repeatIntervalFixed = null;
  38164. me.labelRepeatInterval = null;
  38165. }
  38166. /**
  38167. * @function ThemeLabelAlongLine.fromObj
  38168. * @description 从传入对象获取标签沿线标注样式类。
  38169. * @param {Object} obj - 传入对象。
  38170. * @returns {ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  38171. */
  38172. static fromObj(obj) {
  38173. if (!obj) {
  38174. return;
  38175. }
  38176. var t = new ThemeLabelAlongLine();
  38177. Util_Util.copy(t, obj);
  38178. return t;
  38179. }
  38180. }
  38181. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  38182. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38183. * This program are made available under the terms of the Apache License, Version 2.0
  38184. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38185. /**
  38186. * @class ThemeLabelBackground
  38187. * @deprecatedclass SuperMap.ThemeLabelBackground
  38188. * @category iServer Map Theme
  38189. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  38190. * @param {Object} options - 可选参数。
  38191. * @param {LabelBackShape} [options.labelBackShape=LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  38192. * @param {ServerStyle} [options.backStyle] - 标签专题图中标签背景风格。
  38193. * @usage
  38194. */
  38195. class ThemeLabelBackground {
  38196. constructor(options) {
  38197. /**
  38198. * @member {LabelBackShape} [ThemeLabelBackground.prototype.labelBackShape=LabelBackShape.NONE]
  38199. * @description 标签专题图中标签背景风格。当背景形状
  38200. * labelBackShape 属性设为 NONE(即无背景形状)时,backStyle 属性无效。
  38201. */
  38202. this.labelBackShape = LabelBackShape.NONE;
  38203. /**
  38204. * @member {ServerStyle} [ThemeLabelBackground.prototype.backStyle]
  38205. * @description 标签专题图中标签背景的形状枚举类。背景类型可以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  38206. */
  38207. this.backStyle = new ServerStyle();
  38208. if (options) {
  38209. Util_Util.extend(this, options);
  38210. }
  38211. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  38212. }
  38213. /**
  38214. * @function ThemeLabelBackground.prototype.destroy
  38215. * @description 释放资源,将引用资源的属性置空。
  38216. */
  38217. destroy() {
  38218. var me = this;
  38219. me.labelBackShape = null;
  38220. if (me.backStyle) {
  38221. me.backStyle.destroy();
  38222. me.backStyle = null;
  38223. }
  38224. }
  38225. /**
  38226. * @function ThemeLabelBackground.fromObj
  38227. * @description 从传入对象获取标签背景风格类。
  38228. * @param {Object} obj - 传入对象。
  38229. * @returns {ThemeLabelBackground} ThemeLabelBackground 对象。
  38230. */
  38231. static fromObj(obj) {
  38232. if (!obj) {
  38233. return;
  38234. }
  38235. var t = new ThemeLabelBackground();
  38236. t.labelBackShape = obj.labelBackShape;
  38237. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  38238. return t;
  38239. }
  38240. }
  38241. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  38242. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38243. * This program are made available under the terms of the Apache License, Version 2.0
  38244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38245. /**
  38246. * @class ThemeLabel
  38247. * @deprecatedclass SuperMap.ThemeLabel
  38248. * @category iServer Map Theme
  38249. * @classdesc 标签专题图类。
  38250. * @extends CommonTheme
  38251. * @param {Object} options - 参数。
  38252. * @param {Array.<ThemeLabelItem>} options.items - 子项数组。
  38253. * @param {string} options.labelExpression - 标注字段表达式。
  38254. * @param {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} options.matrixCells - 矩阵标签元素数组。
  38255. * @param {ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  38256. * @param {ThemeLabelBackground} [options.background] - 标签的背景风格类。
  38257. * @param {LabelOverLengthMode} [options.labelOverLengthMode=LabelOverLengthMode.NONE] - 超长标签的处理模式枚举类。
  38258. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  38259. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  38260. * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
  38261. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  38262. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  38263. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  38264. * @param {ThemeLabelText} options.text - 标签中文本风格。
  38265. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  38266. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  38267. * @usage
  38268. */
  38269. class ThemeLabel extends Theme {
  38270. constructor(options) {
  38271. super("LABEL", options);
  38272. /**
  38273. * @member {ThemeLabelAlongLine} [ThemeLabel.prototype.alongLine]
  38274. * @description 标签沿线标注方向样式类。
  38275. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  38276. */
  38277. this.alongLine = new ThemeLabelAlongLine();
  38278. /**
  38279. * @member {ThemeLabelBackground} [ThemeLabel.prototype.background]
  38280. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  38281. */
  38282. this.background = new ThemeLabelBackground();
  38283. /**
  38284. * @member {Array.<ThemeLabelItem>} [ThemeLabel.prototype.items]
  38285. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  38286. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  38287. */
  38288. this.items = null;
  38289. /**
  38290. * @member {Array.<ThemeLabelUniqueItem>} ThemeLabel.prototype.uniqueItems
  38291. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  38292. */
  38293. this.uniqueItems = null;
  38294. /**
  38295. * @member {string} ThemeLabel.prototype.labelExpression
  38296. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  38297. */
  38298. this.labelExpression = null;
  38299. /**
  38300. * @member {LabelOverLengthMode} [ThemeLabel.prototype.labelOverLengthMode=LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  38301. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  38302. */
  38303. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  38304. /**
  38305. * @member {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} ThemeLabel.prototype.matrixCells
  38306. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  38307. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  38308. */
  38309. this.matrixCells = null;
  38310. /**
  38311. * @member {number} [ThemeLabel.prototype.maxLabelLength=256]
  38312. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  38313. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  38314. */
  38315. this.maxLabelLength = 256;
  38316. /**
  38317. * @member {number} [ThemeLabel.prototype.numericPrecision=0]
  38318. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  38319. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  38320. */
  38321. this.numericPrecision = 0;
  38322. /**
  38323. * @member {ThemeOffset} [ThemeLabel.prototype.offset]
  38324. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  38325. */
  38326. this.offset = new ThemeOffset();
  38327. /**
  38328. * @member {boolean} [ThemeLabel.prototype.overlapAvoided=true]
  38329. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  38330. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  38331. */
  38332. this.overlapAvoided = true;
  38333. /**
  38334. * @member {string} ThemeLabel.prototype.rangeExpression
  38335. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  38336. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  38337. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  38338. */
  38339. this.rangeExpression = null;
  38340. /**
  38341. * @member {string} ThemeLabel.prototype.uniqueExpression
  38342. * @description 用于制作单值专题图的字段或字段表达式。
  38343. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  38344. */
  38345. this.uniqueExpression = null;
  38346. /**
  38347. * @member {boolean} [ThemeLabel.prototype.smallGeometryLabeled=false]
  38348. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  38349. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  38350. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  38351. */
  38352. this.smallGeometryLabeled = false;
  38353. /**
  38354. * @member {ThemeLabelText} ThemeLabel.prototype.text
  38355. * @description 标签中文本风格。
  38356. */
  38357. this.text = new ThemeLabelText();
  38358. /**
  38359. * @member {number} [ThemeLabel.prototype.textSpace=0]
  38360. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  38361. */
  38362. this.textSpace = 0;
  38363. if (options) {
  38364. Util_Util.extend(this, options);
  38365. }
  38366. this.CLASS_NAME = "SuperMap.ThemeLabel";
  38367. }
  38368. /**
  38369. * @function ThemeLabel.prototype.destroy
  38370. * @override
  38371. */
  38372. destroy() {
  38373. super.destroy();
  38374. var me = this;
  38375. me.alongLine = null;
  38376. if (me.background) {
  38377. me.background.destroy();
  38378. me.background = null;
  38379. }
  38380. if (me.items) {
  38381. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  38382. items[i].destroy();
  38383. }
  38384. me.items = null;
  38385. }
  38386. if (me.uniqueItems) {
  38387. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  38388. uniqueItems[j].destory();
  38389. }
  38390. me.uniqueItems = null;
  38391. }
  38392. me.labelExpression = null;
  38393. me.labelOverLengthMode = null;
  38394. me.matrixCells = null;
  38395. me.maxLabelLength = null;
  38396. me.numericPrecision = null;
  38397. me.overlapAvoided = null;
  38398. me.rangeExpression = null;
  38399. me.uniqueExpression = null;
  38400. if (me.offset) {
  38401. me.offset.destroy();
  38402. me.offset = null;
  38403. }
  38404. me.overlapAvoided = null;
  38405. me.smallGeometryLabeled = null;
  38406. if (me.text) {
  38407. me.text.destroy();
  38408. me.text = null;
  38409. }
  38410. me.textSpace = null;
  38411. }
  38412. /**
  38413. * @function ThemeLabel.prototype.toJSON
  38414. * @description 将themeLabel对象转化为 JSON 字符串。
  38415. * @returns {string} 返回转换后的 JSON 字符串。
  38416. */
  38417. toJSON() {
  38418. return Util_Util.toJSON(this.toServerJSONObject());
  38419. }
  38420. /**
  38421. * @function ThemeLabel.prototype.toServerJSONObject
  38422. * @description 转换成对应的 JSON 格式对象。
  38423. * @returns {Object} 对应的 JSON 格式对象。
  38424. */
  38425. toServerJSONObject() {
  38426. var obj = {};
  38427. obj.type = this.type;
  38428. obj.memoryData = this.memoryData;
  38429. if (this.alongLine) {
  38430. obj.alongLine = this.alongLine.isAlongLine;
  38431. obj.alongLineDirection = this.alongLine.alongLineDirection;
  38432. obj.angleFixed = this.alongLine.angleFixed;
  38433. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  38434. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  38435. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  38436. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  38437. }
  38438. if (this.offset) {
  38439. obj.offsetFixed = this.offset.offsetFixed;
  38440. obj.offsetX = this.offset.offsetX;
  38441. obj.offsetY = this.offset.offsetY;
  38442. }
  38443. if (this.text) {
  38444. obj.maxTextHeight = this.text.maxTextHeight;
  38445. obj.maxTextWidth = this.text.maxTextWidth;
  38446. obj.minTextHeight = this.text.minTextHeight;
  38447. obj.minTextWidth = this.text.minTextWidth;
  38448. obj.uniformStyle = this.text.uniformStyle;
  38449. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  38450. }
  38451. if (this.background) {
  38452. obj.labelBackShape = this.background.labelBackShape;
  38453. obj.backStyle = this.background.backStyle;
  38454. }
  38455. obj.labelOverLengthMode = this.labelOverLengthMode;
  38456. obj.maxLabelLength = this.maxLabelLength;
  38457. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  38458. obj.rangeExpression = this.rangeExpression;
  38459. obj.uniqueExpression = this.uniqueExpression;
  38460. obj.numericPrecision = this.numericPrecision;
  38461. obj.items = this.items;
  38462. obj.uniqueItems = this.uniqueItems;
  38463. obj.labelExpression = this.labelExpression;
  38464. obj.overlapAvoided = this.overlapAvoided;
  38465. obj.matrixCells = this.matrixCells;
  38466. obj.textSpace = this.textSpace;
  38467. return obj;
  38468. }
  38469. /**
  38470. * @function ThemeLabel.fromObj
  38471. * @description 从传入对象获取标签专题图类。
  38472. * @param {Object} obj - 传入对象。
  38473. * @returns {ThemeLabel} ThemeLabel 对象。
  38474. */
  38475. static fromObj(obj) {
  38476. if (!obj) {
  38477. return;
  38478. }
  38479. var lab = new ThemeLabel();
  38480. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  38481. obj.matrixCells = null;
  38482. Util_Util.copy(lab, obj);
  38483. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  38484. lab.background = ThemeLabelBackground.fromObj(obj);
  38485. if (itemsL) {
  38486. lab.items = [];
  38487. for (var i = 0, len = itemsL.length; i < len; i++) {
  38488. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  38489. }
  38490. }
  38491. if (itemsU) {
  38492. lab.uniqueItems = [];
  38493. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  38494. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  38495. }
  38496. }
  38497. if (cells) {
  38498. lab.matrixCells = [];
  38499. for (let i = 0, len = cells.length; i < len; i++) {
  38500. //TODO
  38501. //lab.matrixCells.push(LabelMatrixCell.fromObj(cells[i]));
  38502. }
  38503. }
  38504. lab.offset = ThemeOffset.fromObj(obj);
  38505. lab.text = ThemeLabelText.fromObj(obj);
  38506. return lab;
  38507. }
  38508. }
  38509. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  38510. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38511. * This program are made available under the terms of the Apache License, Version 2.0
  38512. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38513. /**
  38514. * @class ThemeUnique
  38515. * @deprecatedclass SuperMap.ThemeUnique
  38516. * @category iServer Map Theme
  38517. * @classdesc 单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  38518. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  38519. * @extends {CommonTheme}
  38520. * @param {Object} options - 参数。
  38521. * @param {Array.<ThemeUniqueItem>} options.items - 子项类数组。
  38522. * @param {string} options.uniqueExpression - 指定单值专题图的字段或字段表达式。
  38523. * @param {ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  38524. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  38525. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  38526. * @usage
  38527. */
  38528. class ThemeUnique extends Theme {
  38529. constructor(options) {
  38530. super("UNIQUE", options);
  38531. /**
  38532. * @member {ServerStyle} ThemeUnique.prototype.defaultStyle
  38533. * @description 未参与单值专题图制作的对象的显示风格。
  38534. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  38535. */
  38536. this.defaultStyle = new ServerStyle();
  38537. /**
  38538. * @member {Array.<ThemeUniqueItem>} ThemeUnique.prototype.items
  38539. * @description 单值专题图子项类数组。
  38540. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  38541. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  38542. */
  38543. this.items = null;
  38544. /**
  38545. * @member {string} ThemeUnique.prototype.uniqueExpression
  38546. * @description 用于制作单值专题图的字段或字段表达式。
  38547. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  38548. */
  38549. this.uniqueExpression = null;
  38550. /**
  38551. * @member {ColorGradientType} [ThemeUnique.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  38552. * @description 渐变颜色枚举类。
  38553. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  38554. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  38555. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  38556. * 该配色方案对于这几个子项将不起作用。
  38557. */
  38558. this.colorGradientType = ColorGradientType.YELLOW_RED;
  38559. if (options) {
  38560. Util_Util.extend(this, options);
  38561. }
  38562. this.CLASS_NAME = "SuperMap.ThemeUnique";
  38563. }
  38564. /**
  38565. * @function ThemeUnique.prototype.destroy
  38566. * @override
  38567. */
  38568. destroy() {
  38569. super.destroy();
  38570. var me = this;
  38571. me.uniqueExpression = null;
  38572. me.colorGradientType = null;
  38573. if (me.items) {
  38574. if (me.items.length > 0) {
  38575. for (var item in me.items) {
  38576. me.items[item].destroy();
  38577. me.items[item] = null;
  38578. }
  38579. }
  38580. me.items = null;
  38581. }
  38582. if (me.defaultStyle) {
  38583. me.defaultStyle.destroy();
  38584. me.defaultStyle = null;
  38585. }
  38586. }
  38587. /**
  38588. * @function ThemeUnique.prototype.toServerJSONObject
  38589. * @description 转换成对应的 JSON 格式对象。
  38590. * @returns {Object} 对应的 JSON 格式对象。
  38591. */
  38592. toServerJSONObject() {
  38593. var obj = {};
  38594. obj = Util_Util.copyAttributes(obj, this);
  38595. if (obj.defaultStyle) {
  38596. if (obj.defaultStyle.toServerJSONObject) {
  38597. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  38598. }
  38599. }
  38600. if (obj.items) {
  38601. var items = [],
  38602. len = obj.items.length;
  38603. for (var i = 0; i < len; i++) {
  38604. items.push(obj.items[i].toServerJSONObject());
  38605. }
  38606. obj.items = items;
  38607. }
  38608. return obj;
  38609. }
  38610. /**
  38611. * @function ThemeUnique.fromObj
  38612. * @description 从传入对象获取单值专题图类。
  38613. * @param {Object} obj - 传入对象。
  38614. * @returns {ThemeUnique} ThemeUnique 对象。
  38615. */
  38616. static fromObj(obj) {
  38617. var res = new ThemeUnique();
  38618. var uItems = obj.items;
  38619. var len = uItems ? uItems.length : 0;
  38620. Util_Util.extend(res, obj);
  38621. res.items = [];
  38622. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  38623. for (var i = 0; i < len; i++) {
  38624. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  38625. }
  38626. return res;
  38627. }
  38628. }
  38629. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  38630. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38631. * This program are made available under the terms of the Apache License, Version 2.0
  38632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38633. /**
  38634. * @class ThemeGraphAxes
  38635. * @deprecatedclass SuperMap.ThemeGraphAxes
  38636. * @category iServer Map Theme
  38637. * @classdesc 统计专题图坐标轴样式类。
  38638. * @param {Object} options - 参数。
  38639. * @param {ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  38640. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  38641. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  38642. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  38643. * @param {ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  38644. * @usage
  38645. */
  38646. class ThemeGraphAxes {
  38647. constructor(options) {
  38648. /**
  38649. * @member {ServerColor} [ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  38650. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  38651. */
  38652. this.axesColor = new ServerColor(0, 0, 0);
  38653. /**
  38654. * @member {boolean} [ThemeGraphAxes.prototype.axesDisplayed=false]
  38655. * @description 是否显示坐标轴。<br>
  38656. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  38657. */
  38658. this.axesDisplayed = false;
  38659. /**
  38660. * @member {boolean} [ThemeGraphAxes.prototype.axesGridDisplayed=false]
  38661. * @description 是否在统计图坐标轴上显示网格。
  38662. */
  38663. this.axesGridDisplayed = false;
  38664. /**
  38665. * @member {boolean} [ThemeGraphAxes.prototype.axesTextDisplayed=false]
  38666. * @description 是否显示坐标轴的文本标注。
  38667. */
  38668. this.axesTextDisplayed = false;
  38669. /**
  38670. * @member {ServerTextStyle} ThemeGraphAxes.prototype.axesTextStyle
  38671. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  38672. */
  38673. this.axesTextStyle = new ServerTextStyle();
  38674. if (options) {
  38675. Util_Util.extend(this, options);
  38676. }
  38677. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  38678. }
  38679. /**
  38680. * @function ThemeGraphAxes.prototype.destroy
  38681. * @description 释放资源,将引用资源的属性置空。
  38682. */
  38683. destroy() {
  38684. var me = this;
  38685. if (me.axesColor) {
  38686. me.axesColor.destroy();
  38687. me.axesColor = null;
  38688. }
  38689. me.axesDisplayed = null;
  38690. me.axesGridDisplayed = null;
  38691. me.axesTextDisplayed = null;
  38692. if (me.axesTextStyle) {
  38693. me.axesTextStyle.destroy();
  38694. me.axesTextStyle = null;
  38695. }
  38696. }
  38697. /**
  38698. * @function ThemeGraphAxes.fromObj
  38699. * @description 从传入对象获取统计专题图坐标轴样式类。
  38700. * @param {Object} obj - 传入对象。
  38701. * @returns {ThemeGraphAxes} ThemeGraphAxes 对象。
  38702. */
  38703. static fromObj(obj) {
  38704. if (!obj) {
  38705. return;
  38706. }
  38707. var res = new ThemeGraphAxes();
  38708. Util_Util.copy(res, obj);
  38709. res.axesColor = ServerColor.fromJson(obj.axesColor);
  38710. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  38711. return res;
  38712. }
  38713. }
  38714. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  38715. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38716. * This program are made available under the terms of the Apache License, Version 2.0
  38717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38718. /**
  38719. * @class ThemeGraphSize
  38720. * @deprecatedclass SuperMap.ThemeGraphSize
  38721. * @category iServer Map Theme
  38722. * @classdesc 统计专题图符号尺寸类。
  38723. * @param {Object} options - 参数。
  38724. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  38725. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  38726. * @usage
  38727. */
  38728. class ThemeGraphSize {
  38729. constructor(options) {
  38730. /**
  38731. * @member {number} [ThemeGraphSize.prototype.maxGraphSize=0]
  38732. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  38733. */
  38734. this.maxGraphSize = 0;
  38735. /**
  38736. * @member {number} [ThemeGraphSize.prototype.minGraphSize=0]
  38737. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  38738. */
  38739. this.minGraphSize = 0;
  38740. if (options) {
  38741. Util_Util.extend(this, options);
  38742. }
  38743. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  38744. }
  38745. /**
  38746. * @function ThemeGraphSize.prototype.destroy
  38747. * @description 释放资源,将引用资源的属性置空。
  38748. */
  38749. destroy() {
  38750. var me = this;
  38751. me.maxGraphSize = null;
  38752. me.minGraphSize = null;
  38753. }
  38754. /**
  38755. * @function ThemeGraphSize.fromObj
  38756. * @description 从传入对象获统计专题图符号尺寸类。
  38757. * @param {Object} obj - 传入对象。
  38758. * @returns {ThemeGraphSize} ThemeGraphSize 对象。
  38759. */
  38760. static fromObj(obj) {
  38761. var res = new ThemeGraphSize();
  38762. Util_Util.copy(res, obj);
  38763. return res;
  38764. }
  38765. }
  38766. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  38767. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38768. * This program are made available under the terms of the Apache License, Version 2.0
  38769. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38770. /**
  38771. * @class ThemeGraphText
  38772. * @deprecatedclass SuperMap.ThemeGraphText
  38773. * @category iServer Map Theme
  38774. * @classdesc 统计图文字标注风格类。
  38775. * @param {Object} options - 可选参数。
  38776. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  38777. * @param {ThemeGraphTextFormat} [options.graphTextFormat=ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  38778. * @param {ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  38779. * @usage
  38780. */
  38781. class ThemeGraphText {
  38782. constructor(options) {
  38783. /**
  38784. * @member {boolean} [ThemeGraphText.prototype.graphTextDisplayed=false]
  38785. * @description 是否显示统计图上的文字标注。
  38786. */
  38787. this.graphTextDisplayed = false;
  38788. /**
  38789. * @member {ThemeGraphTextFormat} [ThemeGraphText.prototype.graphTextFormat=ThemeGraphTextFormat.CAPTION]
  38790. * @description 统计专题图文本显示格式。
  38791. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  38792. */
  38793. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  38794. /**
  38795. * @member {ServerTextStyle} ThemeGraphText.prototype.graphTextStyle
  38796. * @description 统计图上的文字标注风格。
  38797. */
  38798. this.graphTextStyle = new ServerTextStyle();
  38799. if (options) {
  38800. Util_Util.extend(this, options);
  38801. }
  38802. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  38803. }
  38804. /**
  38805. * @function ThemeGraphText.prototype.destroy
  38806. * @description 释放资源,将引用资源的属性置空。
  38807. */
  38808. destroy() {
  38809. var me = this;
  38810. me.graphTextDisplayed = null;
  38811. me.graphTextFormat = null;
  38812. if (me.graphTextStyle) {
  38813. me.graphTextStyle.destroy();
  38814. me.graphTextStyle = null;
  38815. }
  38816. }
  38817. /**
  38818. * @function ThemeGraphText.fromObj
  38819. * @description 从传入对象获取统计图文字标注风格类。
  38820. * @param {Object} obj - 传入对象。
  38821. * @returns {ThemeGraphText} ThemeGraphText 对象。
  38822. */
  38823. static fromObj(obj) {
  38824. var res = new ThemeGraphText();
  38825. Util_Util.copy(res, obj);
  38826. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  38827. return res;
  38828. }
  38829. }
  38830. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  38831. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38832. * This program are made available under the terms of the Apache License, Version 2.0
  38833. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38834. /**
  38835. * @class ThemeGraphItem
  38836. * @deprecatedclass SuperMap.ThemeGraphItem
  38837. * @category iServer Map Theme
  38838. * @classdesc 统计专题图子项类。
  38839. * @param {Object} options - 参数。
  38840. * @param {string} [options.caption] - 专题图子项的名称。
  38841. * @param {string} options.graphExpression - 统计专题图的专题变量。
  38842. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  38843. * @param {ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格。
  38844. * @usage
  38845. */
  38846. class ThemeGraphItem {
  38847. constructor(options) {
  38848. /**
  38849. * @member {string} [ThemeGraphItem.prototype.caption]
  38850. * @description 专题图子项的名称。
  38851. */
  38852. this.caption = null;
  38853. /**
  38854. * @member {string} ThemeGraphItem.prototype.graphExpression
  38855. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  38856. */
  38857. this.graphExpression = null;
  38858. /**
  38859. * @member {Array.<number>} [ThemeGraphItem.prototype.memoryDoubleValues]
  38860. * @description 内存数组方式制作专题图时的值数组。<br>
  38861. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link ThemeGraph#memoryKeys})中的记录制作专题图。
  38862. * 值数组的数值个数必须与键数组中数值的个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  38863. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  38864. */
  38865. this.memoryDoubleValues = null;
  38866. /**
  38867. * @member {ServerStyle} [ThemeGraphItem.prototype.uniformStyle]
  38868. * @description 统计专题图子项的显示风格。
  38869. * 每一个统计专题图子项都对应一种显示风格。
  38870. */
  38871. this.uniformStyle = new ServerStyle();
  38872. if (options) {
  38873. Util_Util.extend(this, options);
  38874. }
  38875. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  38876. }
  38877. /**
  38878. * @function ThemeGraphItem.prototype.destroy
  38879. * @description 释放资源,将引用资源的属性置空。
  38880. */
  38881. destroy() {
  38882. var me = this;
  38883. me.caption = null;
  38884. me.graphExpression = null;
  38885. me.memoryDoubleValues = null;
  38886. me.uniformStyle = null;
  38887. }
  38888. /**
  38889. * @function ThemeGraphItem.fromObj
  38890. * @description 从传入对象获取统计专题图子项类。
  38891. * @param {Object} obj - 传入对象。
  38892. * @returns {ThemeGraphItem} ThemeGraphItem 对象。
  38893. */
  38894. static fromObj(obj) {
  38895. if (!obj) {
  38896. return;
  38897. }
  38898. var res = new ThemeGraphItem();
  38899. Util_Util.copy(res, obj);
  38900. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  38901. return res;
  38902. }
  38903. }
  38904. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  38905. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38906. * This program are made available under the terms of the Apache License, Version 2.0
  38907. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38908. /**
  38909. * @class ThemeGraph
  38910. * @deprecatedclass SuperMap.ThemeGraph
  38911. * @category iServer Map Theme
  38912. * @classdesc 统计专题图类。
  38913. * @extends {CommonTheme}
  38914. * @param {Object} options - 参数。
  38915. * @param {Array.<ThemeGraphItem>} options.items - 统计专题图子项集合。
  38916. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  38917. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  38918. * @param {ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  38919. * @param {ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  38920. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  38921. * @param {ThemeGraphText} [options.graphText] - 统计图上的文字是否可见以及文字标注风格。
  38922. * @param {GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  38923. * @param {ThemeGraphType} [options.graphType=ThemeGraphType.AREA] - 统计专题图类型。
  38924. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  38925. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  38926. * @param {ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  38927. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  38928. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  38929. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  38930. * @usage
  38931. */
  38932. class ThemeGraph extends Theme {
  38933. constructor(options) {
  38934. super("GRAPH", options);
  38935. /**
  38936. * @member {number} [ThemeGraph.prototype.barWidth=0]
  38937. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  38938. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  38939. */
  38940. this.barWidth = 0;
  38941. /**
  38942. * @member {GraduatedMode} [ThemeGraph.prototype.graduatedMode=GraduatedMode.CONSTANT]
  38943. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  38944. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  38945. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  38946. */
  38947. this.graduatedMode = GraduatedMode.CONSTANT;
  38948. /**
  38949. * @member {ThemeGraphAxes} ThemeGraph.prototype.graphAxes
  38950. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  38951. */
  38952. this.graphAxes = new ThemeGraphAxes();
  38953. /**
  38954. * @member {ThemeGraphSize} [ThemeGraph.prototype.graphSize=0]
  38955. * @description 用于设置统计符号的最大最小尺寸。
  38956. */
  38957. this.graphSize = new ThemeGraphSize();
  38958. /**
  38959. * @member {boolean} [ThemeGraph.prototype.graphSizeFixed=false]
  38960. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  38961. */
  38962. this.graphSizeFixed = false;
  38963. /**
  38964. * @member {ThemeGraphText} ThemeGraph.prototype.graphText
  38965. * @description 统计图上的文字是否可见以及文字标注风格。
  38966. */
  38967. this.graphText = new ThemeGraphText();
  38968. /**
  38969. * @member {ThemeGraphType} [ThemeGraph.prototype.graphType=ThemeGraphType.AREA]
  38970. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  38971. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  38972. */
  38973. this.graphType = ThemeGraphType.AREA;
  38974. /**
  38975. * @member {GraphAxesTextDisplayMode} [ThemeGraph.prototype.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE]
  38976. * @description 统计专题图坐标轴文本显示模式。
  38977. */
  38978. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  38979. /**
  38980. * @member {Array.<ThemeGraphItem>} ThemeGraph.prototype.items
  38981. * @description 统计专题图子项集合。
  38982. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  38983. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  38984. */
  38985. this.items = null;
  38986. /**
  38987. * @member {Array.<number>} ThemeGraph.prototype.memoryKeys
  38988. * @description 以内存数组方式制作专题图时的键数组。
  38989. * 键数组内的数值代表 SmID 值,它与 {@link ThemeGraphItem} 类中的值数组({@link ThemeGraphItem#memoryDoubleValues})要关联起来应用。
  38990. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  38991. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  38992. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  38993. * @example
  38994. * memoryKeys 的使用方法如下:
  38995. * function addThemeGraph() {
  38996. * removeTheme();
  38997. * //创建统计专题图对象,ThemeGraph 必设 items。
  38998. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  38999. * var style1 = new ServerStyle({
  39000. * fillForeColor: new ServerColor(92,73,234),
  39001. * lineWidth: 0.1
  39002. * }),
  39003. * style2 = new ServerStyle({
  39004. * fillForeColor: new ServerColor(211,111,240),
  39005. * lineWidth: 0.1
  39006. * }),
  39007. * item1 = new ThemeGraphItem({
  39008. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  39009. * caption: "1992-1995人口增长率",
  39010. * graphExpression: "Pop_Rate95",
  39011. * uniformStyle: style1
  39012. * }),
  39013. * item2 = new ThemeGraphItem({
  39014. * //以内存数组方式制作专题图时的值数组
  39015. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  39016. * caption: "1995-1999人口增长率", //专题图子项的名称
  39017. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  39018. * uniformStyle: style2 //统计专题图子项的显示风格
  39019. * }),
  39020. * themeGraph = new ThemeGraph({
  39021. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  39022. * memoryKeys:[1,2,4,8,10,12],
  39023. * items: new Array(item1,item2),
  39024. * barWidth: 0.03,
  39025. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  39026. * graduatedMode: GraduatedMode.SQUAREROOT,
  39027. * //graphAxes用于设置统计图中坐标轴样式相关信息
  39028. * graphAxes: new ThemeGraphAxes({
  39029. * axesDisplayed: true
  39030. * }),
  39031. * graphSize: new ThemeGraphSize({
  39032. * maxGraphSize: 1,
  39033. * minGraphSize: 0.35
  39034. * }),
  39035. * //统计图上的文字是否可见以及文字标注风格
  39036. * graphText: new ThemeGraphText({
  39037. * graphTextDisplayed: true,
  39038. * graphTextFormat: ThemeGraphTextFormat.VALUE,
  39039. * graphTextStyle: new ServerTextStyle({
  39040. * sizeFixed: true,
  39041. * fontHeight: 9,
  39042. * fontWidth: 5
  39043. * })
  39044. * }),
  39045. * //统计专题图类型为三维柱状图
  39046. * graphType: ThemeGraphType.BAR3D
  39047. * }),
  39048. * //专题图参数对象
  39049. * themeParameters = new ThemeParameters({
  39050. * themes: [themeGraph],
  39051. * dataSourceNames: ["Jingjin"],
  39052. * datasetNames: ["BaseMap_R"]
  39053. * }),
  39054. * //与服务端交互
  39055. * themeService=new ThemeService(url, {
  39056. * eventListeners: {
  39057. * "processCompleted": ThemeCompleted,
  39058. * "processFailed": themeFailed
  39059. * }
  39060. * });
  39061. * themeService.processAsync(themeParameters);
  39062. * }
  39063. */
  39064. this.memoryKeys = null;
  39065. /**
  39066. * @member {boolean} [ThemeGraph.prototype.negativeDisplayed=false]
  39067. * @description 专题图中是否显示属性为负值的数据。true 表示显示;false 不显示。
  39068. */
  39069. this.negativeDisplayed = false;
  39070. /**
  39071. * @member {ThemeOffset} ThemeGraph.prototype.offset
  39072. * @description 用于设置统计图相对于要素内点的偏移量。
  39073. */
  39074. this.offset = new ThemeOffset();
  39075. /**
  39076. * @member {boolean} ThemeGraph.prototype.overlapAvoided
  39077. * @description 统计图是否采用避让方式显示。<br>
  39078. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  39079. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  39080. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  39081. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  39082. */
  39083. this.overlapAvoided = true;
  39084. /**
  39085. * @member {number} [ThemeGraph.prototype.roseAngle=0]
  39086. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  39087. */
  39088. this.roseAngle = 0;
  39089. /**
  39090. * @member {number} [ThemeGraph.prototype.startAngle=0]
  39091. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  39092. */
  39093. this.startAngle = 0;
  39094. if (options) {
  39095. Util_Util.extend(this, options);
  39096. }
  39097. this.CLASS_NAME = "SuperMap.ThemeGraph";
  39098. }
  39099. /**
  39100. * @function ThemeGraph.prototype.destroy
  39101. * @override
  39102. */
  39103. destroy() {
  39104. super.destroy();
  39105. var me = this;
  39106. me.barWidth = null;
  39107. me.graduatedMode = null;
  39108. if (me.graphAxes) {
  39109. me.graphAxes.destroy();
  39110. me.graphAxes = null;
  39111. }
  39112. if (me.graphSize) {
  39113. me.graphSize.destroy();
  39114. me.graphSize = null;
  39115. }
  39116. me.graphSizeFixed = null;
  39117. if (me.graphText) {
  39118. me.graphText.destroy();
  39119. me.graphText = null;
  39120. }
  39121. me.graphType = null;
  39122. if (me.items) {
  39123. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  39124. items[i].destroy();
  39125. }
  39126. me.items = null;
  39127. }
  39128. me.memoryKeys = null;
  39129. me.negativeDisplayed = null;
  39130. if (me.offset) {
  39131. me.offset.destroy();
  39132. me.offset = null;
  39133. }
  39134. me.overlapAvoided = null;
  39135. me.roseAngle = null;
  39136. me.startAngle = null;
  39137. me.graphAxesTextDisplayMode = null;
  39138. }
  39139. /**
  39140. * @function ThemeGraph.prototype.toJSON
  39141. * @description 将 ThemeGraph 对象转化为 JSON 字符串。
  39142. * @returns {string} 返回转换后的 JSON 字符串。
  39143. */
  39144. toJSON() {
  39145. return Util_Util.toJSON(this.toServerJSONObject());
  39146. }
  39147. /**
  39148. * @function ThemeGraph.prototype.toServerJSONObject
  39149. * @description 转换成对应的 JSON 格式对象。
  39150. * @returns {Object} 对应的 JSON 格式对象。
  39151. */
  39152. toServerJSONObject() {
  39153. var obj = {};
  39154. obj.type = this.type;
  39155. if (this.graphText) {
  39156. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  39157. obj.graphTextFormat = this.graphText.graphTextFormat;
  39158. obj.graphTextStyle = this.graphText.graphTextStyle;
  39159. }
  39160. if (this.graphAxes) {
  39161. obj.axesColor = this.graphAxes.axesColor;
  39162. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  39163. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  39164. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  39165. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  39166. }
  39167. if (this.graphSize) {
  39168. obj.maxGraphSize = this.graphSize.maxGraphSize;
  39169. obj.minGraphSize = this.graphSize.minGraphSize;
  39170. }
  39171. if (this.offset) {
  39172. obj.offsetFixed = this.offset.offsetFixed;
  39173. obj.offsetX = this.offset.offsetX;
  39174. obj.offsetY = this.offset.offsetY;
  39175. }
  39176. obj.barWidth = this.barWidth;
  39177. obj.graduatedMode = this.graduatedMode;
  39178. obj.graphSizeFixed = this.graphSizeFixed;
  39179. obj.graphType = this.graphType;
  39180. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  39181. obj.items = this.items;
  39182. obj.memoryKeys = this.memoryKeys;
  39183. obj.negativeDisplayed = this.negativeDisplayed;
  39184. obj.overlapAvoided = this.overlapAvoided;
  39185. obj.roseAngle = this.roseAngle;
  39186. obj.startAngle = this.startAngle;
  39187. return obj;
  39188. }
  39189. /**
  39190. * @function ThemeGraph.fromObj
  39191. * @description 从传入对象获取统计专题图类。
  39192. * @param {Object} obj - 传入对象。
  39193. * @returns {ThemeGraph} ThemeGraph 对象。
  39194. */
  39195. static fromObj(obj) {
  39196. var res = new ThemeGraph();
  39197. var itemsG = obj.items;
  39198. var len = itemsG ? itemsG.length : 0;
  39199. Util_Util.copy(res, obj);
  39200. res.items = [];
  39201. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  39202. res.graphSize = ThemeGraphSize.fromObj(obj);
  39203. res.graphText = ThemeGraphText.fromObj(obj);
  39204. res.offset = ThemeOffset.fromObj(obj);
  39205. for (var i = 0; i < len; i++) {
  39206. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  39207. }
  39208. return res;
  39209. }
  39210. }
  39211. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  39212. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39213. * This program are made available under the terms of the Apache License, Version 2.0
  39214. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39215. /**
  39216. * @class ThemeDotDensity
  39217. * @deprecatedclass SuperMap.ThemeDotDensity
  39218. * @category iServer Map Theme
  39219. * @classdesc 点密度专题图。点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  39220. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  39221. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  39222. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  39223. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  39224. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  39225. * @extends {CommonTheme}
  39226. * @param {Object} options - 参数。
  39227. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  39228. * @param {ServerStyle} [options.style] - 点密度专题图中点的风格。
  39229. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  39230. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  39231. * @usage
  39232. */
  39233. class ThemeDotDensity extends Theme {
  39234. constructor(options) {
  39235. super("DOTDENSITY", options);
  39236. /**
  39237. * @member {string} ThemeDotDensity.prototype.dotExpression
  39238. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  39239. */
  39240. this.dotExpression = null;
  39241. /**
  39242. * @member {ServerStyle} ThemeDotDensity.prototype.style
  39243. * @description 点密度专题图中点的风格。
  39244. */
  39245. this.style = new ServerStyle();
  39246. /**
  39247. * @member {number} ThemeDotDensity.prototype.value
  39248. * @description 专题图中每一个点所代表的数值。<br>
  39249. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  39250. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  39251. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  39252. */
  39253. this.value = null;
  39254. if (options) {
  39255. Util_Util.extend(this, options);
  39256. }
  39257. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  39258. }
  39259. /**
  39260. * @function ThemeDotDensity.prototype.destroy
  39261. * @description 释放资源,将引用资源的属性置空。
  39262. */
  39263. destroy() {
  39264. var me = this;
  39265. me.dotExpression = null;
  39266. me.value = null;
  39267. if (me.style) {
  39268. me.style.destroy();
  39269. me.style = null;
  39270. }
  39271. }
  39272. /**
  39273. * @function ThemeDotDensity.prototype.toServerJSONObject
  39274. * @description 转换成对应的 JSON 格式对象。
  39275. * @returns {Object} 对应的 JSON 格式对象。
  39276. */
  39277. toServerJSONObject() {
  39278. var obj = {};
  39279. obj = Util_Util.copyAttributes(obj, this);
  39280. if (obj.style) {
  39281. if (obj.style.toServerJSONObject) {
  39282. obj.style = obj.style.toServerJSONObject();
  39283. }
  39284. }
  39285. return obj;
  39286. }
  39287. /**
  39288. * @function ThemeDotDensity.fromObj
  39289. * @description 从传入对象获取点密度专题图中点的风格。
  39290. * @param {Object} obj - 传入对象。
  39291. * @returns {ThemeDotDensity} ThemeDotDensity 对象。
  39292. */
  39293. static fromObj(obj) {
  39294. if (!obj) {
  39295. return;
  39296. }
  39297. var res = new ThemeDotDensity();
  39298. Util_Util.copy(res, obj);
  39299. res.style = ServerStyle.fromJson(obj.style);
  39300. return res;
  39301. }
  39302. }
  39303. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  39304. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39305. * This program are made available under the terms of the Apache License, Version 2.0
  39306. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39307. /**
  39308. * @class ThemeGraduatedSymbolStyle
  39309. * @deprecatedclass SuperMap.ThemeGraduatedSymbolStyle
  39310. * @category iServer Map Theme
  39311. * @classdesc 等级符号专题图正负零值显示风格类。
  39312. * @param {Object} options - 参数。
  39313. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  39314. * @param {ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  39315. * @param {ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  39316. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  39317. * @param {ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  39318. * @usage
  39319. */
  39320. class ThemeGraduatedSymbolStyle {
  39321. constructor(options) {
  39322. /**
  39323. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  39324. * @description 是否显示负值。
  39325. */
  39326. this.negativeDisplayed = false;
  39327. /**
  39328. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  39329. * @description 负值的等级符号风格。
  39330. */
  39331. this.negativeStyle = new ServerStyle();
  39332. /**
  39333. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  39334. * @description 正值的等级符号风格。
  39335. */
  39336. this.positiveStyle = new ServerStyle();
  39337. /**
  39338. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  39339. * @description 是否显示 0 值。
  39340. */
  39341. this.zeroDisplayed = false;
  39342. /**
  39343. * @member {ServerStyle} ThemeGraduatedSymbolStyle.prototype.zeroStyle
  39344. * @description 0 值的等级符号风格。
  39345. */
  39346. this.zeroStyle = new ServerStyle();
  39347. if (options) {
  39348. Util_Util.extend(this, options);
  39349. }
  39350. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  39351. }
  39352. /**
  39353. * @function ThemeGraduatedSymbolStyle.prototype.destroy
  39354. * @description 释放资源,将引用资源的属性置空。
  39355. */
  39356. destroy() {
  39357. var me = this;
  39358. me.negativeDisplayed = null;
  39359. me.negativeStyle = null;
  39360. me.positiveStyle = null;
  39361. me.zeroDisplayed = null;
  39362. me.zeroStyle = null;
  39363. }
  39364. /**
  39365. * @function ThemeGraduatedSymbolStyle.fromObj
  39366. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  39367. * @param {Object} obj - 传入对象。
  39368. * @returns {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  39369. */
  39370. static fromObj(obj) {
  39371. if (!obj) {
  39372. return;
  39373. }
  39374. var res = new ThemeGraduatedSymbolStyle();
  39375. Util_Util.copy(res, obj);
  39376. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  39377. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  39378. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  39379. return res;
  39380. }
  39381. }
  39382. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  39383. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39384. * This program are made available under the terms of the Apache License, Version 2.0
  39385. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39386. /**
  39387. * @class ThemeGraduatedSymbol
  39388. * @deprecatedclass SuperMap.ThemeGraduatedSymbol
  39389. * @category iServer Map Theme
  39390. * @classdesc 等级符号专题图。
  39391. * @extends {CommonTheme}
  39392. * @param {Object} options - 参数。
  39393. * @param {ThemeGraduatedSymbolStyle} options.style - 等级符号专题图正负零值显示风格类。
  39394. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  39395. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  39396. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  39397. * @param {ThemeOffset} [options.offset] - 指定等级符号专题图中标记文本相对于要素内点的偏移量对象。
  39398. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  39399. * @usage
  39400. */
  39401. class ThemeGraduatedSymbol extends Theme {
  39402. constructor(options) {
  39403. super("GRADUATEDSYMBOL", options);
  39404. /**
  39405. * @member {number} [ThemeGraduatedSymbol.prototype.baseValue=0]
  39406. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  39407. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  39408. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  39409. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  39410. */
  39411. this.baseValue = 0;
  39412. /**
  39413. * @member {string} ThemeGraduatedSymbol.prototype.expression
  39414. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  39415. */
  39416. this.expression = null;
  39417. /**
  39418. * @member {GraduatedMode} [ThemeGraduatedSymbol.prototype.graduatedMode=GraduatedMode.CONSTANT]
  39419. * @description 等级符号专题图分级模式。<br>
  39420. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  39421. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  39422. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  39423. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  39424. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  39425. */
  39426. this.graduatedMode = GraduatedMode.CONSTAN;
  39427. /**
  39428. * @member {ThemeOffset} [ThemeGraduatedSymbol.prototype.offset]
  39429. * @description 用于设置等级符号图相对于要素内点的偏移量。
  39430. */
  39431. this.offset = new ThemeOffset();
  39432. /**
  39433. * @member {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbol.prototype.style
  39434. * @description 用于设置等级符号图正负和零值显示风格。
  39435. */
  39436. this.style = new ThemeGraduatedSymbolStyle();
  39437. if (options) {
  39438. Util_Util.extend(this, options);
  39439. }
  39440. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  39441. }
  39442. /**
  39443. * @function ThemeGraduatedSymbol.prototype.destroy
  39444. * @description 释放资源,将引用资源的属性置空。
  39445. */
  39446. destroy() {
  39447. super.destroy();
  39448. var me = this;
  39449. me.expression = null;
  39450. me.graduatedMode = GraduatedMode.CONSTANT;
  39451. if (me.offset) {
  39452. me.offset.destroy();
  39453. me.offset = null;
  39454. }
  39455. if (me.style) {
  39456. me.style.destroy();
  39457. me.style = null;
  39458. }
  39459. }
  39460. /**
  39461. * @function ThemeGraduatedSymbol.prototype.toJSON
  39462. * @description 将 themeLabel 对象转化为 JSON 字符串。
  39463. * @returns {string} 返回转换后的 JSON 字符串。
  39464. */
  39465. toJSON() {
  39466. return Util_Util.toJSON(this.toServerJSONObject());
  39467. }
  39468. /**
  39469. * @function ThemeGraduatedSymbol.prototype.toServerJSONObject
  39470. * @description 转换成对应的 JSON 格式对象。
  39471. * @returns {Object} 对应的 JSON 格式对象。
  39472. */
  39473. toServerJSONObject() {
  39474. var obj = {};
  39475. obj.type = this.type;
  39476. obj.memoryData = this.memoryData;
  39477. obj.baseValue = this.baseValue;
  39478. obj.expression = this.expression;
  39479. obj.graduatedMode = this.graduatedMode;
  39480. if (this.offset) {
  39481. obj.offsetFixed = this.offset.offsetFixed;
  39482. obj.offsetX = this.offset.offsetX;
  39483. obj.offsetY = this.offset.offsetY;
  39484. }
  39485. if (this.style) {
  39486. obj.negativeStyle = this.style.negativeStyle;
  39487. obj.negativeDisplayed = this.style.negativeDisplayed;
  39488. obj.positiveStyle = this.style.positiveStyle;
  39489. obj.zeroDisplayed = this.style.zeroDisplayed;
  39490. obj.zeroStyle = this.style.zeroStyle;
  39491. }
  39492. return obj;
  39493. }
  39494. /**
  39495. * @function ThemeGraduatedSymbol.fromObj
  39496. * @description 从传入对象获取等级符号专题图。
  39497. * @param {Object} obj - 传入对象。
  39498. * @returns {ThemeGraduatedSymbol} 等级符号专题图对象。
  39499. */
  39500. static fromObj(obj) {
  39501. if (!obj) {
  39502. return;
  39503. }
  39504. var res = new ThemeGraduatedSymbol();
  39505. Util_Util.copy(res, obj);
  39506. res.offset = ThemeOffset.fromObj(obj);
  39507. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  39508. return res;
  39509. }
  39510. }
  39511. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  39512. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39513. * This program are made available under the terms of the Apache License, Version 2.0
  39514. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39515. /**
  39516. * @class ThemeRangeItem
  39517. * @deprecatedclass SuperMap.ThemeRangeItem
  39518. * @category iServer Map Theme
  39519. * @classdesc 范围分段专题图子项类。在分段专题图中,字段值按照某种分段模式被分成多个范围段,
  39520. * 每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  39521. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  39522. * @param {Object} options - 参数。
  39523. * @param {string} [options.caption] - 子项的标题。
  39524. * @param {number} [options.end=0] - 子项的终止值。
  39525. * @param {number} [options.start=0] - 子项的起始值。
  39526. * @param {ServerStyle} options.style - 子项的风格。
  39527. * @param {boolean} [options.visible=true] - 子项是否可见。
  39528. * @usage
  39529. */
  39530. class ThemeRangeItem {
  39531. constructor(options) {
  39532. /**
  39533. * @member {string} [ThemeRangeItem.prototype.caption]
  39534. * @description 分段专题图子项的标题。
  39535. */
  39536. this.caption = null;
  39537. /**
  39538. * @member {number} [ThemeRangeItem.prototype.end=0]
  39539. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  39540. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  39541. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  39542. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  39543. */
  39544. this.end = 0;
  39545. /**
  39546. * @member {number} [ThemeRangeItem.prototype.start=0]
  39547. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  39548. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  39549. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  39550. */
  39551. this.start = 0;
  39552. /**
  39553. * @member {ServerStyle} ThemeRangeItem.prototype.style
  39554. * @description 分段专题图子项的风格。
  39555. * 每一个分段专题图子项都对应一种显示风格。
  39556. */
  39557. this.style = new ServerStyle();
  39558. /**
  39559. * @member {boolean} [ThemeRangeItem.prototype.visible=true]
  39560. * @description 分段专题图子项是否可见。
  39561. */
  39562. this.visible = true;
  39563. if (options) {
  39564. Util_Util.extend(this, options);
  39565. }
  39566. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  39567. }
  39568. /**
  39569. * @function ThemeRangeItem.prototype.destroy
  39570. * @description 释放资源,将引用资源的属性置空。
  39571. */
  39572. destroy() {
  39573. var me = this;
  39574. me.caption = null;
  39575. me.end = null;
  39576. me.start = null;
  39577. if (me.style) {
  39578. me.style.destroy();
  39579. me.style = null;
  39580. }
  39581. me.visible = null;
  39582. }
  39583. /**
  39584. * @function ThemeRangeItem.prototypetoServerJSONObject
  39585. * @description 转换成对应的 JSON 格式对象。
  39586. * @returns {Object} 对应的 JSON 格式对象。
  39587. */
  39588. toServerJSONObject() {
  39589. var obj = {};
  39590. obj = Util_Util.copyAttributes(obj, this);
  39591. if (obj.style) {
  39592. if (obj.style.toServerJSONObject) {
  39593. obj.style = obj.style.toServerJSONObject();
  39594. }
  39595. }
  39596. return obj;
  39597. }
  39598. /**
  39599. * @function ThemeRangeItem.fromObj
  39600. * @description 从传入对象获取范围分段专题图子项类。
  39601. * @param {Object} obj - 传入对象。
  39602. * @returns {ThemeRangeItem} ThemeRangeItem 对象。
  39603. */
  39604. static fromObj(obj) {
  39605. if (!obj) {
  39606. return;
  39607. }
  39608. var res = new ThemeRangeItem();
  39609. Util_Util.copy(res, obj);
  39610. res.style = ServerStyle.fromJson(obj.style);
  39611. return res;
  39612. }
  39613. }
  39614. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  39615. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39616. * This program are made available under the terms of the Apache License, Version 2.0
  39617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39618. /**
  39619. * @class ThemeRange
  39620. * @deprecatedclass SuperMap.ThemeRange
  39621. * @category iServer Map Theme
  39622. * @classdesc 范围分段专题图。
  39623. * 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  39624. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  39625. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  39626. * @extends {CommonTheme}
  39627. * @param {Object} options - 参数。
  39628. * @param {Array.<ThemeRangeItem>} options.items - 子项数组。
  39629. * @param {string} options.rangeExpression - 分段字段表达式。
  39630. * @param {number} options.rangeParameter - 分段参数。
  39631. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段模式。
  39632. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  39633. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  39634. * @usage
  39635. */
  39636. class ThemeRange extends Theme {
  39637. constructor(options) {
  39638. super("RANGE", options);
  39639. /**
  39640. * @member {string} ThemeRange.prototype.precision
  39641. * @description 精准度。
  39642. */
  39643. this.precision = '1.0E-12';
  39644. /**
  39645. * @member {Array.<ThemeRangeItem>} ThemeRange.prototype.items
  39646. * @description 分段专题图子项数组。<br>
  39647. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  39648. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  39649. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  39650. */
  39651. this.items = null;
  39652. /**
  39653. * @member {string} ThemeRange.prototype.rangeExpression
  39654. * @description 分段字段表达式。<br>
  39655. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  39656. */
  39657. this.rangeExpression = null;
  39658. /**
  39659. * @member {RangeMode} [ThemeRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  39660. * @description 分段专题图的分段模式。<br>
  39661. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  39662. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  39663. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  39664. */
  39665. this.rangeMode = RangeMode.EQUALINTERVAL;
  39666. /**
  39667. * @member {number} ThemeRange.prototype.rangeParameter
  39668. * @description 分段参数。
  39669. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  39670. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  39671. */
  39672. this.rangeParameter = 0;
  39673. /**
  39674. * @member {ColorGradientType} [ThemeRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  39675. * @description 渐变颜色枚举类。<br>
  39676. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  39677. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。但如果为某几个子项的风格进行单独设置后(设置了 {@link ThemeUniqueItem} 或 {@link ThemeRangeItem} 类中Style属性),
  39678. * 该配色方案对于这几个子项将不起作用。
  39679. */
  39680. this.colorGradientType = ColorGradientType.YELLOW_RED;
  39681. if (options) {
  39682. Util_Util.extend(this, options);
  39683. }
  39684. this.CLASS_NAME = "SuperMap.ThemeRange";
  39685. }
  39686. /**
  39687. * @function ThemeRange.prototype.destroy
  39688. * @override
  39689. */
  39690. destroy() {
  39691. super.destroy();
  39692. var me = this;
  39693. if (me.items) {
  39694. if (me.items.length > 0) {
  39695. for (var item in me.items) {
  39696. me.items[item].destroy();
  39697. me.items[item] = null;
  39698. }
  39699. }
  39700. me.items = null;
  39701. }
  39702. me.rangeExpression = null;
  39703. me.rangeMode = null;
  39704. me.rangeParameter = null;
  39705. me.colorGradientType = null;
  39706. }
  39707. /**
  39708. * @function ThemeRange.fromObj
  39709. * @description 从传入对象获取范围分段专题图类。
  39710. * @param {Object} obj - 传入对象。
  39711. * @returns {ThemeRange} ThemeRange 对象。
  39712. */
  39713. static fromObj(obj) {
  39714. if (!obj) {
  39715. return;
  39716. }
  39717. var res = new ThemeRange();
  39718. Util_Util.copy(res, obj);
  39719. var itemsR = obj.items;
  39720. var len = itemsR ? itemsR.length : 0;
  39721. res.items = [];
  39722. for (var i = 0; i < len; i++) {
  39723. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  39724. }
  39725. return res;
  39726. }
  39727. }
  39728. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  39729. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39730. * This program are made available under the terms of the Apache License, Version 2.0
  39731. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39732. /**
  39733. * @class UGCLayer
  39734. * @deprecatedclass SuperMap.UGCLayer
  39735. * @category iServer Map Layer
  39736. * @classdesc SuperMap 图层类。
  39737. * @param {Object} options - 参数。
  39738. * @param {Bounds} options.bounds - 图层范围。
  39739. * @param {string} options.name - 图层的名称。
  39740. * @param {UGCLayerType} options.type - 图层类型。
  39741. * @param {string} [options.caption] - 图层的标题。
  39742. * @param {string} [options.description] - 图层的描述信息。
  39743. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  39744. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  39745. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  39746. * @usage
  39747. */
  39748. class UGCLayer {
  39749. constructor(options) {
  39750. options = options || {};
  39751. /**
  39752. * @member {Bounds} UGCLayer.prototype.bounds
  39753. * @description 图层范围。
  39754. */
  39755. this.bounds = null;
  39756. /**
  39757. * @member {string} [UGCLayer.prototype.caption]
  39758. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  39759. */
  39760. this.caption = null;
  39761. /**
  39762. * @member {string} UGCLayer.prototype.description
  39763. * @description 图层的描述信息。
  39764. */
  39765. this.description = null;
  39766. /**
  39767. * @member {string} UGCLayer.prototype.name
  39768. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  39769. */
  39770. this.name = null;
  39771. /**
  39772. * @member {boolean} UGCLayer.prototype.queryable
  39773. * @description 图层中的对象是否可以查询。
  39774. */
  39775. this.queryable = null;
  39776. /**
  39777. * @member {Array} UGCLayer.prototype.subLayers
  39778. * @description 子图层集。
  39779. */
  39780. this.subLayers = null;
  39781. /**
  39782. * @member {UGCLayerType} UGCLayer.prototype.type
  39783. * @description 图层类型。
  39784. */
  39785. this.type = null;
  39786. /**
  39787. * @member {boolean} UGCLayer.prototype.visible
  39788. * @description 地图对象在同一范围内时,是否重叠显示。
  39789. */
  39790. this.visible = null;
  39791. Util_Util.extend(this, options);
  39792. this.CLASS_NAME = "SuperMap.UGCLayer";
  39793. }
  39794. /**
  39795. * @function UGCLayer.prototype.destroy
  39796. * @description 释放资源,将引用资源的属性置空。
  39797. */
  39798. destroy() {
  39799. var me = this;
  39800. Util_Util.reset(me);
  39801. }
  39802. /**
  39803. * @function UGCLayer.prototype.fromJson
  39804. * @description 将服务端 JSON 对象转换成当前客户端对象。
  39805. * @param {Object} jsonObject - 要转换的 JSON 对象。
  39806. */
  39807. fromJson(jsonObject) {
  39808. jsonObject = jsonObject ? jsonObject : {};
  39809. Util_Util.extend(this, jsonObject);
  39810. var b = this.bounds;
  39811. if (b) {
  39812. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  39813. }
  39814. }
  39815. /**
  39816. * @function UGCLayer.prototype.toServerJSONObject
  39817. * @description 转换成对应的 JSON 格式对象。
  39818. * @returns {Object} 对应的 JSON 格式对象。
  39819. */
  39820. toServerJSONObject() {
  39821. var jsonObject = {};
  39822. jsonObject = Util_Util.copyAttributes(jsonObject, this);
  39823. if (jsonObject.bounds) {
  39824. if (jsonObject.bounds.toServerJSONObject) {
  39825. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  39826. }
  39827. }
  39828. return jsonObject;
  39829. }
  39830. }
  39831. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  39832. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39833. * This program are made available under the terms of the Apache License, Version 2.0
  39834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39835. /**
  39836. * @class UGCMapLayer
  39837. * @deprecatedclass SuperMap.UGCMapLayer
  39838. * @category iServer Map Layer
  39839. * @classdesc SuperMap 地图图层类。
  39840. * @extends {UGCLayer}
  39841. * @param {Object} options - 可选参数。
  39842. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  39843. * @param {number} [options.maxScale] - 地图最大比例尺。
  39844. * @param {number} [options.minScale] - 地图最小比例尺。
  39845. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  39846. * @param {number} [options.opaqueRate] - 图层的不透明度。
  39847. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  39848. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  39849. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  39850. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  39851. * @usage
  39852. */
  39853. class UGCMapLayer extends UGCLayer {
  39854. constructor(options) {
  39855. options = options || {};
  39856. super(options);
  39857. /**
  39858. * @member {boolean} UGCMapLayer.prototype.completeLineSymbolDisplayed
  39859. * @description 是否显示完整线型。
  39860. */
  39861. this.completeLineSymbolDisplayed = null;
  39862. /**
  39863. * @member {number} UGCMapLayer.prototype.maxScale
  39864. * @description 地图最大比例尺。
  39865. */
  39866. this.maxScale = null;
  39867. /**
  39868. * @member {number} UGCMapLayer.prototype.minScale
  39869. * @description 地图最小比例尺。
  39870. */
  39871. this.minScale = null;
  39872. /**
  39873. * @member {number} UGCMapLayer.prototype.minVisibleGeometrySize
  39874. * @description 几何对象的最小可见大小,以像素为单位。
  39875. */
  39876. this.minVisibleGeometrySize = null;
  39877. /**
  39878. * @member {number} UGCMapLayer.prototype.opaqueRate
  39879. * @description 图层的不透明度。
  39880. */
  39881. this.opaqueRate = null;
  39882. /**
  39883. * @member {boolean} UGCMapLayer.prototype.symbolScalable
  39884. * @description 是否允许图层的符号大小随图缩放。
  39885. */
  39886. this.symbolScalable = null;
  39887. /**
  39888. * @member {number} UGCMapLayer.prototype.symbolScale
  39889. * @description 图层的符号缩放基准比例尺。
  39890. */
  39891. this.symbolScale = null;
  39892. /**
  39893. * @member {boolean} [UGCMapLayer.prototype.overlapDisplayed=false]
  39894. * @description 地图对象在同一范围内时,是否重叠显示。
  39895. */
  39896. this.overlapDisplayed = null;
  39897. /**
  39898. * @member {OverlapDisplayedOptions} UGCMapLayer.prototype.overlapDisplayedOptions
  39899. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  39900. */
  39901. this.overlapDisplayedOptions = null;
  39902. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  39903. }
  39904. /**
  39905. * @function UGCMapLayer.prototype.destroy
  39906. * @override
  39907. */
  39908. destroy() {
  39909. super.destroy();
  39910. Util_Util.reset(this);
  39911. }
  39912. /**
  39913. * @function UGCMapLayer.prototype.fromJson
  39914. * @description 将服务端 JSON 对象转换成当前客户端对象。
  39915. * @param {Object} jsonObject - 要转换的 JSON 对象。
  39916. */
  39917. fromJson(jsonObject) {
  39918. super.fromJson(jsonObject);
  39919. }
  39920. /**
  39921. * @function UGCMapLayer.prototype.toServerJSONObject
  39922. * @description 转换成对应的 JSON 格式对象。
  39923. * @returns {Object} 对应的 JSON 格式对象。
  39924. */
  39925. toServerJSONObject() {
  39926. return super.toServerJSONObject();
  39927. }
  39928. }
  39929. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  39930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39931. * This program are made available under the terms of the Apache License, Version 2.0
  39932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39933. /**
  39934. * @class JoinItem
  39935. * @deprecatedclass SuperMap.JoinItem
  39936. * @category iServer Data FeatureResults
  39937. * @classdesc 连接信息类。
  39938. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  39939. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  39940. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  39941. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  39942. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  39943. *(注意:JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  39944. * @param {Object} options - 参数。
  39945. * @param {string} options.foreignTableName - 外部表的名称。
  39946. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  39947. * @param {JoinType} options.joinType - 两个表之间连接类型。
  39948. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  39949. *(start code)
  39950. * function queryBySQL() {
  39951. * // 设置与外部表的连接信息
  39952. * var joinItem = new JoinItem({
  39953. * foreignTableName: "foreignTable",
  39954. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  39955. * joinType: "LEFTJOIN"
  39956. * })
  39957. * var queryParam, queryBySQLParams, queryBySQLService;
  39958. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  39959. * queryParam = new FilterParameter({
  39960. * name: "Countries@World",
  39961. * joinItems: [joinItem]
  39962. * }),
  39963. * queryBySQLParams = new QueryBySQLParameters({
  39964. * queryParams: [queryParam]
  39965. * }),
  39966. * queryBySQLService = new QueryBySQLService(url, {
  39967. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  39968. * });
  39969. * queryBySQLService.processAsync(queryBySQLParams);
  39970. * }
  39971. * function processCompleted(queryEventArgs) {//todo}
  39972. * function processFailed(e) {//todo}
  39973. * (end)
  39974. * @usage
  39975. */
  39976. class JoinItem {
  39977. constructor(options) {
  39978. /**
  39979. * @member {string} JoinItem.prototype.foreignTableName
  39980. * @description 外部表的名称。
  39981. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  39982. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  39983. */
  39984. this.foreignTableName = null;
  39985. /**
  39986. * @member {string} JoinItem.prototype.joinFilter
  39987. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  39988. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  39989. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  39990. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  39991. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  39992. */
  39993. this.joinFilter = null;
  39994. /**
  39995. * @member {JoinType} JoinItem.prototype.joinType
  39996. * @description 两个表之间连接类型。
  39997. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  39998. */
  39999. this.joinType = null;
  40000. if (options) {
  40001. Util_Util.extend(this, options);
  40002. }
  40003. this.CLASS_NAME = "SuperMap.JoinItem";
  40004. }
  40005. /**
  40006. * @function JoinItem.prototype.destroy
  40007. * @description 释放资源,将引用资源的属性置空。
  40008. */
  40009. destroy() {
  40010. var me = this;
  40011. me.foreignTableName = null;
  40012. me.joinFilter = null;
  40013. me.joinType = null;
  40014. }
  40015. /**
  40016. * @function JoinItem.prototype.toServerJSONObject
  40017. * @description 转换成对应的 JSON 格式对象。
  40018. */
  40019. toServerJSONObject() {
  40020. var dataObj = {};
  40021. dataObj = Util_Util.copyAttributes(dataObj, this);
  40022. //joinFilter基本是个纯属性对象,这里不再做转换
  40023. return dataObj;
  40024. }
  40025. }
  40026. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  40027. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40028. * This program are made available under the terms of the Apache License, Version 2.0
  40029. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40030. /**
  40031. * @class UGCSubLayer
  40032. * @deprecatedclass SuperMap.UGCSubLayer
  40033. * @category iServer Map Layer
  40034. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  40035. * @extends {UGCMapLayer}
  40036. * @param {Object} options - 参数。
  40037. * @param {DatasetInfo} options.datasetInfo - 数据集信息。
  40038. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  40039. * @param {JoinItem} [options.joinItems] - 连接信息类。
  40040. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  40041. * @param {LayerType} [options.ugcLayerType] - 图层类型。
  40042. * @usage
  40043. */
  40044. class UGCSubLayer extends UGCMapLayer {
  40045. constructor(options) {
  40046. options = options || {};
  40047. super(options);
  40048. /**
  40049. * @member {DatasetInfo} UGCSubLayer.prototype.datasetInfo
  40050. * @description 数据集信息。
  40051. */
  40052. this.datasetInfo = null;
  40053. /**
  40054. * @member {string} UGCSubLayer.prototype.displayFilter
  40055. * @description 图层显示过滤条件。
  40056. */
  40057. this.displayFilter = null;
  40058. /**
  40059. * @member {JoinItem} UGCSubLayer.prototype.joinItems
  40060. * @description 连接信息类。
  40061. */
  40062. this.joinItems = null;
  40063. /**
  40064. * @member {string} UGCSubLayer.prototype.representationField
  40065. * @description 存储制图表达信息的字段。
  40066. */
  40067. this.representationField = null;
  40068. /**
  40069. * @member {LayerType} UGCSubLayer.prototype.ugcLayerType
  40070. * @description 图层类型。
  40071. */
  40072. this.ugcLayerType = null;
  40073. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  40074. }
  40075. /**
  40076. * @function UGCSubLayer.prototype.fromJson
  40077. * @description 将服务端 JSON 对象转换成当前客户端对象。
  40078. * @param {Object} jsonObject - 要转换的 JSON 对象。
  40079. */
  40080. fromJson(jsonObject) {
  40081. super.fromJson(jsonObject);
  40082. if (this.datasetInfo) {
  40083. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  40084. }
  40085. if (this.joinItems && this.joinItems.length) {
  40086. var newJoinItems = [];
  40087. for (var i = 0; i < this.joinItems.length; i++) {
  40088. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  40089. }
  40090. this.joinItems = newJoinItems;
  40091. }
  40092. }
  40093. /**
  40094. * @function UGCSubLayer.prototype.destroy
  40095. * @override
  40096. */
  40097. destroy() {
  40098. super.destroy();
  40099. Util_Util.reset(this);
  40100. }
  40101. /**
  40102. * @function UGCSubLayer.prototype.toServerJSONObject
  40103. * @description 转换成对应的 JSON 格式对象。
  40104. * @returns {Object} 对应的 JSON 格式对象。
  40105. */
  40106. toServerJSONObject() {
  40107. var jsonObject = super.toServerJSONObject();
  40108. if (jsonObject.joinItems) {
  40109. var joinItems = [];
  40110. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  40111. if (jsonObject.joinItems[i].toServerJSONObject) {
  40112. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  40113. }
  40114. }
  40115. jsonObject.joinItems = joinItems;
  40116. }
  40117. if (jsonObject.datasetInfo) {
  40118. if (jsonObject.datasetInfo.toServerJSONObject) {
  40119. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  40120. }
  40121. }
  40122. return jsonObject;
  40123. }
  40124. }
  40125. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  40126. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40127. * This program are made available under the terms of the Apache License, Version 2.0
  40128. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40129. /**
  40130. * @class ServerTheme
  40131. * @deprecatedclass SuperMap.ServerTheme
  40132. * @category iServer Map Theme
  40133. * @classdesc SuperMap 专题图图层类。
  40134. * @extends {UGCSubLayer}
  40135. * @param {CommonTheme} theme - 专题图对象。
  40136. * @param {LonLat} themeElementPosition - 专题图元素位置。
  40137. * @usage
  40138. */
  40139. class ServerTheme extends UGCSubLayer {
  40140. constructor(options) {
  40141. options = options || {};
  40142. super(options);
  40143. /**
  40144. * @member {CommonTheme} ServerTheme.prototype.theme
  40145. * @description 专题图对象。
  40146. */
  40147. this.theme = null;
  40148. /**
  40149. * @member {LonLat} ServerTheme.prototype.themeElementPosition
  40150. * @description 专题图元素位置。
  40151. */
  40152. this.themeElementPosition = null;
  40153. this.CLASS_NAME = "SuperMap.ServerTheme";
  40154. }
  40155. /**
  40156. * @function ServerTheme.prototype.destroy
  40157. * @description 释放资源,将引用资源的属性置空。
  40158. * @override
  40159. */
  40160. destroy() {
  40161. super.destroy();
  40162. Util_Util.reset(this);
  40163. }
  40164. /**
  40165. * @function ServerTheme.prototype.fromJson
  40166. * @description 将服务端 JSON 对象转换成当前客户端对象。
  40167. * @param {Object} jsonObject - 要转换的 JSON 对象。
  40168. */
  40169. fromJson(jsonObject) {
  40170. super.fromJson(jsonObject);
  40171. var themeObj = this.theme;
  40172. var themeT = themeObj && themeObj.type;
  40173. switch (themeT) {
  40174. case 'LABEL':
  40175. this.theme = ThemeLabel.fromObj(themeObj);
  40176. break;
  40177. case 'UNIQUE':
  40178. this.theme = ThemeUnique.fromObj(themeObj);
  40179. break;
  40180. case 'GRAPH':
  40181. this.theme = ThemeGraph.fromObj(themeObj);
  40182. break;
  40183. case 'DOTDENSITY':
  40184. this.theme = ThemeDotDensity.fromObj(themeObj);
  40185. break;
  40186. case 'GRADUATEDSYMBOL':
  40187. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  40188. break;
  40189. case 'RANGE':
  40190. this.theme = ThemeRange.fromObj(themeObj);
  40191. break;
  40192. default:
  40193. break;
  40194. }
  40195. if (this.themeElementPosition) {
  40196. //待测试
  40197. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  40198. }
  40199. }
  40200. /**
  40201. * @function ServerTheme.prototype.toServerJSONObject
  40202. * @description 转换成对应的 JSON 格式对象。
  40203. */
  40204. toServerJSONObject() {
  40205. //普通属性直接赋值
  40206. var jsonObject = super.toServerJSONObject();
  40207. if (jsonObject.themeElementPosition) {
  40208. if (jsonObject.themeElementPosition.toServerJSONObject) {
  40209. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  40210. }
  40211. }
  40212. if (jsonObject.theme) {
  40213. if (jsonObject.theme.toServerJSONObject) {
  40214. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  40215. }
  40216. }
  40217. return jsonObject;
  40218. }
  40219. }
  40220. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  40221. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40222. * This program are made available under the terms of the Apache License, Version 2.0
  40223. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40224. /**
  40225. * @class Grid
  40226. * @deprecatedclass SuperMap.Grid
  40227. * @category iServer Map Layer
  40228. * @classdesc SuperMap 栅格图层类。
  40229. * @extends {UGCSubLayer}
  40230. * @param {Object} options - 可选参数。
  40231. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  40232. * @param {number} [options.brightness] - Grid 图层的亮度。
  40233. * @param {ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  40234. * @param {ServerColor} [options.colors] - 颜色表对象。
  40235. * @param {number} [options.contrast] - Grid 图层的对比度。
  40236. * @param {GridType} [options.gridType] - 格网类型。
  40237. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  40238. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  40239. * @param {ServerStyle} [options.solidStyle] - 格网实线的样式。
  40240. * @param {ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  40241. * @param {number} [options.specialValue] - 图层的特殊值。
  40242. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  40243. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  40244. * @usage
  40245. */
  40246. class Grid extends UGCSubLayer {
  40247. constructor(options) {
  40248. options = options || {};
  40249. super(options);
  40250. /**
  40251. * @member {Array.<ColorDictionary>} Grid.prototype.colorDictionarys
  40252. * @description 颜色对照表对象。
  40253. */
  40254. this.colorDictionarys = null;
  40255. /**
  40256. * @member {number} Grid.prototype.brightness
  40257. * @description Grid 图层的亮度。
  40258. */
  40259. this.brightness = null;
  40260. /**
  40261. * @member {ColorGradientType} Grid.prototype.colorGradientType
  40262. * @description 渐变颜色枚举值。
  40263. */
  40264. this.colorGradientType = null;
  40265. /**
  40266. * @member {ServerColor} Grid.prototype.colors
  40267. * @description 颜色表对象。
  40268. */
  40269. this.colors = null;
  40270. /**
  40271. * @member {number} Grid.prototype.contrast
  40272. * @description Grid 图层的对比度。
  40273. */
  40274. this.contrast = null;
  40275. /**
  40276. * @member {ServerStyle} Grid.prototype.dashStyle
  40277. * @description 栅格数据集特殊值数据的颜色。
  40278. */
  40279. this.dashStyle = null;
  40280. /**
  40281. * @member {GridType} Grid.prototype.gridType
  40282. * @description 格网类型。
  40283. */
  40284. this.gridType = null;
  40285. /**
  40286. * @member {number} Grid.prototype.horizontalSpacing
  40287. * @description 格网水平间隔大小。
  40288. */
  40289. this.horizontalSpacing = null;
  40290. /**
  40291. * @member {boolean} Grid.prototype.sizeFixed
  40292. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  40293. */
  40294. this.sizeFixed = null;
  40295. /**
  40296. * @member {ServerStyle} Grid.prototype.solidStyle
  40297. * @description 格网实线的样式。
  40298. */
  40299. this.solidStyle = null;
  40300. /**
  40301. * @member {ServerColor} Grid.prototype.specialColor
  40302. * @description 栅格数据集无值数据的颜色。
  40303. */
  40304. this.specialColor = null;
  40305. /**
  40306. * @member {number} Grid.prototype.specialValue
  40307. * @description 图层的特殊值。
  40308. */
  40309. this.specialValue = null;
  40310. /**
  40311. * @member {boolean} Grid.prototype.specialValueTransparent
  40312. * @description 图层的特殊值(specialValue)所处区域是否透明。
  40313. */
  40314. this.specialValueTransparent = null;
  40315. /**
  40316. * @member {number} Grid.prototype.verticalSpacing
  40317. * @description 格网垂直间隔大小。
  40318. */
  40319. this.verticalSpacing = null;
  40320. this.CLASS_NAME = "SuperMap.Grid";
  40321. }
  40322. /**
  40323. * @function Grid.prototype.destroy
  40324. * @description 释放资源,将引用资源的属性置空。
  40325. */
  40326. destroy() {
  40327. super.destroy();
  40328. Util_Util.reset(this);
  40329. }
  40330. /**
  40331. * @function Grid.prototype.fromJson
  40332. * @description 将服务端 JSON 对象转换成当前客户端对象。
  40333. * @param {Object} jsonObject - 要转换的 JSON 对象。
  40334. */
  40335. fromJson(jsonObject) {
  40336. super.fromJson(jsonObject);
  40337. if (this.specialColor) {
  40338. this.specialColor = new ServerColor(this.specialColor.red,
  40339. this.specialColor.green,
  40340. this.specialColor.blue);
  40341. }
  40342. if (this.colors) {
  40343. var colors = [],
  40344. color;
  40345. for (var i in this.colors) {
  40346. color = this.colors[i];
  40347. colors.push(new ServerColor(color.red, color.green, color.blue));
  40348. }
  40349. this.colors = colors;
  40350. }
  40351. if (this.dashStyle) {
  40352. this.dashStyle = new ServerStyle(this.dashStyle);
  40353. }
  40354. if (this.solidStyle) {
  40355. this.solidStyle = new ServerStyle(this.solidStyle);
  40356. }
  40357. if (this.colorDictionary) {
  40358. var colorDics = [],
  40359. colorDic;
  40360. for (var key in this.colorDictionary) {
  40361. colorDic = this.colorDictionary[key];
  40362. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  40363. }
  40364. this.colorDictionarys = colorDics;
  40365. }
  40366. delete this.colorDictionary;
  40367. }
  40368. /**
  40369. * @function Grid.prototype.toServerJSONObject
  40370. * @description 转换成对应的 JSON 对象。
  40371. * @returns JSON 对象。
  40372. */
  40373. toServerJSONObject() {
  40374. var jsonObject = super.toServerJSONObject();
  40375. if (jsonObject.dashStyle) {
  40376. if (jsonObject.dashStyle.toServerJSONObject) {
  40377. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  40378. }
  40379. }
  40380. if (jsonObject.solidStyle) {
  40381. if (jsonObject.solidStyle.toServerJSONObject) {
  40382. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  40383. }
  40384. }
  40385. return jsonObject;
  40386. }
  40387. }
  40388. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  40389. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40390. * This program are made available under the terms of the Apache License, Version 2.0
  40391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40392. /**
  40393. * @class UGCImage
  40394. * @deprecatedclass SuperMap.Image
  40395. * @category iServer Map Layer
  40396. * @classdesc SuperMap 影像图层类
  40397. * @extends {UGCSubLayer}
  40398. * @param {Object} options - 可选参数。
  40399. * @param {ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  40400. * @param {number} [options.brightness] - 影像图层的亮度。
  40401. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  40402. * @param {number} [options.contrast] - 影像图层的对比度。
  40403. * @param {boolean} [options.transparent] - 是否背景透明。
  40404. * @param {ServerColor} [options.transparentColor] - 返回背景透明色。
  40405. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  40406. * @usage
  40407. * @private
  40408. */
  40409. class UGCImage extends UGCSubLayer {
  40410. constructor(options) {
  40411. options = options || {};
  40412. super(options);
  40413. /**
  40414. * @member {number} UGCImage.prototype.brightness
  40415. * @description 影像图层的亮度。
  40416. */
  40417. this.brightness = null;
  40418. /**
  40419. * @member {ColorSpaceType} UGCImage.prototype.colorSpaceType
  40420. * @description 返回影像图层的色彩显示模式。
  40421. */
  40422. this.colorSpaceType = null;
  40423. /**
  40424. * @member {number} UGCImage.prototype.contrast
  40425. * @description 影像图层的对比度。
  40426. */
  40427. this.contrast = null;
  40428. /**
  40429. * @member {Array.<number>} UGCImage.prototype.displayBandIndexes
  40430. * @description 返回当前影像图层显示的波段索引。
  40431. */
  40432. this.displayBandIndexes = null;
  40433. /**
  40434. * @member {boolean} UGCImage.prototype.transparent
  40435. * @description 是否背景透明。
  40436. */
  40437. this.transparent = null;
  40438. /**
  40439. * @member {ServerColor} UGCImage.prototype.transparentColor
  40440. * @description 返回背景透明色。
  40441. */
  40442. this.transparentColor = null;
  40443. /**
  40444. * @member {number} UGCImage.prototype.transparentColorTolerance
  40445. * @description 背景透明色容限。
  40446. */
  40447. this.transparentColorTolerance = null;
  40448. this.CLASS_NAME = "SuperMap.Image";
  40449. }
  40450. /**
  40451. * @function UGCImage.prototype.destroy
  40452. * @override
  40453. */
  40454. destroy() {
  40455. super.destroy();
  40456. Util_Util.reset(this);
  40457. }
  40458. /**
  40459. * @function UGCImage.prototype.fromJson
  40460. * @description 将服务端 JSON 对象转换成当前客户端对象。
  40461. * @param {Object} jsonObject - 要转换的 JSON 对象。
  40462. */
  40463. fromJson(jsonObject) {
  40464. super.fromJson(jsonObject);
  40465. if (this.transparentColor) {
  40466. this.transparentColor = new ServerColor(this.transparentColor.red,
  40467. this.transparentColor.green,
  40468. this.transparentColor.blue);
  40469. }
  40470. }
  40471. /**
  40472. * @function UGCImage.prototype.toServerJSONObject
  40473. * @description 转换成对应的 JSON 格式对象。
  40474. */
  40475. toServerJSONObject() {
  40476. return super.toServerJSONObject();
  40477. }
  40478. }
  40479. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  40480. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40481. * This program are made available under the terms of the Apache License, Version 2.0
  40482. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40483. /**
  40484. * @class Vector
  40485. * @deprecatedclass SuperMap.Vector
  40486. * @category iServer Map Layer
  40487. * @classdesc SuperMap 矢量图层类。
  40488. * @extends {UGCSubLayer}
  40489. * @param {Object} options - 可选参数。
  40490. * @param {ServerStyle} [options.style] - 矢量图层的风格。
  40491. * @usage
  40492. */
  40493. class Vector_Vector extends UGCSubLayer {
  40494. constructor(options) {
  40495. options = options || {};
  40496. super(options);
  40497. /**
  40498. * @member {ServerStyle} Vector.prototype.style
  40499. * @description 矢量图层的风格。
  40500. */
  40501. this.style = null;
  40502. this.CLASS_NAME = "SuperMap.Vector";
  40503. }
  40504. /**
  40505. * @function Vector.prototype.destroy
  40506. * @description 销毁对象,将其属性置空。
  40507. * @override
  40508. */
  40509. destroy() {
  40510. super.destroy();
  40511. Util_Util.reset(this);
  40512. }
  40513. /**
  40514. * @function Vector.prototype.fromJson
  40515. * @description 将服务端 JSON 对象转换成当前客户端对象。
  40516. * @param {Object} jsonObject - 要转换的 JSON 对象。
  40517. */
  40518. fromJson(jsonObject) {
  40519. super.fromJson(jsonObject);
  40520. var sty = this.style;
  40521. if (sty) {
  40522. this.style = new ServerStyle(sty);
  40523. }
  40524. }
  40525. /**
  40526. * @function Vector.prototype.toServerJSONObject
  40527. * @description 转换成对应的 JSON 格式对象。
  40528. * @returns {Object} 对应的 JSON 格式对象
  40529. */
  40530. toServerJSONObject() {
  40531. var jsonObject = super.toServerJSONObject();
  40532. if (jsonObject.style) {
  40533. if (jsonObject.style.toServerJSONObject) {
  40534. jsonObject.style = jsonObject.style.toServerJSONObject();
  40535. }
  40536. }
  40537. return jsonObject;
  40538. }
  40539. }
  40540. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  40541. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40542. * This program are made available under the terms of the Apache License, Version 2.0
  40543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40544. /**
  40545. * @class GetLayersInfoService
  40546. * @deprecatedclass SuperMap.GetLayersInfoService
  40547. * @category iServer Map Layer
  40548. * @classdesc 获取图层信息服务类构造函数。
  40549. * @extends {CommonServiceBase}
  40550. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  40551. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  40552. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  40553. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  40554. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  40555. * @param {Object} options - 参数。
  40556. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  40557. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  40558. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40559. * @param {Object} [options.headers] - 请求头。
  40560. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  40561. * @usage
  40562. */
  40563. class GetLayersInfoService extends CommonServiceBase {
  40564. constructor(url, options) {
  40565. super(url, options);
  40566. /**
  40567. * @member {boolean} GetLayersInfoService.prototype.isTempLayers
  40568. * @description 当前url对应的图层是否是临时图层。
  40569. */
  40570. this.isTempLayers = false;
  40571. if (options) {
  40572. Util_Util.extend(this, options);
  40573. }
  40574. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  40575. }
  40576. /**
  40577. * @function GetLayersInfoService.prototype.destroy
  40578. * @override
  40579. */
  40580. destroy() {
  40581. super.destroy();
  40582. Util_Util.reset(this);
  40583. }
  40584. /**
  40585. * @function GetLayersInfoService.prototype.processAsync
  40586. * @description 负责将客户端的更新参数传递到服务端。
  40587. */
  40588. processAsync() {
  40589. var me = this,
  40590. method = "GET";
  40591. if (!me.isTempLayers) {
  40592. me.url = Util_Util.urlPathAppend(me.url, 'layers');
  40593. }
  40594. me.request({
  40595. method: method,
  40596. params: null,
  40597. scope: me,
  40598. success: me.serviceProcessCompleted,
  40599. failure: me.serviceProcessFailed
  40600. });
  40601. }
  40602. /**
  40603. * @function GetLayersInfoService.prototype.serviceProcessCompleted
  40604. * @description 编辑完成,执行此方法。
  40605. * @param {Object} result - 服务器返回的结果对象。
  40606. */
  40607. serviceProcessCompleted(result, options) {
  40608. var me = this, existRes, layers, len;
  40609. result = Util_Util.transformResult(result);
  40610. existRes = !!result && result.length > 0;
  40611. layers = existRes ? result[0].subLayers.layers : null;
  40612. len = layers ? layers.length : 0;
  40613. me.handleLayers(len, layers);
  40614. me.events.triggerEvent("processCompleted", {result: result[0], options});
  40615. }
  40616. /**
  40617. * TODO 专题图时候可能会用到
  40618. * @function GetLayersInfoService.prototype.handleLayers
  40619. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  40620. * @param {number} len - subLayers.layers的长度
  40621. * @param {Array.<number>} layers - subLayers.layers的长度数组
  40622. */
  40623. handleLayers(len, layers) {
  40624. var me = this, tempLayer;
  40625. if (len) {
  40626. for (var i = 0; i < len; i++) {
  40627. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  40628. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  40629. } else {
  40630. var type = layers[i].ugcLayerType;
  40631. switch (type) {
  40632. case 'THEME':
  40633. tempLayer = new ServerTheme();
  40634. tempLayer.fromJson(layers[i]);
  40635. layers[i] = tempLayer;
  40636. break;
  40637. case 'GRID':
  40638. tempLayer = new Grid();
  40639. tempLayer.fromJson(layers[i]);
  40640. layers[i] = tempLayer;
  40641. break;
  40642. case 'IMAGE':
  40643. tempLayer = new UGCImage();
  40644. tempLayer.fromJson(layers[i]);
  40645. layers[i] = tempLayer;
  40646. break;
  40647. case 'VECTOR':
  40648. tempLayer = new Vector_Vector();
  40649. tempLayer.fromJson(layers[i]);
  40650. layers[i] = tempLayer;
  40651. break;
  40652. default:
  40653. break;
  40654. }
  40655. }
  40656. }
  40657. }
  40658. }
  40659. }
  40660. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  40661. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40662. * This program are made available under the terms of the Apache License, Version 2.0
  40663. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40664. /**
  40665. * @class InterpolationAnalystParameters
  40666. * @deprecatedclass SuperMap.InterpolationAnalystParameters
  40667. * @category iServer SpatialAnalyst InterpolationAnalyst
  40668. * @classdesc 插值分析参数类。
  40669. * @param {Object} options - 参数。
  40670. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  40671. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  40672. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  40673. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。
  40674. * @param {string} [options.dataset] - 待分析的数据集名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  40675. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  40676. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  40677. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  40678. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  40679. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  40680. * @param {PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  40681. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  40682. * @usage
  40683. */
  40684. class InterpolationAnalystParameters {
  40685. constructor(options) {
  40686. if (!options) {
  40687. return;
  40688. }
  40689. /**
  40690. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} InterpolationAnalystParameters.prototype.bounds
  40691. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  40692. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  40693. * 因此建议此参数不大于原数据集范围。
  40694. */
  40695. this.bounds = null;
  40696. /**
  40697. * @member {number} [InterpolationAnalystParameters.prototype.searchRadius=0]
  40698. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  40699. * 计算某个位置的 Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  40700. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  40701. */
  40702. this.searchRadius = 0;
  40703. /**
  40704. * @member {string} InterpolationAnalystParameters.prototype.zValueFieldName
  40705. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  40706. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  40707. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  40708. */
  40709. this.zValueFieldName = null;
  40710. /**
  40711. * @member {number} [InterpolationAnalystParameters.prototype.zValueScale=1]
  40712. * @description 用于进行插值分析值的缩放比率。
  40713. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  40714. */
  40715. this.zValueScale = 1;
  40716. /**
  40717. * @member {number} InterpolationAnalystParameters.prototype.resolution
  40718. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  40719. * 该值不能超过待分析数据集的范围边长。
  40720. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  40721. */
  40722. this.resolution = null;
  40723. /**
  40724. * @member {FilterParameter} [InterpolationAnalystParameters.prototype.filterQueryParameter]
  40725. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  40726. */
  40727. this.filterQueryParameter = null;
  40728. /**
  40729. * @member {string} InterpolationAnalystParameters.prototype.outputDatasetName
  40730. * @description 插值分析结果数据集的名称。
  40731. */
  40732. this.outputDatasetName = null;
  40733. /**
  40734. * @member {string} InterpolationAnalystParameters.prototype.outputDatasourceName
  40735. * @description 插值分析结果数据源的名称。
  40736. */
  40737. this.outputDatasourceName = null;
  40738. /**
  40739. * @member {PixelFormat} [InterpolationAnalystParameters.prototype.pixelFormat]
  40740. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  40741. */
  40742. this.pixelFormat = null;
  40743. /**
  40744. * @member {string} [InterpolationAnalystParameters.prototype.dataset]
  40745. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  40746. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  40747. */
  40748. this.dataset = null;
  40749. /**
  40750. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [InterpolationAnalystParameters.prototype.inputPoints]
  40751. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  40752. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  40753. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  40754. */
  40755. this.inputPoints = null;
  40756. /**
  40757. * @member {string} [InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  40758. * @description 插值分析类型。插值分析包括数据集插值分析和几何插值分析两类,
  40759. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  40760. */
  40761. this.InterpolationAnalystType = "dataset";
  40762. /**
  40763. * @member {ClipParameter} InterpolationAnalystParameters.prototype.clipParam
  40764. * @description 对插值分析结果进行裁剪的参数。
  40765. */
  40766. this.clipParam = null;
  40767. Util_Util.extend(this, options);
  40768. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  40769. }
  40770. /**
  40771. * @function InterpolationAnalystParameters.prototype.destroy
  40772. * @description 释放资源,将引用资源的属性置空。
  40773. */
  40774. destroy() {
  40775. var me = this;
  40776. me.bounds = null;
  40777. me.searchRadius = null;
  40778. me.zValueFieldName = null;
  40779. me.zValueScale = null;
  40780. me.resolution = null;
  40781. me.filterQueryParameter = null;
  40782. me.outputDatasetName = null;
  40783. me.pixelFormat = null;
  40784. }
  40785. /**
  40786. * @function InterpolationAnalystParameters.toObject
  40787. * @param {InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  40788. * @param {InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  40789. * @description 将插值分析参数对象转换成 JSON 对象。
  40790. * @returns JSON 对象。
  40791. */
  40792. static toObject(interpolationAnalystParameters, tempObj) {
  40793. for (var name in interpolationAnalystParameters) {
  40794. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  40795. var objs = [];
  40796. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  40797. var item = interpolationAnalystParameters.inputPoints[i];
  40798. var obj = {
  40799. x: item.x,
  40800. y: item.y,
  40801. z: item.tag
  40802. };
  40803. objs.push(obj);
  40804. }
  40805. tempObj[name] = objs;
  40806. } else {
  40807. tempObj[name] = interpolationAnalystParameters[name];
  40808. }
  40809. }
  40810. }
  40811. }
  40812. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  40813. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40814. * This program are made available under the terms of the Apache License, Version 2.0
  40815. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40816. /**
  40817. * @class InterpolationRBFAnalystParameters
  40818. * @deprecatedclass SuperMap.InterpolationRBFAnalystParameters
  40819. * @category iServer SpatialAnalyst InterpolationAnalyst
  40820. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  40821. * @extends {InterpolationAnalystParameters}
  40822. * @param {Object} options - 参数。
  40823. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  40824. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  40825. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  40826. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  40827. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  40828. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  40829. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  40830. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与插值运算的点数。
  40831. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  40832. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  40833. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  40834. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  40835. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  40836. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  40837. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  40838. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此为必选参数。
  40839. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此为必选参数。
  40840. * @example
  40841. * var myInterpolationRBFAnalystParameters = new InterpolationRBFAnalystParameters({
  40842. * dataset:"SamplesP@Interpolation",
  40843. * smooth: 0.1,
  40844. * tension: 40,
  40845. * searchMode: "QUADTREE",
  40846. * maxPointCountForInterpolation: 20,
  40847. * maxPointCountInNode: 5,
  40848. * pixelFormat: "BIT16",
  40849. * zValueFieldName: "AVG_TMP",
  40850. * resolution: 3000,
  40851. * filterQueryParameter: {
  40852. * attributeFilter: ""
  40853. * },
  40854. * outputDatasetName: "myRBF"
  40855. * });
  40856. * @usage
  40857. */
  40858. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  40859. constructor(options) {
  40860. super(options);
  40861. /**
  40862. * @member {number} [InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  40863. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  40864. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  40865. */
  40866. this.smooth = 0.1;
  40867. /**
  40868. * @member {number} [InterpolationRBFAnalystParameters.prototype.tension=40]
  40869. * @description 张力系数,常用取值如 0、1、5 和 10。
  40870. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  40871. */
  40872. this.tension = 40;
  40873. /**
  40874. * @member {SearchMode} InterpolationRBFAnalystParameters.prototype.searchMode
  40875. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  40876. * 具体如下:
  40877. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  40878. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  40879. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  40880. */
  40881. this.searchMode = null;
  40882. /**
  40883. * @member {number} [InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  40884. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  40885. */
  40886. this.expectedCount = 12;
  40887. /**
  40888. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  40889. * @description 【块查找】方式下,最多参与插值的点数。
  40890. */
  40891. this.maxPointCountForInterpolation = 200;
  40892. /**
  40893. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  40894. * @description 【块查找】方式下,单个块内最多参与运算点数。
  40895. */
  40896. this.maxPointCountInNode = 50;
  40897. if (options) {
  40898. Util_Util.extend(this, options);
  40899. }
  40900. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  40901. }
  40902. /**
  40903. * @function InterpolationRBFAnalystParameters.prototype.destroy
  40904. * @description 释放资源,将引用资源的属性置空。
  40905. */
  40906. destroy() {
  40907. super.destroy();
  40908. var me = this;
  40909. me.smooth = null;
  40910. me.tension = null;
  40911. me.searchMode = null;
  40912. me.expectedCount = null;
  40913. me.maxPointCountForInterpolation = null;
  40914. me.maxPointCountInNode = null;
  40915. }
  40916. /**
  40917. * @function InterpolationRBFAnalystParameters.toObject
  40918. * @param {InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类。
  40919. * @param {InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象。
  40920. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  40921. * @returns JSON 对象。
  40922. */
  40923. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  40924. for (var name in datasetInterpolationRBFAnalystParameters) {
  40925. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  40926. }
  40927. }
  40928. }
  40929. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  40930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40931. * This program are made available under the terms of the Apache License, Version 2.0
  40932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40933. /**
  40934. * @class InterpolationDensityAnalystParameters
  40935. * @deprecatedclass SuperMap.InterpolationDensityAnalystParameters
  40936. * @category iServer SpatialAnalyst InterpolationAnalyst
  40937. * @classdesc 点密度插值分析参数类。
  40938. * @param {Object} options - 参数。
  40939. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  40940. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  40941. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  40942. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  40943. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。此为必选参数。
  40944. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  40945. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  40946. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  40947. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  40948. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  40949. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时,此为必选参数。
  40950. * @extends {InterpolationAnalystParameters}
  40951. * @example
  40952. * var myInterpolationDensityAnalystParameters = new InterpolationDensityAnalystParameters({
  40953. * dataset: "SamplesP@Interpolation",
  40954. * searchRadius: "100000",
  40955. * pixelFormat: "BIT16",
  40956. * zValueFieldName: "AVG_TMP",
  40957. * resolution: 3000,
  40958. * filterQueryParameter: {
  40959. * attributeFilter: ""
  40960. * },
  40961. * outputDatasetName: "myDensity"
  40962. * });
  40963. * @usage
  40964. */
  40965. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  40966. constructor(options) {
  40967. super(options);
  40968. if (options) {
  40969. Util_Util.extend(this, options);
  40970. }
  40971. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  40972. }
  40973. /**
  40974. * @function InterpolationDensityAnalystParameters.prototype.destroy
  40975. * @description 释放资源,将引用资源的属性置空。
  40976. */
  40977. destroy() {
  40978. super.destroy();
  40979. }
  40980. }
  40981. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  40982. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40983. * This program are made available under the terms of the Apache License, Version 2.0
  40984. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40985. /**
  40986. * @class InterpolationIDWAnalystParameters
  40987. * @deprecatedclass SuperMap.InterpolationIDWAnalystParameters
  40988. * @category iServer SpatialAnalyst InterpolationAnalyst
  40989. * @classdesc 反距离加权插值(IDW)分析参数类。
  40990. * @param {Object} options - 参数。
  40991. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  40992. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  40993. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  40994. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  40995. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  40996. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  40997. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  40998. * @param {number} [options.power=2] - 距离权重计算的幂次。
  40999. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  41000. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  41001. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  41002. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  41003. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  41004. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,此为必选参数。
  41005. * @extends {InterpolationAnalystParameters}
  41006. * @example 例如:
  41007. * var myInterpolationIDWAnalystParameters = new InterpolationIDWAnalystParameters({
  41008. * dataset:"SamplesP@Interpolation",
  41009. * power: 2,
  41010. * searchMode: "KDTREE_FIXED_COUNT",
  41011. * expectedCount: 12,
  41012. * pixelFormat: "BIT16",
  41013. * zValueFieldName: "AVG_TMP",
  41014. * resolution: 3000,
  41015. * filterQueryParameter: {
  41016. * attributeFilter: ""
  41017. * },
  41018. * outputDatasetName: "myIDW"
  41019. * });
  41020. * @usage
  41021. */
  41022. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  41023. constructor(options) {
  41024. super(options);
  41025. /**
  41026. * @member {number} [InterpolationIDWAnalystParameters.prototype.power=2]
  41027. * @description 距离权重计算的幂次。
  41028. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  41029. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  41030. */
  41031. this.power = 2;
  41032. /**
  41033. * @member {SearchMode} InterpolationIDWAnalystParameters.prototype.searchMode
  41034. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  41035. * 具体如下:
  41036. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  41037. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  41038. */
  41039. this.searchMode = null;
  41040. /**
  41041. * @member {number} [InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  41042. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  41043. */
  41044. this.expectedCount = 12;
  41045. if (options) {
  41046. Util_Util.extend(this, options);
  41047. }
  41048. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  41049. }
  41050. /**
  41051. * @function InterpolationIDWAnalystParameters.prototype.destroy
  41052. * @description 释放资源,将引用资源的属性置空。
  41053. */
  41054. destroy() {
  41055. super.destroy();
  41056. var me = this;
  41057. me.power = null;
  41058. me.searchMode = null;
  41059. me.expectedCount = null;
  41060. }
  41061. }
  41062. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  41063. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41064. * This program are made available under the terms of the Apache License, Version 2.0
  41065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41066. /**
  41067. * @class InterpolationKrigingAnalystParameters
  41068. * @deprecatedclass SuperMap.InterpolationKrigingAnalystParameters
  41069. * @category iServer SpatialAnalyst InterpolationAnalyst
  41070. * @classdesc 克吕金插值分析参数类。通过该类可以设置克吕金插值分析所需的参数。
  41071. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  41072. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确地指出误差值的大小。
  41073. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  41074. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  41075. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数:<br>
  41076. * 1.块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了块金效应,
  41077. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  41078. * 2.基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  41079. * 即大于此间距的采样点不再具有空间相关性。<br>
  41080. * 3.偏基台值:基台值与块金值的差值。<br>
  41081. * 4.自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  41082. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。
  41083. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  41084. * 计算量大,且变异函数有时需要根据经验人为选定。
  41085. *
  41086. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  41087. * 1.指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加呈指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  41088. * 2.球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  41089. * 3.高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  41090. *
  41091. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的插值功能基于以下三种常用 Kriging 算法:<br>
  41092. * 1.简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)为已知的某一常数。<br>
  41093. * 2.普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,
  41094. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。<br>
  41095. * 3.泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定
  41096. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。<br>
  41097. * @param {Object} options - 参数。
  41098. * @param {string} options.type - 克吕金插值的类型。
  41099. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  41100. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  41101. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  41102. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  41103. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  41104. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  41105. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  41106. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  41107. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  41108. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  41109. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  41110. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  41111. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  41112. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  41113. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  41114. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  41115. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  41116. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  41117. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  41118. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  41119. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。
  41120. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时。
  41121. * @extends {InterpolationAnalystParameters}
  41122. * @example 例如:
  41123. * var myInterpolationKrigingAnalystParameters = new InterpolationKrigingAnalystParameters({
  41124. * dataset:"SamplesP@Interpolation",
  41125. * type: "KRIGING",
  41126. * angle: 0,
  41127. * mean: 5,
  41128. * nugget: 30,
  41129. * range: 50,
  41130. * sill: 300,
  41131. * variogramMode: "EXPONENTIAL",
  41132. * searchMode: "QUADTREE",
  41133. * maxPointCountForInterpolation: 20,
  41134. * maxPointCountInNode: 5,
  41135. * pixelFormat: "BIT16",
  41136. * zValueFieldName: "AVG_TMP",
  41137. * resolution: 30000,
  41138. * filterQueryParameter: {
  41139. * attributeFilter: ""
  41140. * },
  41141. * outputDatasetName: "myKriging"
  41142. * });
  41143. * @usage
  41144. */
  41145. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  41146. constructor(options) {
  41147. super(options);
  41148. /**
  41149. * @member {InterpolationAlgorithmType} InterpolationKrigingAnalystParameters.prototype.type
  41150. * @description 克吕金插值的类型。
  41151. * 具体如下:<br>
  41152. * {KRIGING} 普通克吕金插值法。
  41153. * {SimpleKriging} 简单克吕金插值法。
  41154. * {UniversalKriging} 泛克吕金插值法。
  41155. */
  41156. this.type = null;
  41157. /**
  41158. * @member {number} InterpolationKrigingAnalystParameters.prototype.mean
  41159. * @description 【简单克吕金】方式下,插值字段的平均值。
  41160. * 即采样点插值字段值总和除以采样点数目。
  41161. */
  41162. this.mean = null;
  41163. /**
  41164. * @member {number} [InterpolationKrigingAnalystParameters.prototype.angle=0]
  41165. * @description 克吕金算法中旋转角度值。
  41166. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  41167. */
  41168. this.angle = 0;
  41169. /**
  41170. * @member {number} [InterpolationKrigingAnalystParameters.prototype.nugget=0]
  41171. * @description 克吕金算法中块金效应值。
  41172. */
  41173. this.nugget = 0;
  41174. /**
  41175. * @member {number} [InterpolationKrigingAnalystParameters.prototype.range=0]
  41176. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  41177. */
  41178. this.range = 0;
  41179. /**
  41180. * @member {number} [InterpolationKrigingAnalystParameters.prototype.sill=0]
  41181. * @description 克吕金算法中基台值。
  41182. */
  41183. this.sill = 0;
  41184. /**
  41185. * @member {VariogramMode} [InterpolationKrigingAnalystParameters.prototype.variogramMode=VariogramMode.SPHERICAL]
  41186. * @description 克吕金插值时的半变函数类型。
  41187. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  41188. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  41189. */
  41190. this.variogramMode = VariogramMode.SPHERICAL;
  41191. /**
  41192. * @member {Exponent} [InterpolationKrigingAnalystParameters.prototype.exponent=Exponent.EXP1]
  41193. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  41194. */
  41195. this.exponent = Exponent.EXP1;
  41196. /**
  41197. * @member {SearchMode} InterpolationKrigingAnalystParameters.prototype.searchMode
  41198. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。此为必选参数。
  41199. * 简单克吕金和泛克吕金不支持块查找。
  41200. * 具体如下:<br>
  41201. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  41202. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  41203. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  41204. */
  41205. this.searchMode = null;
  41206. /**
  41207. * @member {number} [InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  41208. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数,默认值为12。
  41209. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  41210. */
  41211. this.expectedCount = 12;
  41212. /**
  41213. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  41214. * @description 【块查找】方式下,最多参与插值的点数。
  41215. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  41216. */
  41217. this.maxPointCountForInterpolation = 200;
  41218. /**
  41219. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountInNode=50]
  41220. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  41221. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  41222. */
  41223. this.maxPointCountInNode = 50;
  41224. if (options) {
  41225. Util_Util.extend(this, options);
  41226. }
  41227. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  41228. }
  41229. /**
  41230. * @function InterpolationKrigingAnalystParameters.prototype.destroy
  41231. * @description 释放资源,将引用资源的属性置空。
  41232. */
  41233. destroy() {
  41234. super.destroy();
  41235. var me = this;
  41236. me.type = null;
  41237. me.mean = null;
  41238. me.angle = null;
  41239. me.nugget = null;
  41240. me.range = null;
  41241. me.sill = null;
  41242. me.variogramMode = null;
  41243. me.exponent = null;
  41244. me.searchMode = null;
  41245. me.expectedCount = null;
  41246. me.maxPointCountForInterpolation = null;
  41247. me.maxPointCountInNode = null;
  41248. }
  41249. }
  41250. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  41251. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41252. * This program are made available under the terms of the Apache License, Version 2.0
  41253. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41254. /**
  41255. * @class InterpolationAnalystService
  41256. * @deprecatedclass SuperMap.InterpolationAnalystService
  41257. * @category iServer SpatialAnalyst InterpolationAnalyst
  41258. * @classdesc 插值分析服务类。
  41259. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  41260. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  41261. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  41262. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  41263. * @param {Object} options - 参数。
  41264. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  41265. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41266. * @param {Object} [options.headers] - 请求头。
  41267. * @extends {SpatialAnalystBase}
  41268. * @example 例如:
  41269. * (start code)
  41270. * var myTInterpolationAnalystService = new InterpolationAnalystService(url);
  41271. * myTInterpolationAnalystService.events.on({
  41272. * "processCompleted": processCompleted,
  41273. * "processFailed": processFailed
  41274. * }
  41275. * );
  41276. * (end)
  41277. * @usage
  41278. */
  41279. class InterpolationAnalystService extends SpatialAnalystBase {
  41280. constructor(url, options) {
  41281. super(url, options);
  41282. /**
  41283. * @member {string} InterpolationAnalystService.prototype.mode
  41284. * @description 插值分析类型。
  41285. */
  41286. this.mode = null;
  41287. if (options) {
  41288. Util_Util.extend(this, options);
  41289. }
  41290. }
  41291. /**
  41292. * @function InterpolationAnalystService.prototype.destroy
  41293. * @description 释放资源,将引用资源的属性置空。
  41294. */
  41295. destroy() {
  41296. super.destroy();
  41297. this.mode = null;
  41298. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  41299. }
  41300. /**
  41301. * @function InterpolationAnalystService.prototype.processAsync
  41302. * @description 负责将客户端的查询参数传递到服务端。
  41303. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} parameter - 插值分析参数类。
  41304. */
  41305. processAsync(parameter) {
  41306. var parameterObject = {};
  41307. var me = this;
  41308. if (parameter instanceof InterpolationDensityAnalystParameters) {
  41309. me.mode = 'Density';
  41310. if (parameter.InterpolationAnalystType === 'geometry') {
  41311. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  41312. } else {
  41313. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  41314. }
  41315. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  41316. me.mode = 'IDW';
  41317. if (parameter.InterpolationAnalystType === 'geometry') {
  41318. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  41319. } else {
  41320. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  41321. }
  41322. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  41323. me.mode = 'RBF';
  41324. if (parameter.InterpolationAnalystType === 'geometry') {
  41325. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  41326. } else {
  41327. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  41328. }
  41329. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  41330. me.mode = 'Kriging';
  41331. if (parameter.InterpolationAnalystType === 'geometry') {
  41332. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  41333. } else {
  41334. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  41335. }
  41336. }
  41337. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  41338. var jsonParameters = Util_Util.toJSON(parameterObject);
  41339. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  41340. me.request({
  41341. method: "POST",
  41342. data: jsonParameters,
  41343. scope: me,
  41344. success: me.serviceProcessCompleted,
  41345. failure: me.serviceProcessFailed
  41346. });
  41347. }
  41348. }
  41349. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  41350. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41351. * This program are made available under the terms of the Apache License, Version 2.0
  41352. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41353. /**
  41354. * @class KernelDensityJobParameter
  41355. * @deprecatedclass SuperMap.KernelDensityJobParameter
  41356. * @category iServer ProcessingService DensityAnalyst
  41357. * @classdesc 核密度分析服务参数类。
  41358. * @param {Object} options - 参数。
  41359. * @param {string} options.datasetName - 数据集名。
  41360. * @param {string} options.fields - 权重索引。
  41361. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  41362. * @param {number} [options.resolution=80] - 分辨率。
  41363. * @param {number} [options.method=0] - 分析方法。
  41364. * @param {number} [options.meshType=0] - 分析类型。
  41365. * @param {number} [options.radius=300] - 分析的影响半径。
  41366. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  41367. * @param {AnalystSizeUnit} [options.radiusUnit=AnalystSizeUnit.METER] - 搜索半径单位。
  41368. * @param {AnalystAreaUnit} [options.areaUnit=AnalystAreaUnit.SQUAREMILE] - 面积单位。
  41369. * @param {OutputSetting} [options.output] - 输出参数设置。
  41370. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  41371. * @usage
  41372. */
  41373. class KernelDensityJobParameter {
  41374. constructor(options) {
  41375. if (!options) {
  41376. return;
  41377. }
  41378. /**
  41379. * @member {string} KernelDensityJobParameter.prototype.datasetName
  41380. * @description 数据集名。
  41381. */
  41382. this.datasetName = "";
  41383. /**
  41384. * @member {SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject} [KernelDensityJobParameter.prototype.query]
  41385. * @description 分析范围。
  41386. */
  41387. this.query = "";
  41388. /**
  41389. * @member {number} [KernelDensityJobParameter.prototype.resolution=80]
  41390. * @description 网格大小。
  41391. */
  41392. this.resolution = 80;
  41393. /**
  41394. * @member {number} [KernelDensityJobParameter.prototype.method=0]
  41395. * @description 分析方法。
  41396. */
  41397. this.method = 0;
  41398. /**
  41399. * @member {number} [KernelDensityJobParameter.prototype.meshType=0]
  41400. * @description 分析类型。
  41401. */
  41402. this.meshType = 0;
  41403. /**
  41404. * @member {string} KernelDensityJobParameter.prototype.fields
  41405. * @description 权重索引。
  41406. */
  41407. this.fields = "";
  41408. /**
  41409. * @member {number} [KernelDensityJobParameter.prototype.radius=300]
  41410. * @description 分析的影响半径。
  41411. */
  41412. this.radius = 300;
  41413. /**
  41414. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  41415. * @description 网格大小单位。
  41416. */
  41417. this.meshSizeUnit = AnalystSizeUnit.METER;
  41418. /**
  41419. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.radiusUnit=AnalystSizeUnit.METER]
  41420. * @description 搜索半径单位。
  41421. */
  41422. this.radiusUnit = AnalystSizeUnit.METER;
  41423. /**
  41424. * @member {AnalystAreaUnit} [KernelDensityJobParameter.prototype.areaUnit=AnalystAreaUnit.SQUAREMILE]
  41425. * @description 面积单位。
  41426. */
  41427. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  41428. /**
  41429. * @member {OutputSetting} KernelDensityJobParameter.prototype.output
  41430. * @description 输出参数设置类。
  41431. */
  41432. this.output = null;
  41433. /**
  41434. * @member {MappingParameters} [KernelDensityJobParameter.prototype.mappingParameters]
  41435. * @description 分析后结果可视化的参数类。
  41436. */
  41437. this.mappingParameters = null;
  41438. Util_Util.extend(this, options);
  41439. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  41440. }
  41441. /**
  41442. * @function KernelDensityJobParameter.prototype.destroy
  41443. * @description 释放资源,将引用资源的属性置空。
  41444. */
  41445. destroy() {
  41446. this.datasetName = null;
  41447. this.query = null;
  41448. this.resolution = null;
  41449. this.method = null;
  41450. this.radius = null;
  41451. this.meshType = null;
  41452. this.fields = null;
  41453. this.meshSizeUnit = null;
  41454. this.radiusUnit = null;
  41455. this.areaUnit = null;
  41456. if (this.output instanceof OutputSetting) {
  41457. this.output.destroy();
  41458. this.output = null;
  41459. }
  41460. if (this.mappingParameters instanceof MappingParameters) {
  41461. this.mappingParameters.destroy();
  41462. this.mappingParameters = null;
  41463. }
  41464. }
  41465. /**
  41466. * @function KernelDensityJobParameter.toObject
  41467. * @param {KernelDensityJobParameter} kernelDensityJobParameter - 核密度分析服务参数类。
  41468. * @param {KernelDensityJobParameter} tempObj - 核密度分析服务参数对象。
  41469. * @description 将核密度分析服务参数对象转换为 JSON 对象。
  41470. * @returns JSON 对象。
  41471. */
  41472. static toObject(kernelDensityJobParameter, tempObj) {
  41473. for (var name in kernelDensityJobParameter) {
  41474. if (name === "datasetName") {
  41475. tempObj['input'] = tempObj['input'] || {};
  41476. tempObj['input'][name] = kernelDensityJobParameter[name];
  41477. continue;
  41478. }
  41479. if (name === "output") {
  41480. tempObj['output'] = tempObj['output'] || {};
  41481. tempObj['output'] = kernelDensityJobParameter[name];
  41482. continue;
  41483. }
  41484. tempObj['analyst'] = tempObj['analyst'] || {};
  41485. if (name === 'query' && kernelDensityJobParameter[name]) {
  41486. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  41487. } else {
  41488. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  41489. }
  41490. if (name === 'mappingParameters') {
  41491. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  41492. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  41493. }
  41494. }
  41495. }
  41496. }
  41497. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  41498. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41499. * This program are made available under the terms of the Apache License, Version 2.0
  41500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41501. /**
  41502. * @class KernelDensityJobsService
  41503. * @deprecatedclass SuperMap.KernelDensityJobsService
  41504. * @category iServer ProcessingService DensityAnalyst
  41505. * @classdesc 核密度分析服务类
  41506. * @extends {ProcessingServiceBase}
  41507. * @param {string} url - 服务地址。
  41508. * @param {Object} options - 可选参数。
  41509. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41510. * @param {Object} [options.headers] - 请求头。
  41511. * @usage
  41512. */
  41513. class KernelDensityJobsService extends ProcessingServiceBase {
  41514. constructor(url, options) {
  41515. super(url, options);
  41516. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/density');
  41517. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  41518. }
  41519. /**
  41520. * @function KernelDensityJobsService.prototype.destroy
  41521. * @override
  41522. */
  41523. destroy() {
  41524. super.destroy();
  41525. }
  41526. /**
  41527. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  41528. * @description 获取核密度分析任务
  41529. */
  41530. getKernelDensityJobs() {
  41531. super.getJobs(this.url);
  41532. }
  41533. /**
  41534. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  41535. * @description 获取指定id的核密度分析服务
  41536. * @param {string} id - 指定要获取数据的id
  41537. */
  41538. getKernelDensityJob(id) {
  41539. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  41540. }
  41541. /**
  41542. * @function KernelDensityJobsService.prototype.addKernelDensityJob
  41543. * @description 新建核密度分析服务
  41544. * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
  41545. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  41546. */
  41547. addKernelDensityJob(params, seconds) {
  41548. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  41549. }
  41550. }
  41551. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  41552. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41553. * This program are made available under the terms of the Apache License, Version 2.0
  41554. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41555. /**
  41556. * @class LabelMatrixCell
  41557. * @deprecatedclass SuperMap.LabelMatrixCell
  41558. * @category iServer Map Theme
  41559. * @classdesc 矩阵标签元素抽象类。该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  41560. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  41561. * @usage
  41562. */
  41563. class LabelMatrixCell {
  41564. constructor() {
  41565. this.CLASS_NAME = "LabelMatrixCell";
  41566. }
  41567. }
  41568. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  41569. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41570. * This program are made available under the terms of the Apache License, Version 2.0
  41571. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41572. /**
  41573. * @class LabelImageCell
  41574. * @deprecatedclass SuperMap.LabelImageCell
  41575. * @category iServer Map Theme
  41576. * @classdesc 图片类型的矩阵标签元素类。该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  41577. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  41578. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  41579. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  41580. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 是一个二维数组,
  41581. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  41582. * @extends {LabelMatrixCell}
  41583. * @param {Object} options - 可选参数。
  41584. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  41585. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  41586. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  41587. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  41588. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  41589. * @usage
  41590. */
  41591. class LabelImageCell extends LabelMatrixCell {
  41592. constructor(options) {
  41593. super(options);
  41594. /**
  41595. * @member {number} LabelImageCell.prototype.height
  41596. * @description 设置图片的高度,单位为毫米。
  41597. */
  41598. this.height = 0;
  41599. /**
  41600. * @member {string} LabelImageCell.prototype.pathField
  41601. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  41602. */
  41603. this.pathField = null;
  41604. /**
  41605. * @member {number} [LabelImageCell.prototype.rotation=0.0]
  41606. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  41607. */
  41608. this.rotation = 0.0;
  41609. /**
  41610. * @member {number} LabelImageCell.prototype.width
  41611. * @description 设置图片的宽度,单位为毫米。
  41612. */
  41613. this.width = 0;
  41614. /**
  41615. * @member {boolean} [LabelImageCell.prototype.sizeFixed=false]
  41616. * @description 是否固定图片的大小。
  41617. */
  41618. this.sizeFixed = false;
  41619. /**
  41620. * @member {string} LabelImageCell.prototype.type
  41621. * @description 制作矩阵专题图时是必须的。
  41622. */
  41623. this.type = "IMAGE";
  41624. if (options) {
  41625. Util_Util.extend(this, options);
  41626. }
  41627. this.CLASS_NAME = "SuperMap.LabelImageCell";
  41628. }
  41629. /**
  41630. * @function LabelImageCell.prototype.destroy
  41631. * @description 释放资源,将引用资源的属性置空。
  41632. */
  41633. destroy() {
  41634. var me = this;
  41635. me.height = null;
  41636. me.pathField = null;
  41637. me.rotation = null;
  41638. me.width = null;
  41639. me.sizeFixed = null;
  41640. }
  41641. }
  41642. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  41643. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41644. * This program are made available under the terms of the Apache License, Version 2.0
  41645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41646. /**
  41647. * @class LabelSymbolCell
  41648. * @deprecatedclass SuperMap.LabelSymbolCell
  41649. * @category iServer Map Theme
  41650. * @classdesc 符号类型的矩阵标签元素类。
  41651. * 该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  41652. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  41653. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  41654. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  41655. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  41656. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  41657. * @extends {LabelMatrixCell}
  41658. * @param {Object} options - 参数。
  41659. * @param {ServerStyle} options.style - 获取或设置符号样式。
  41660. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  41661. * @usage
  41662. */
  41663. class LabelSymbolCell extends LabelMatrixCell {
  41664. constructor(options) {
  41665. super(options);
  41666. /**
  41667. * @member {ServerStyle} LabelSymbolCell.prototype.style
  41668. * @description 获取或设置符号样式—— {@link ServerStyle} 对象,包括符号大小({@link ServerStyle#markerSize})
  41669. * 和符号旋转({@link ServerStyle#markerAngle})角度,其中用于设置符号 ID 的属性({@link ServerStyle#markerSymbolID})在此处不起作用。
  41670. */
  41671. this.style = new ServerStyle();
  41672. /**
  41673. * @member {string} LabelSymbolCell.prototype.symbolIDField
  41674. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  41675. */
  41676. this.symbolIDField = null;
  41677. /**
  41678. * @member {string} LabelSymbolCell.prototype.type
  41679. * @description 制作矩阵专题图时是必须的。
  41680. */
  41681. this.type = "SYMBOL";
  41682. if (options) {
  41683. Util_Util.extend(this, options);
  41684. }
  41685. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  41686. }
  41687. /**
  41688. * @function LabelSymbolCell.prototype.destroy
  41689. * @description 释放资源,将引用资源的属性置空。
  41690. */
  41691. destroy() {
  41692. var me = this;
  41693. if (me.style) {
  41694. me.style.destroy();
  41695. me.style = null;
  41696. }
  41697. me.symbolIDField = null;
  41698. }
  41699. }
  41700. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  41701. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41702. * This program are made available under the terms of the Apache License, Version 2.0
  41703. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41704. /**
  41705. * @class LabelThemeCell
  41706. * @deprecatedclass SuperMap.LabelThemeCell
  41707. * @category iServer Map Theme
  41708. * @classdesc 专题图类型的矩阵标签元素类。
  41709. * 该类继承自 {@link LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  41710. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  41711. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  41712. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  41713. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  41714. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  41715. * @extends {LabelMatrixCell}
  41716. * @param {Object} options -参数。
  41717. * @param {ThemeLabel} options.themeLabel - 作为矩阵标签元素的标签专题图类。
  41718. * @usage
  41719. */
  41720. class LabelThemeCell extends LabelMatrixCell {
  41721. constructor(options) {
  41722. super(options);
  41723. /**
  41724. * @member {ThemeLabel} LabelThemeCell.prototype.themeLabel
  41725. * @description 使用专题图对象作为矩阵标签的一个元素。
  41726. */
  41727. this.themeLabel = new ThemeLabel();
  41728. /**
  41729. * @member {string} LabelThemeCell.prototype.type
  41730. * @description 制作矩阵专题图时是必须的。
  41731. */
  41732. this.type = "THEME";
  41733. if (options) {
  41734. Util_Util.extend(this, options);
  41735. }
  41736. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  41737. }
  41738. /**
  41739. * @function LabelThemeCell.prototype.destroy
  41740. * @description 释放资源,将引用资源的属性置空。
  41741. */
  41742. destroy() {
  41743. var me = this;
  41744. if (me.themeLabel) {
  41745. me.themeLabel.destroy();
  41746. me.themeLabel = null;
  41747. }
  41748. }
  41749. }
  41750. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  41751. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41752. * This program are made available under the terms of the Apache License, Version 2.0
  41753. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41754. /**
  41755. * @class LayerStatus
  41756. * @deprecatedclass SuperMap.LayerStatus
  41757. * @category iServer Map TempLayersSet
  41758. * @classdesc 子图层显示参数类。该类存储了各个子图层的名字和是否可见的状态。
  41759. * @param {Object} options - 参数。
  41760. * @param {string} options.layerName - 图层名称。
  41761. * @param {boolean} [options.isVisible=true] - 图层是否可见,true 表示可见。
  41762. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  41763. * @usage
  41764. */
  41765. class LayerStatus {
  41766. constructor(options) {
  41767. /**
  41768. * @member {string} LayerStatus.prototype.layerName
  41769. * @description 获取或设置图层名称。
  41770. */
  41771. this.layerName = null;
  41772. /**
  41773. * @member {boolean} LayerStatus.prototype.isVisible
  41774. * @description 获取或设置图层是否可见,true 表示可见。
  41775. */
  41776. this.isVisible = null;
  41777. /**
  41778. * @member {string} [LayerStatus.prototype.displayFilter]
  41779. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  41780. */
  41781. this.displayFilter = null;
  41782. /**
  41783. * @member {Object} [LayerStatus.prototype.fieldValuesDisplayFilter]
  41784. * @property {Array.<number>} values - 要过滤的值。
  41785. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  41786. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  41787. */
  41788. this.fieldValuesDisplayFilter = null;
  41789. if (options) {
  41790. Util_Util.extend(this, options);
  41791. }
  41792. this.CLASS_NAME = "SuperMap.LayerStatus";
  41793. }
  41794. /**
  41795. * @function LayerStatus.prototype.destroy
  41796. * @description 释放资源,将引用资源的属性置空。
  41797. */
  41798. destroy() {
  41799. var me = this;
  41800. me.layerName = null;
  41801. me.isVisible = null;
  41802. me.displayFilter = null;
  41803. }
  41804. /**
  41805. * @function LayerStatus.prototype.toJSON
  41806. * @description 生成对应的 JSON。
  41807. * @returns {Object} 对应的 JSON。
  41808. */
  41809. toJSON() {
  41810. var json = '{';
  41811. json += '"type":"UGC",';
  41812. var v = [];
  41813. if (this.layerName) {
  41814. v.push('"name":"' + this.layerName + '"');
  41815. v.push('"visible":' + this.isVisible);
  41816. }
  41817. if (this.displayFilter) {
  41818. v.push('"displayFilter":"' + this.displayFilter + '"');
  41819. }
  41820. if (this.minScale || this.minScale == 0) {
  41821. v.push('"minScale":' + this.minScale);
  41822. }
  41823. if (this.maxScale || this.maxScale == 0) {
  41824. v.push('"maxScale":' + this.maxScale);
  41825. }
  41826. if (this.fieldValuesDisplayFilter) {
  41827. v.push('"fieldValuesDisplayFilter":' + Util_Util.toJSON(this.fieldValuesDisplayFilter));
  41828. }
  41829. json += v;
  41830. json += '}';
  41831. return json;
  41832. }
  41833. }
  41834. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  41835. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41836. * This program are made available under the terms of the Apache License, Version 2.0
  41837. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41838. /**
  41839. * @class LinkItem
  41840. * @deprecatedclass SuperMap.LinkItem
  41841. * @constructs LinkItem
  41842. * @category iServer Data FeatureResults
  41843. * @classdesc 关联信息类。该类用于矢量数据集与外部表的关联。外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  41844. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  41845. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link LinkItem}
  41846. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  41847. * 1.使用 {@link LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  41848. * 2.使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  41849. * @param {Object} options - 参数。
  41850. * @param {DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  41851. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  41852. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  41853. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  41854. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  41855. * @param {string} options.name - 此关联信息对象的名称。
  41856. * @param {Array.<string>} options.primaryKeys - 关联的外部属性表的主键。
  41857. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  41858. * function queryBySQL() {
  41859. * // 设置关联的外部数据库信息,alias表示数据库别名
  41860. * var dc = new DatasourceConnectionInfo({
  41861. * dataBase: "RelQuery",
  41862. * server: "{ip}:{port}",
  41863. * user: "sa",
  41864. * password: "map",
  41865. * driver: "SQL Server",
  41866. * connect: true,
  41867. * OpenLinkTable: false,
  41868. * alias: "RelQuery",
  41869. * engineType: EngineType.SQLPLUS,
  41870. * readOnly: false,
  41871. * exclusive: false
  41872. * });
  41873. * // 设置关联信息
  41874. * var linkItem = new LinkItem({
  41875. * datasourceConnectionInfo: dc,
  41876. * foreignKeys: ["name"],
  41877. * foreignTable: "Pop_2011",
  41878. * linkFields: ["SmID as Pid","pop"],
  41879. * name: "link",
  41880. * primatryKeys: ["name"],
  41881. * });
  41882. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  41883. * var queryParam, queryBySQLParams, queryBySQLService;
  41884. * queryParam = new FilterParameter({
  41885. * name: "Province@RelQuery",
  41886. * fields: ["SmID","name"],
  41887. * attributeFilter: "SmID<7",
  41888. * linkItems: [linkItem]
  41889. * }),
  41890. * queryBySQLParams = new QueryBySQLParameters({
  41891. * queryParams: [queryParam]
  41892. * }),
  41893. * queryBySQLService = new QueryBySQLService(url, {
  41894. * eventListeners: {
  41895. * "processCompleted": processCompleted,
  41896. * "processFailed": processFailed
  41897. * }
  41898. * });
  41899. * queryBySQLService.processAsync(queryBySQLParams);
  41900. * }
  41901. * function processCompleted(queryEventArgs) {//todo}
  41902. * function processFailed(e) {//todo}
  41903. * @usage
  41904. */
  41905. class LinkItem {
  41906. constructor(options) {
  41907. /**
  41908. * @member {DatasourceConnectionInfo} LinkItem.prototype.datasourceConnectionInfo
  41909. * @description 关联的外部数据源信息。
  41910. */
  41911. this.datasourceConnectionInfo = null;
  41912. /**
  41913. * @member {Array.<string>} LinkItem.prototype.foreignKeys
  41914. * @description 主空间数据集的外键。
  41915. */
  41916. this.foreignKeys = null;
  41917. /**
  41918. * @member {string} LinkItem.prototype.foreignTable
  41919. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  41920. */
  41921. this.foreignTable = null;
  41922. /**
  41923. * @member {Array.<string>} LinkItem.prototype.linkFields
  41924. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  41925. */
  41926. this.linkFields = null;
  41927. /**
  41928. * @member {string} LinkItem.prototype.linkFilter
  41929. * @description 与外部属性表的连接条件。
  41930. */
  41931. this.linkFilter = null;
  41932. /**
  41933. * @member {string} LinkItem.prototype.name
  41934. * @description 此关联信息对象的名称。
  41935. */
  41936. this.name = null;
  41937. /**
  41938. * @member {Array.<string>} LinkItem.prototype.primaryKeys
  41939. * @description 需要关联的外部属性表的主键。
  41940. */
  41941. this.primaryKeys = null;
  41942. if (options) {
  41943. Util_Util.extend(this, options);
  41944. }
  41945. this.CLASS_NAME = "SuperMap.LinkItem";
  41946. }
  41947. /**
  41948. * @function LinkItem.prototype.destroy
  41949. * @description 释放资源,将引用资源的属性置空。
  41950. */
  41951. destroy() {
  41952. var me = this;
  41953. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  41954. me.datasourceConnectionInfo.destroy();
  41955. me.datasourceConnectionInfo = null;
  41956. }
  41957. me.foreignKeys = null;
  41958. me.foreignTable = null;
  41959. me.linkFields = null;
  41960. me.linkFilter = null;
  41961. me.name = null;
  41962. me.primaryKeys = null;
  41963. }
  41964. }
  41965. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  41966. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41967. * This program are made available under the terms of the Apache License, Version 2.0
  41968. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41969. /**
  41970. * @class MapService
  41971. * @deprecatedclass SuperMap.MapService
  41972. * @category iServer Map
  41973. * @classdesc 地图信息服务类。
  41974. * @extends {CommonServiceBase}
  41975. * @example
  41976. * var myMapService = new MapService(url, {
  41977. * eventListeners:{
  41978. * "processCompleted": MapServiceCompleted,
  41979. * "processFailed": MapServiceFailed
  41980. * }
  41981. * });
  41982. *
  41983. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  41984. * @param {Object} options - 参数。
  41985. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  41986. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  41987. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41988. * @param {Object} [options.headers] - 请求头。
  41989. * @usage
  41990. */
  41991. class MapService extends CommonServiceBase {
  41992. constructor(url, options) {
  41993. super(url, options);
  41994. /**
  41995. * @member {string} MapService.prototype.projection
  41996. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  41997. */
  41998. this.projection = null;
  41999. this.CLASS_NAME = "SuperMap.MapService";
  42000. if (options) {
  42001. Util_Util.extend(this, options);
  42002. }
  42003. var me = this;
  42004. if (me.projection) {
  42005. var arr = me.projection.split(":");
  42006. if (arr instanceof Array) {
  42007. if (arr.length === 2) {
  42008. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  42009. }
  42010. if (arr.length === 1) {
  42011. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  42012. }
  42013. }
  42014. }
  42015. this.eventCount = 0;
  42016. }
  42017. /**
  42018. * @function destroy
  42019. * @description 释放资源,将引用的资源属性置空。
  42020. */
  42021. destroy() {
  42022. super.destroy();
  42023. var me = this;
  42024. if (me.events) {
  42025. me.events.un(me.eventListeners);
  42026. me.events.listeners = null;
  42027. me.events.destroy();
  42028. me.events = null;
  42029. me.eventListeners = null;
  42030. }
  42031. }
  42032. /**
  42033. * @function MapService.prototype.processAsync
  42034. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  42035. */
  42036. processAsync(callback) {
  42037. let eventId = ++this.eventCount;
  42038. let eventListeners = {
  42039. scope: this,
  42040. processCompleted: function(result) {
  42041. if (eventId === result.result.eventId && callback) {
  42042. delete result.result.eventId;
  42043. callback(result);
  42044. this.events && this.events.un(eventListeners);
  42045. return false;
  42046. }
  42047. },
  42048. processFailed: function(result) {
  42049. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  42050. callback(result);
  42051. this.events && this.events.un(eventListeners);
  42052. return false;
  42053. }
  42054. }
  42055. }
  42056. this.events.on(eventListeners);
  42057. var me = this;
  42058. me.request({
  42059. method: "GET",
  42060. scope: me,
  42061. success(result, options) {
  42062. result.eventId = eventId;
  42063. this.serviceProcessCompleted(result, options);
  42064. },
  42065. failure(result, options) {
  42066. if (result.error) {
  42067. result.error.eventId = eventId;
  42068. }
  42069. result.eventId = eventId;
  42070. this.serviceProcessFailed(result, options);
  42071. }
  42072. });
  42073. }
  42074. /*
  42075. * Method: getMapStatusCompleted
  42076. * 获取地图状态完成,执行此方法。
  42077. *
  42078. * Parameters:
  42079. * {Object} result - 服务器返回的结果对象。
  42080. */
  42081. serviceProcessCompleted(result, options) {
  42082. var me = this;
  42083. result = Util_Util.transformResult(result);
  42084. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  42085. var isCodeValid = result.code && codeStatus;
  42086. if (!result.code || isCodeValid) {
  42087. me.events && me.events.triggerEvent("processCompleted", {result: result, options});
  42088. } else {
  42089. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  42090. me.events.triggerEvent("processFailed", {error: result, options});
  42091. }
  42092. }
  42093. }
  42094. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  42095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42096. * This program are made available under the terms of the Apache License, Version 2.0
  42097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42098. /**
  42099. * @class MathExpressionAnalysisParameters
  42100. * @deprecatedclass SuperMap.MathExpressionAnalysisParameters
  42101. * @category iServer SpatialAnalyst GridMathAnalyst
  42102. * @classdesc 栅格代数运算参数类。
  42103. * @param {Object} options - 参数。
  42104. * @param {string} options.dataset - 指定栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  42105. * @param {string} options.resultGridName - 指定结果数据集名称。
  42106. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  42107. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  42108. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  42109. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  42110. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  42111. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  42112. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  42113. * @usage
  42114. */
  42115. class MathExpressionAnalysisParameters {
  42116. constructor(options) {
  42117. if (!options) {
  42118. return;
  42119. }
  42120. /**
  42121. * @member {string} MathExpressionAnalysisParameters.prototype.dataset
  42122. * @description 要用来做栅格代数运算数据源中数据集的名称。
  42123. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  42124. *
  42125. */
  42126. this.dataset = null;
  42127. /**
  42128. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [MathExpressionAnalysisParameters.prototype.extractRegion]
  42129. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  42130. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  42131. */
  42132. this.extractRegion = null;
  42133. /**
  42134. * @member {string} MathExpressionAnalysisParameters.prototype.expression
  42135. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  42136. */
  42137. this.expression = null;
  42138. /**
  42139. * @member {boolean} [MathExpressionAnalysisParameters.prototype.isZip=false]
  42140. * @description 是否对结果数据集进行压缩处理。
  42141. */
  42142. this.isZip = false;
  42143. /**
  42144. * @member {boolean} [MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  42145. * @description 是否忽略无值栅格数据。
  42146. */
  42147. this.ignoreNoValue = false;
  42148. /**
  42149. * @member {string} MathExpressionAnalysisParameters.prototype.targetDatasource
  42150. * @description 指定存储结果数据集的数据源。
  42151. */
  42152. this.targetDatasource = null;
  42153. /**
  42154. * @member {string} MathExpressionAnalysisParameters.prototype.resultGridName
  42155. * @description 指定结果数据集名称。
  42156. */
  42157. this.resultGridName = null;
  42158. /**
  42159. * @member {boolean} [MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  42160. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  42161. */
  42162. this.deleteExistResultDataset = false;
  42163. Util_Util.extend(this, options);
  42164. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  42165. }
  42166. /**
  42167. * @function MathExpressionAnalysisParameters.prototype.destroy
  42168. * @description 释放资源,将引用资源的属性置空。
  42169. */
  42170. destroy() {
  42171. var me = this;
  42172. me.dataset = null;
  42173. me.bounds = null;
  42174. me.expression = null;
  42175. me.isZip = true;
  42176. me.ignoreNoValue = true;
  42177. me.targetDatasource = null;
  42178. me.resultGridName = null;
  42179. me.deleteExistResultDataset = null;
  42180. }
  42181. /**
  42182. * @function MathExpressionAnalysisParameters.toObject
  42183. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  42184. * @param {Object} tempObj - 目标对象。
  42185. * @description 生成栅格代数运算对象。
  42186. */
  42187. static toObject(mathExpressionAnalysisParameters, tempObj) {
  42188. for (var name in mathExpressionAnalysisParameters) {
  42189. if (name !== "dataset") {
  42190. tempObj[name] = mathExpressionAnalysisParameters[name];
  42191. }
  42192. if (name === "extractRegion") {
  42193. if (mathExpressionAnalysisParameters[name]) {
  42194. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  42195. var region = {},
  42196. points = [],
  42197. type = "REGION";
  42198. var len = bs.length;
  42199. for (var i = 0; i < len - 1; i++) {
  42200. var poi = {};
  42201. poi["x"] = bs[i].x;
  42202. poi["y"] = bs[i].y;
  42203. points.push(poi);
  42204. }
  42205. region["points"] = points;
  42206. region["type"] = type;
  42207. tempObj[name] = region;
  42208. }
  42209. }
  42210. }
  42211. }
  42212. }
  42213. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  42214. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42215. * This program are made available under the terms of the Apache License, Version 2.0
  42216. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42217. /**
  42218. * @class MathExpressionAnalysisService
  42219. * @deprecatedclass SuperMap.MathExpressionAnalysisService
  42220. * @category iServer SpatialAnalyst GridMathAnalyst
  42221. * @classdesc 栅格代数运算服务类。
  42222. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  42223. * @param {Object} options - 参数。
  42224. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  42225. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42226. * @param {Object} [options.headers] - 请求头。
  42227. * @extends {SpatialAnalystBase}
  42228. * @example 例如:
  42229. * (start code)
  42230. * var myMathExpressionAnalysisService = new MathExpressionAnalysisService(url);
  42231. * myMathExpressionAnalysisService.on({
  42232. * "processCompleted": processCompleted,
  42233. * "processFailed": processFailed
  42234. * }
  42235. * );
  42236. * (end)
  42237. * @usage
  42238. */
  42239. class MathExpressionAnalysisService extends SpatialAnalystBase {
  42240. constructor(url, options) {
  42241. super(url, options);
  42242. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  42243. }
  42244. /**
  42245. * @override
  42246. */
  42247. destroy() {
  42248. super.destroy();
  42249. }
  42250. /**
  42251. * @function MathExpressionAnalysisService.prototype.processAsync
  42252. * @description 负责将客户端的查询参数传递到服务端。
  42253. * @param {MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  42254. */
  42255. processAsync(parameter) {
  42256. var me = this;
  42257. var parameterObject = {};
  42258. if (parameter instanceof MathExpressionAnalysisParameters) {
  42259. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  42260. }
  42261. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  42262. var jsonParameters = Util_Util.toJSON(parameterObject);
  42263. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  42264. me.request({
  42265. method: "POST",
  42266. data: jsonParameters,
  42267. scope: me,
  42268. success: me.serviceProcessCompleted,
  42269. failure: me.serviceProcessFailed
  42270. });
  42271. }
  42272. }
  42273. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  42274. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42275. * This program are made available under the terms of the Apache License, Version 2.0
  42276. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42277. /**
  42278. * @class MeasureParameters
  42279. * @deprecatedclass SuperMap.MeasureParameters
  42280. * @category iServer Map Measure
  42281. * @classdesc 量算参数类。
  42282. * @param {GeoJSONObject} geometry - 要量算的几何对象。
  42283. * @param {Object} options - 可选参数。
  42284. * @param {Unit} [options.unit=Unit.METER] - 量算单位。
  42285. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  42286. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  42287. * @usage
  42288. */
  42289. class MeasureParameters {
  42290. constructor(geometry, options) {
  42291. if (!geometry) {
  42292. return;
  42293. }
  42294. /**
  42295. * @member {GeoJSONObject} MeasureParameters.prototype.geometry
  42296. * @description 要量算的几何对象。<br>
  42297. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  42298. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  42299. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。
  42300. */
  42301. this.geometry = geometry;
  42302. /**
  42303. * @member {Unit} [MeasureParameters.prototype.unit=Unit.METER]
  42304. * @description 量算单位。即量算结果以米为单位。
  42305. */
  42306. this.unit = Unit.METER;
  42307. /**
  42308. * @member {string} [MeasureParameters.prototype.prjCoordSys]
  42309. * @description 用来指定该量算操作所使用的投影。
  42310. */
  42311. this.prjCoordSys = null;
  42312. /**
  42313. * @member {string} [MeasureParameters.prototype.distanceMode="Geodesic"]
  42314. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  42315. * @example
  42316. * var param = new MeasureParameters(getmetry,{distanceMode:'Planar'});
  42317. */
  42318. this.distanceMode = null;
  42319. if (options) {
  42320. Util_Util.extend(this, options);
  42321. }
  42322. this.CLASS_NAME = "SuperMap.MeasureParameters";
  42323. }
  42324. /**
  42325. * @function MeasureParameters.prototype.destroy
  42326. * @description 释放资源,将引用资源的属性置空。
  42327. */
  42328. destroy() {
  42329. var me = this;
  42330. me.geometry = null;
  42331. me.unit = null;
  42332. me.prjCoordSys = null;
  42333. }
  42334. }
  42335. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  42336. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42337. * This program are made available under the terms of the Apache License, Version 2.0
  42338. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42339. /**
  42340. * @class MeasureService
  42341. * @deprecatedclass SuperMap.MeasureService
  42342. * @category iServer Map Measure
  42343. * @classdesc 量算服务类。
  42344. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  42345. * @extends {CommonServiceBase}
  42346. * @example
  42347. * var myMeasuerService = new MeasureService(url, {
  42348. * measureMode: MeasureMode.DISTANCE,
  42349. * eventListeners:{
  42350. * "processCompleted": measureCompleted
  42351. * }
  42352. * });
  42353. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  42354. * @param {Object} options - 参数。
  42355. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  42356. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  42357. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42358. * @param {Object} [options.headers] - 请求头。
  42359. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  42360. * @usage
  42361. */
  42362. class MeasureService extends CommonServiceBase {
  42363. constructor(url, options) {
  42364. super(url, options);
  42365. /**
  42366. * @member {MeasureMode} [MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  42367. * @description 量算模式,包括距离量算模式和面积量算模式。
  42368. */
  42369. this.measureMode = MeasureMode.DISTANCE;
  42370. if (options) {
  42371. Util_Util.extend(this, options);
  42372. }
  42373. this.eventCount = 0;
  42374. this.CLASS_NAME = "SuperMap.MeasureService";
  42375. }
  42376. /**
  42377. * @override
  42378. */
  42379. destroy() {
  42380. super.destroy();
  42381. var me = this;
  42382. me.measureMode = null;
  42383. }
  42384. /**
  42385. * @function MeasureService.prototype.processAsync
  42386. * @description 负责将客户端的量算参数传递到服务端。
  42387. * @param {MeasureParameters} params - 量算参数。
  42388. */
  42389. processAsync(params, callback) {
  42390. if (!(params instanceof MeasureParameters)) {
  42391. return;
  42392. }
  42393. let eventId = ++this.eventCount;
  42394. let eventListeners = {
  42395. scope: this,
  42396. processCompleted: function(result) {
  42397. if (eventId === result.result.eventId && callback) {
  42398. delete result.result.eventId;
  42399. callback(result);
  42400. this.events && this.events.un(eventListeners);
  42401. return false;
  42402. }
  42403. },
  42404. processFailed: function(result) {
  42405. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  42406. callback(result);
  42407. this.events && this.events.un(eventListeners);
  42408. return false;
  42409. }
  42410. }
  42411. }
  42412. this.events.on(eventListeners);
  42413. var me = this,
  42414. geometry = params.geometry,
  42415. pointsCount = 0,
  42416. point2ds = null;
  42417. if (!geometry) {
  42418. return;
  42419. }
  42420. me.url = Util_Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  42421. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  42422. if (!serverGeometry) {
  42423. return;
  42424. }
  42425. pointsCount = serverGeometry.parts[0];
  42426. point2ds = serverGeometry.points.splice(0, pointsCount);
  42427. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  42428. if (params.prjCoordSys) {
  42429. if (typeof (params.prjCoordSys) === "object") {
  42430. prjCodeTemp = params.prjCoordSys.projCode;
  42431. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  42432. } else if (typeof (params.prjCoordSys) === "string") {
  42433. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  42434. }
  42435. paramsTemp = {
  42436. "point2Ds": Util_Util.toJSON(point2ds),
  42437. "unit": params.unit,
  42438. "prjCoordSys": prjCoordSysTemp,
  42439. "distanceMode": params.distanceMode || 'Geodesic'
  42440. };
  42441. } else {
  42442. paramsTemp = {"point2Ds": Util_Util.toJSON(point2ds), "unit": params.unit, "distanceMode": params.distanceMode || 'Geodesic'};
  42443. }
  42444. me.request({
  42445. method: "GET",
  42446. params: paramsTemp,
  42447. scope: me,
  42448. success(result, options) {
  42449. result.eventId = eventId;
  42450. this.serviceProcessCompleted(result, options);
  42451. },
  42452. failure(result, options) {
  42453. if (result.error) {
  42454. result.error.eventId = eventId;
  42455. }
  42456. result.eventId = eventId;
  42457. this.serviceProcessFailed(result, options);
  42458. }
  42459. });
  42460. }
  42461. }
  42462. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  42463. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42464. * This program are made available under the terms of the Apache License, Version 2.0
  42465. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42466. /**
  42467. * @class OverlapDisplayedOptions
  42468. * @deprecatedclass SuperMap.OverlapDisplayedOptions
  42469. * @category iServer Map Layer
  42470. * @classdesc 地图压盖过滤显示选项。在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  42471. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  42472. * @param {Object} options - 可选参数。
  42473. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  42474. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  42475. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  42476. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  42477. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  42478. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  42479. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  42480. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  42481. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  42482. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  42483. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  42484. * @usage
  42485. */
  42486. class OverlapDisplayedOptions {
  42487. constructor(options) {
  42488. options = options || {};
  42489. /**
  42490. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  42491. * @description 点和点压盖时是否显示压盖的点对象。
  42492. */
  42493. this.allowPointOverlap = true;
  42494. /**
  42495. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  42496. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  42497. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  42498. */
  42499. this.allowPointWithTextDisplay = true;
  42500. /**
  42501. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  42502. * @description 文本压盖时是否显示压盖的文本对象。
  42503. */
  42504. this.allowTextOverlap = false;
  42505. /**
  42506. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  42507. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  42508. */
  42509. this.allowTextAndPointOverlap = true;
  42510. /**
  42511. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  42512. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  42513. */
  42514. this.allowThemeGraduatedSymbolOverlap = false;
  42515. /**
  42516. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  42517. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  42518. */
  42519. this.allowThemeGraphOverlap = false;
  42520. /**
  42521. * @member {number} [OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  42522. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  42523. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  42524. */
  42525. this.horizontalOverlappedSpaceSize = 0;
  42526. /**
  42527. * @member {number} [OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  42528. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  42529. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  42530. */
  42531. this.verticalOverlappedSpaceSize = 0;
  42532. Util_Util.extend(this, options);
  42533. this.ugcLayer = new UGCLayer(options);
  42534. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  42535. }
  42536. /**
  42537. * @function OverlapDisplayedOptions.prototype.destroy
  42538. * @description 释放资源,将资源的属性置空。
  42539. */
  42540. destroy() {
  42541. Util_Util.reset(this);
  42542. }
  42543. /**
  42544. * @function OverlapDisplayedOptions.prototype.fromJson
  42545. * @description 将服务端 JSON 对象转换成当前客户端对象。
  42546. * @param {Object} jsonObject - 要转换的 JSON 对象。
  42547. */
  42548. fromJson(jsonObject) {
  42549. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  42550. }
  42551. /**
  42552. * @function OverlapDisplayedOptions.prototype.toServerJSONObject
  42553. * @description 转换成对应的 JSON 格式对象。
  42554. * @returns {Object} 对应的 JSON 格式对象。
  42555. */
  42556. toServerJSONObject() {
  42557. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  42558. return jsonObject;
  42559. }
  42560. /**
  42561. * @function OverlapDisplayedOptions.prototype.toString
  42562. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  42563. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  42564. */
  42565. toString() {
  42566. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  42567. var str = "{";
  42568. for (var attr in jsonObject) {
  42569. if (jsonObject.hasOwnProperty(attr)) {
  42570. str += "'" + attr + "':" + jsonObject[attr] + ",";
  42571. }
  42572. }
  42573. str = str.substr(0, str.length - 1);
  42574. str += "}";
  42575. return str;
  42576. }
  42577. }
  42578. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  42579. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42580. * This program are made available under the terms of the Apache License, Version 2.0
  42581. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42582. /**
  42583. * @class OverlayAnalystService
  42584. * @deprecatedclass SuperMap.OverlayAnalystService
  42585. * @category iServer SpatialAnalyst OverlayAnalyst
  42586. * @classdesc 叠加分析服务类。
  42587. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  42588. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  42589. * @param {string} url - 服务地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  42590. * @param {Object} options - 参数。
  42591. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  42592. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42593. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  42594. * @param {Object} [options.headers] - 请求头。
  42595. * @extends {CommonServiceBase}
  42596. * @example 例如:
  42597. * (start code)
  42598. * var myOverlayAnalystService = new OverlayAnalystService(url, {
  42599. * eventListeners: {
  42600. * "processCompleted": OverlayCompleted,
  42601. * "processFailed": OverlayFailed
  42602. * }
  42603. * });
  42604. * (end)
  42605. * @usage
  42606. */
  42607. class OverlayAnalystService extends SpatialAnalystBase {
  42608. constructor(url, options) {
  42609. super(url, options);
  42610. /**
  42611. * @member {string} OverlayAnalystService.prototype.mode
  42612. * @description 叠加分析类型
  42613. */
  42614. this.mode = null;
  42615. if (options) {
  42616. Util_Util.extend(this, options);
  42617. }
  42618. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  42619. }
  42620. /**
  42621. * @override
  42622. */
  42623. destroy() {
  42624. super.destroy();
  42625. this.mode = null;
  42626. }
  42627. /**
  42628. * @function OverlayAnalystService.prototype.processAsync
  42629. * @description 负责将客户端的查询参数传递到服务端。
  42630. * @param {OverlayAnalystParameters} parameter - 叠加分析参数类。
  42631. */
  42632. processAsync(parameter) {
  42633. var parameterObject = {};
  42634. var me = this;
  42635. if (parameter instanceof DatasetOverlayAnalystParameters) {
  42636. me.mode = "datasets";
  42637. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  42638. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  42639. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  42640. me.mode = "geometry";
  42641. //支持传入多个几何要素进行叠加分析
  42642. if(parameter.operateGeometries && parameter.sourceGeometries){
  42643. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  42644. me.url = Util_Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  42645. }else {
  42646. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay');
  42647. }
  42648. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  42649. }
  42650. this.returnContent = true;
  42651. var jsonParameters = Util_Util.toJSON(parameterObject);
  42652. me.request({
  42653. method: "POST",
  42654. data: jsonParameters,
  42655. scope: me,
  42656. success: me.serviceProcessCompleted,
  42657. failure: me.serviceProcessFailed
  42658. });
  42659. }
  42660. dataFormat() {
  42661. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  42662. }
  42663. }
  42664. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  42665. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42666. * This program are made available under the terms of the Apache License, Version 2.0
  42667. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42668. /**
  42669. * @class OverlayGeoJobParameter
  42670. * @deprecatedclass SuperMap.OverlayGeoJobParameter
  42671. * @category iServer ProcessingService OverlayAnalyst
  42672. * @classdesc 叠加分析任务参数类。
  42673. * @param {Object} options - 参数。
  42674. * @param {string} options.datasetName - 数据集名。
  42675. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  42676. * @param {string} options.srcFields - 输入数据需要保留的字段。
  42677. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  42678. * @param {string} [options.mode] - 叠加分析模式。
  42679. * @param {OutputSetting} [options.output] - 输出参数设置。
  42680. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  42681. * @usage
  42682. */
  42683. class OverlayGeoJobParameter {
  42684. constructor(options) {
  42685. if (!options) {
  42686. return;
  42687. }
  42688. /**
  42689. * @member {string} OverlayGeoJobParameter.prototype.datasetName
  42690. * @description 数据集名。
  42691. */
  42692. this.datasetName = "";
  42693. /**
  42694. * @member {string} OverlayGeoJobParameter.prototype.datasetOverlay
  42695. * @description 叠加对象所在的数据集名称。
  42696. */
  42697. this.datasetOverlay = "";
  42698. /**
  42699. * @member {string} [OverlayGeoJobParameter.prototype.mode]
  42700. * @description 叠加分析模式。
  42701. */
  42702. this.mode = "";
  42703. /**
  42704. * @member {string} OverlayGeoJobParameter.prototype.srcFields
  42705. * @description 输入数据需要保留的字段。
  42706. */
  42707. this.srcFields = "";
  42708. /**
  42709. * @member {string} OverlayGeoJobParameter.prototype.overlayFields
  42710. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  42711. */
  42712. this.overlayFields = "";
  42713. /**
  42714. * @member {OutputSetting} [OverlayGeoJobParameter.prototype.output]
  42715. * @description 输出参数设置类。
  42716. */
  42717. this.output = null;
  42718. /**
  42719. * @member {MappingParameters} [OverlayGeoJobParameter.prototype.mappingParameters]
  42720. * @description 分析后结果可视化的参数类。
  42721. */
  42722. this.mappingParameters = null;
  42723. Util_Util.extend(this, options);
  42724. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  42725. }
  42726. /**
  42727. * @function OverlayGeoJobParameter.prototype.destroy
  42728. * @description 释放资源,将资源的属性置空。
  42729. */
  42730. destroy() {
  42731. this.datasetName = null;
  42732. this.datasetOverlay = null;
  42733. this.mode = null;
  42734. this.srcFields = null;
  42735. this.overlayFields = null;
  42736. if (this.output instanceof OutputSetting) {
  42737. this.output.destroy();
  42738. this.output = null;
  42739. }
  42740. if (this.mappingParameters instanceof MappingParameters) {
  42741. this.mappingParameters.destroy();
  42742. this.mappingParameters = null;
  42743. }
  42744. }
  42745. /**
  42746. * @function OverlayGeoJobParameter.toObject
  42747. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  42748. * @param {Object} tempObj - 目标对象。
  42749. * @description 生成点聚合分析任务对象。
  42750. */
  42751. static toObject(OverlayGeoJobParameter, tempObj) {
  42752. for (var name in OverlayGeoJobParameter) {
  42753. if (name == "datasetName") {
  42754. tempObj['input'] = tempObj['input'] || {};
  42755. tempObj['input'][name] = OverlayGeoJobParameter[name];
  42756. continue;
  42757. }
  42758. if (name === "output") {
  42759. tempObj['output'] = tempObj['output'] || {};
  42760. tempObj['output'] = OverlayGeoJobParameter[name];
  42761. continue;
  42762. }
  42763. tempObj['analyst'] = tempObj['analyst'] || {};
  42764. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  42765. if(name === 'mappingParameters'){
  42766. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  42767. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  42768. }
  42769. }
  42770. }
  42771. }
  42772. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  42773. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42774. * This program are made available under the terms of the Apache License, Version 2.0
  42775. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42776. /**
  42777. * @class OverlayGeoJobsService
  42778. * @deprecatedclass SuperMap.OverlayGeoJobsService
  42779. * @category iServer ProcessingService OverlayAnalyst
  42780. * @classdesc 叠加分析任务类。
  42781. * @param {string} url - 服务地址。
  42782. * @param {Object} options - 参数。
  42783. * @param {Events} options.events - 处理所有事件的对象。
  42784. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  42785. * @param {number} options.index - 服务访问地址在数组中的位置。
  42786. * @param {number} options.length - 服务访问地址数组长度。
  42787. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42788. * @param {Object} [options.headers] - 请求头。
  42789. * @usage
  42790. */
  42791. class OverlayGeoJobsService extends ProcessingServiceBase {
  42792. constructor(url, options) {
  42793. super(url, options);
  42794. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  42795. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  42796. }
  42797. /**
  42798. * @override
  42799. */
  42800. destroy() {
  42801. super.destroy();
  42802. }
  42803. /**
  42804. * @function OverlayGeoJobsService.prototype.getOverlayGeoJobs
  42805. * @description 获取叠加分析任务
  42806. */
  42807. getOverlayGeoJobs() {
  42808. super.getJobs(this.url);
  42809. }
  42810. /**
  42811. * @function OverlayGeoJobsService.prototype.getOverlayGeoJob
  42812. * @description 获取指定id的叠加分析任务
  42813. * @param {string} id - 指定要获取数据的id
  42814. */
  42815. getOverlayGeoJob(id) {
  42816. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  42817. }
  42818. /**
  42819. * @function OverlayGeoJobsService.prototype.addOverlayGeoJob
  42820. * @description 新建点叠加析服务
  42821. * @param {OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  42822. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  42823. */
  42824. addOverlayGeoJob(params, seconds) {
  42825. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  42826. }
  42827. }
  42828. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  42829. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42830. * This program are made available under the terms of the Apache License, Version 2.0
  42831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42832. /**
  42833. * @class QueryByBoundsParameters
  42834. * @deprecatedclass SuperMap.QueryByBoundsParameters
  42835. * @category iServer Map QueryResults
  42836. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  42837. * @extends {QueryParameters}
  42838. * @param {Object} options - 参数。
  42839. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 指定的查询范围。
  42840. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  42841. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  42842. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  42843. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  42844. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  42845. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  42846. * @param {number} [options.startRecord=0] - 查询起始记录号。
  42847. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  42848. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  42849. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  42850. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  42851. * @usage
  42852. */
  42853. class QueryByBoundsParameters extends QueryParameters {
  42854. constructor(options) {
  42855. options = options || {};
  42856. super(options);
  42857. /**
  42858. * @member {boolean} [QueryByBoundsParameters.prototype.returnContent=true]
  42859. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  42860. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  42861. * 为 false,则返回的是查询结果资源的 URI。
  42862. */
  42863. this.returnContent = true;
  42864. /**
  42865. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} QueryByBoundsParameters.prototype.bounds
  42866. * @description 指定的查询范围。
  42867. */
  42868. this.bounds = null;
  42869. Util_Util.extend(this, options);
  42870. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  42871. }
  42872. /**
  42873. * @function QueryByBoundsParameters.prototype.destroy
  42874. * @description 释放资源,将引用资源的属性置空。
  42875. */
  42876. destroy() {
  42877. super.destroy();
  42878. var me = this;
  42879. me.returnContent = null;
  42880. if (me.bounds) {
  42881. me.bounds = null;
  42882. }
  42883. }
  42884. }
  42885. ;// CONCATENATED MODULE: ./src/common/iServer/QueryServiceBase.js
  42886. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42887. * This program are made available under the terms of the Apache License, Version 2.0
  42888. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42889. /**
  42890. * @class QueryService
  42891. * @deprecatedclass SuperMap.QueryService
  42892. * @category iServer Map QueryResults
  42893. * @classdesc 查询服务基类。
  42894. * @extends {CommonServiceBase}
  42895. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  42896. * @param {Object} options - 参数。
  42897. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  42898. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  42899. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42900. * @param {Object} [options.headers] - 请求头。
  42901. * @example
  42902. * var myService = new QueryService(url, {
  42903. * eventListeners: {
  42904. * "processCompleted": queryCompleted,
  42905. * "processFailed": queryError
  42906. * }
  42907. * };
  42908. * @usage
  42909. */
  42910. class QueryServiceBase extends CommonServiceBase {
  42911. constructor(url, options) {
  42912. super(url, options);
  42913. /**
  42914. * @member {boolean} QueryService.prototype.returnContent
  42915. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  42916. */
  42917. this.returnContent = false;
  42918. /**
  42919. * @member {string} QueryService.prototype.format
  42920. * @description 查询结果返回格式,目前支持iServerJSON、GeoJSON、FGB三种格式。参数格式为"ISERVER","GEOJSON","FGB"。
  42921. */
  42922. this.format = DataFormat.GEOJSON;
  42923. this.returnFeatureWithFieldCaption = false;
  42924. if (options) {
  42925. Util_Util.extend(this, options);
  42926. }
  42927. this.CLASS_NAME = "SuperMap.QueryService";
  42928. if (!this.url) {
  42929. return;
  42930. }
  42931. if (options && options.format) {
  42932. this.format = options.format.toUpperCase();
  42933. }
  42934. this.url = Util_Util.urlPathAppend(this.url,'queryResults');
  42935. }
  42936. /**
  42937. * @function QueryService.prototype.destroy
  42938. * @description 释放资源,将引用资源的属性置空。
  42939. */
  42940. destroy() {
  42941. super.destroy();
  42942. var me = this;
  42943. me.returnContent = null;
  42944. me.format = null;
  42945. }
  42946. /**
  42947. * @function QueryService.prototype.processAsync
  42948. * @description 负责将客户端的查询参数传递到服务端。
  42949. * @param {QueryParameters} params - 查询参数。
  42950. */
  42951. processAsync(params) {
  42952. if (!(params instanceof QueryParameters)) {
  42953. return;
  42954. }
  42955. var me = this,
  42956. returnCustomResult = null,
  42957. jsonParameters = null;
  42958. me.returnContent = params.returnContent;
  42959. jsonParameters = me.getJsonParameters(params);
  42960. if (!me.returnContent) {
  42961. //仅供三维使用 获取高亮图片的bounds
  42962. returnCustomResult = params.returnCustomResult;
  42963. if (returnCustomResult) {
  42964. me.url = Util_Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  42965. }
  42966. }
  42967. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  42968. me.request({
  42969. method: "POST",
  42970. data: jsonParameters,
  42971. scope: me,
  42972. success: me.serviceProcessCompleted,
  42973. failure: me.serviceProcessFailed
  42974. });
  42975. }
  42976. /**
  42977. * @function QueryService.prototype.serviceProcessCompleted
  42978. * @description 查询完成,执行此方法。
  42979. * @param {Object} result - 服务器返回的结果对象。
  42980. */
  42981. serviceProcessCompleted(result, options) {
  42982. var me = this;
  42983. result = Util_Util.transformResult(result);
  42984. var geoJSONFormat = new GeoJSON();
  42985. if (result && result.recordsets) {
  42986. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  42987. if (recordsets[i].features) {
  42988. if (me.returnFeatureWithFieldCaption === true) {
  42989. recordsets[i].features.map((feature) => {
  42990. feature.fieldNames = recordsets[i].fieldCaptions;
  42991. return feature;
  42992. })
  42993. }
  42994. if (me.format === DataFormat.GEOJSON) {
  42995. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  42996. }
  42997. }
  42998. }
  42999. }
  43000. me.events.triggerEvent("processCompleted", {
  43001. result: result,
  43002. options
  43003. });
  43004. }
  43005. dataFormat() {
  43006. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  43007. }
  43008. /**
  43009. * @function QueryService.prototype.getQueryParameters
  43010. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  43011. * @param {Object} params - JSON 字符串表示的查询参数。
  43012. * @returns {QueryParameters} 返回转化后的 QueryParameters 对象。
  43013. */
  43014. getQueryParameters(params) {
  43015. return new QueryParameters({
  43016. customParams: params.customParams,
  43017. expectCount: params.expectCount,
  43018. networkType: params.networkType,
  43019. queryOption: params.queryOption,
  43020. queryParams: params.queryParams,
  43021. startRecord: params.startRecord,
  43022. prjCoordSys: params.prjCoordSys,
  43023. holdTime: params.holdTime
  43024. });
  43025. }
  43026. }
  43027. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  43028. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43029. * This program are made available under the terms of the Apache License, Version 2.0
  43030. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43031. /**
  43032. * @class QueryByBoundsService
  43033. * @deprecatedclass SuperMap.QueryByBoundsService
  43034. * @category iServer Map QueryResults
  43035. * @classdesc Bounds 查询服务类。
  43036. * @augments {QueryService}
  43037. * @example
  43038. * (start end)
  43039. * var myQueryByBoundsService = new QueryByBoundsService(url, {
  43040. * eventListeners: {
  43041. * "processCompleted": queryCompleted,
  43042. * "processFailed": queryError
  43043. * }
  43044. * });
  43045. * function queryCompleted(object){//todo};
  43046. * function queryError(object){//todo};
  43047. * (end)
  43048. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  43049. * @param {Object} options - 参数。
  43050. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  43051. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  43052. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43053. * @param {Object} [options.headers] - 请求头。
  43054. * @usage
  43055. */
  43056. class QueryByBoundsService extends QueryServiceBase {
  43057. constructor(url, options) {
  43058. super(url, options);
  43059. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  43060. }
  43061. /**
  43062. * @override
  43063. */
  43064. destroy() {
  43065. super.destroy();
  43066. }
  43067. /**
  43068. * @function QueryByBoundsService.prototype.getJsonParameters
  43069. * @description 将查询参数转化为 JSON 字符串。
  43070. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  43071. * @param {QueryByBoundsParameters} params - Bounds 查询参数。
  43072. * @returns {Object} 转化后的 JSON 字符串。
  43073. */
  43074. getJsonParameters(params) {
  43075. if (!(params instanceof QueryByBoundsParameters)) {
  43076. return null;
  43077. }
  43078. var me = this,
  43079. jsonParameters = "",
  43080. qp = null,
  43081. bounds = params.bounds;
  43082. qp = me.getQueryParameters(params);
  43083. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  43084. jsonParameters += Util_Util.toJSON(qp);
  43085. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  43086. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  43087. jsonParameters = "{" + jsonParameters + "}";
  43088. return jsonParameters;
  43089. }
  43090. }
  43091. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  43092. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43093. * This program are made available under the terms of the Apache License, Version 2.0
  43094. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43095. /**
  43096. * @class QueryByDistanceParameters
  43097. * @deprecatedclass SuperMap.QueryByDistanceParameters
  43098. * @category iServer Map QueryResults
  43099. * @classdesc Distance 查询参数类。
  43100. * 该类用于设置 Distance 查询的相关参数。
  43101. * @extends {QueryParameters}
  43102. * @param {Object} options - 参数。
  43103. * @param {GeoJSONObject} options.geometry - 用于查询的几何对象。
  43104. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  43105. * @param {number} options.distance - 查询距离,单位与所查询图层对应的数据集单位相同。距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。此为必选参数。
  43106. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  43107. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  43108. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  43109. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  43110. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  43111. * @param {number} [options.startRecord=0] - 查询起始记录号。
  43112. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  43113. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  43114. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  43115. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  43116. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  43117. * @usage
  43118. */
  43119. class QueryByDistanceParameters extends QueryParameters {
  43120. constructor(options) {
  43121. options = options || {};
  43122. super(options);
  43123. /**
  43124. * @member {number} [QueryByDistanceParameters.prototype.distance=0]
  43125. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  43126. * 距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。
  43127. */
  43128. /**
  43129. * @member {GeoJSONObject} QueryByDistanceParameters.prototype.geometry
  43130. * @description 用于查询的地理对象。<br>
  43131. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  43132. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  43133. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  43134. */
  43135. this.geometry = null;
  43136. /**
  43137. * @member {boolean} [QueryByDistanceParameters.prototype.isNearest=false]
  43138. * @description 是否为最近距离查询。<br>
  43139. * 建议该属性与 expectCount(继承自 {@link QueryParameters})属性联合使用。
  43140. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  43141. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  43142. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  43143. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  43144. * 目前查询结果不支持按远近距离排序。
  43145. */
  43146. this.isNearest = null;
  43147. /**
  43148. * @member {boolean} [QueryByDistanceParameters.prototype.returnContent=true]
  43149. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  43150. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  43151. * 为 false,则返回的是查询结果资源的 URI。
  43152. */
  43153. this.returnContent = true;
  43154. Util_Util.extend(this, options);
  43155. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  43156. }
  43157. /**
  43158. * @function QueryByDistanceParameters.prototype.destroy
  43159. * @description 释放资源,将引用资源的属性置空。
  43160. */
  43161. destroy() {
  43162. super.destroy();
  43163. var me = this;
  43164. me.returnContent = null;
  43165. me.distance = null;
  43166. me.isNearest = null;
  43167. if (me.geometry) {
  43168. me.geometry.destroy();
  43169. me.geometry = null;
  43170. }
  43171. }
  43172. }
  43173. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  43174. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43175. * This program are made available under the terms of the Apache License, Version 2.0
  43176. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43177. /**
  43178. * @class QueryByDistanceService
  43179. * @deprecatedclass SuperMap.QueryByDistanceService
  43180. * @category iServer Map QueryResults
  43181. * @classdesc Distance查询服务类。
  43182. * @extends {QueryServiceBase}
  43183. * @example
  43184. * var myQueryByDistService = new QueryByDistanceService(url, {
  43185. * eventListeners: {
  43186. * "processCompleted": queryCompleted,
  43187. * "processFailed": queryError
  43188. * }
  43189. * });
  43190. * function queryCompleted(object){//todo};
  43191. * function queryError(object){//todo};
  43192. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  43193. * @param {Object} options - 参数。
  43194. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  43195. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  43196. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43197. * @param {Object} [options.headers] - 请求头。
  43198. * @usage
  43199. */
  43200. class QueryByDistanceService extends QueryServiceBase {
  43201. constructor(url, options) {
  43202. super(url, options);
  43203. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  43204. }
  43205. /**
  43206. * @override
  43207. */
  43208. destroy() {
  43209. super.destroy();
  43210. }
  43211. /**
  43212. * @function QueryByDistanceService.prototype.getJsonParameters
  43213. * @description 将查询参数转化为 JSON 字符串。
  43214. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  43215. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  43216. * @returns {Object} 转化后的 JSON 字符串。
  43217. */
  43218. getJsonParameters(params) {
  43219. if (!(params instanceof QueryByDistanceParameters)) {
  43220. return;
  43221. }
  43222. var me = this,
  43223. jsonParameters = "",
  43224. qp = me.getQueryParameters(params);
  43225. var sg = ServerGeometry.fromGeometry(params.geometry);
  43226. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  43227. jsonParameters += Util_Util.toJSON(qp);
  43228. jsonParameters += ",'geometry':" + Util_Util.toJSON(sg) + ",'distance':" + params.distance;
  43229. jsonParameters = "{" + jsonParameters + "}";
  43230. return jsonParameters;
  43231. }
  43232. }
  43233. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  43234. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43235. * This program are made available under the terms of the Apache License, Version 2.0
  43236. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43237. /**
  43238. * @class QueryByGeometryParameters
  43239. * @deprecatedclass SuperMap.QueryByGeometryParameters
  43240. * @category iServer Map QueryResults
  43241. * @classdesc Geometry 查询参数类。
  43242. * 该类用于设置 Geometry查询的相关参数。
  43243. * @extends {QueryParameters}
  43244. * @param {Object} options - 参数。
  43245. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  43246. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  43247. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  43248. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  43249. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  43250. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  43251. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  43252. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  43253. * @param {number} [options.startRecord=0] - 查询起始记录号。
  43254. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  43255. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  43256. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  43257. * @param {SpatialQueryMode} [spatialQueryMode=SpatialQueryMode.INTERSECT] - 空间查询模式。
  43258. * @usage
  43259. */
  43260. class QueryByGeometryParameters extends QueryParameters {
  43261. constructor(options) {
  43262. options = options || {};
  43263. super(options);
  43264. /**
  43265. * @member {boolean} [QueryByGeometryParameters.prototype.returnContent=true]
  43266. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  43267. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  43268. * 为 false,则返回的是查询结果资源的 URI。
  43269. */
  43270. this.returnContent = true;
  43271. /**
  43272. * @member {GeoJSONObject} QueryByGeometryParameters.prototype.geometry
  43273. * @description 用于查询的几何对象。<br>
  43274. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  43275. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  43276. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  43277. */
  43278. this.geometry = null;
  43279. /**
  43280. * @member {SpatialQueryMode} [QueryByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.INTERSECT]
  43281. * @description 空间查询模式。
  43282. */
  43283. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  43284. Util_Util.extend(this, options);
  43285. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  43286. }
  43287. /**
  43288. * @function QueryByGeometryParameters.prototype.destroy
  43289. * @description 释放资源,将引用资源的属性置空。
  43290. */
  43291. destroy() {
  43292. super.destroy();
  43293. var me = this;
  43294. me.returnContent = null;
  43295. me.geometry = null;
  43296. me.spatialQueryMode = null;
  43297. }
  43298. }
  43299. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  43300. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43301. * This program are made available under the terms of the Apache License, Version 2.0
  43302. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43303. /**
  43304. * @class QueryByGeometryService
  43305. * @deprecatedclass SuperMap.QueryByGeometryService
  43306. * @category iServer Map QueryResults
  43307. * @classdesc Geometry查询服务类。
  43308. * @extends {QueryServiceBase}
  43309. * @example
  43310. * var myQueryByGeometryService = new QueryByGeometryService(url, {
  43311. * eventListeners: {
  43312. * "processCompleted": queryCompleted,
  43313. * "processFailed": queryError
  43314. * }
  43315. * });
  43316. * function queryCompleted(object){//todo};
  43317. * function queryError(object){//todo};
  43318. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  43319. * @param {Object} options - 参数。
  43320. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  43321. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  43322. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43323. * @param {Object} [options.headers] - 请求头。
  43324. * @usage
  43325. */
  43326. class QueryByGeometryService extends QueryServiceBase {
  43327. constructor(url, options) {
  43328. super(url, options);
  43329. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  43330. }
  43331. /**
  43332. * @override
  43333. */
  43334. destroy() {
  43335. super.destroy();
  43336. }
  43337. /**
  43338. * @function QueryByGeometryService.prototype.getJsonParameters
  43339. * @description 将查询参数转化为 JSON 字符串。
  43340. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  43341. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  43342. * @returns {Object} 转化后的 JSON 字符串。
  43343. */
  43344. getJsonParameters(params) {
  43345. if (!(params instanceof QueryByGeometryParameters)) {
  43346. return;
  43347. }
  43348. var me = this,
  43349. jsonParameters = "",
  43350. qp = null,
  43351. geometry = params.geometry,
  43352. sg = ServerGeometry.fromGeometry(geometry);
  43353. qp = me.getQueryParameters(params);
  43354. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  43355. jsonParameters += Util_Util.toJSON(qp) + ",'geometry':" + Util_Util.toJSON(sg)
  43356. + ",'spatialQueryMode':" + Util_Util.toJSON(params.spatialQueryMode);
  43357. jsonParameters = "{" + jsonParameters + "}";
  43358. return jsonParameters;
  43359. }
  43360. }
  43361. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  43362. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43363. * This program are made available under the terms of the Apache License, Version 2.0
  43364. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43365. /**
  43366. * @class QueryBySQLParameters
  43367. * @deprecatedclass SuperMap.QueryBySQLParameters
  43368. * @category iServer Map QueryResults
  43369. * @classdesc SQL 查询参数类。
  43370. * 该类用于设置 SQL 查询的相关参数。
  43371. * @extends {QueryParameters}
  43372. * @param {Object} options - 参数。
  43373. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  43374. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  43375. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  43376. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  43377. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  43378. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  43379. * @param {number} [options.startRecord=0] - 查询起始记录号。
  43380. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  43381. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  43382. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  43383. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  43384. * @usage
  43385. */
  43386. class QueryBySQLParameters extends QueryParameters {
  43387. constructor(options) {
  43388. options = options || {};
  43389. super(options);
  43390. /**
  43391. * @member {boolean} [QueryBySQLParameters.prototype.returnContent=true]
  43392. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  43393. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  43394. * 为 false,则返回的是查询结果资源的 URI。
  43395. */
  43396. this.returnContent = true;
  43397. Util_Util.extend(this, options);
  43398. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  43399. }
  43400. /**
  43401. * @function QueryBySQLParameters.prototype.destroy
  43402. * @description 释放资源,将引用资源的属性置空。
  43403. */
  43404. destroy() {
  43405. super.destroy();
  43406. var me = this;
  43407. me.returnContent = null;
  43408. }
  43409. }
  43410. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  43411. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43412. * This program are made available under the terms of the Apache License, Version 2.0
  43413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43414. /**
  43415. * @class QueryBySQLService
  43416. * @deprecatedclass SuperMap.QueryBySQLService
  43417. * @category iServer Map QueryResults
  43418. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  43419. * @extends {QueryServiceBase}
  43420. * @example
  43421. * var queryParam = new FilterParameter({
  43422. * name: "Countries@World.1",
  43423. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  43424. * });
  43425. * var queryBySQLParams = new QueryBySQLParameters({
  43426. * queryParams: [queryParam]
  43427. * });
  43428. * var myQueryBySQLService = new QueryBySQLService(url, {eventListeners: {
  43429. * "processCompleted": queryCompleted,
  43430. * "processFailed": queryError
  43431. * }
  43432. * });
  43433. * queryBySQLService.processAsync(queryBySQLParams);
  43434. * function queryCompleted(object){//todo};
  43435. * function queryError(object){//todo};
  43436. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  43437. * @param {Object} options - 参数。
  43438. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  43439. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  43440. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43441. * @param {Object} [options.headers] - 请求头。
  43442. * @usage
  43443. */
  43444. class QueryBySQLService extends QueryServiceBase {
  43445. constructor(url, options) {
  43446. super(url, options);
  43447. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  43448. }
  43449. /**
  43450. * @override
  43451. */
  43452. destroy() {
  43453. super.destroy();
  43454. }
  43455. /**
  43456. * @function QueryBySQLService.prototype.getJsonParameters
  43457. * @description 将查询参数转化为 JSON 字符串。
  43458. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  43459. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  43460. * @returns {Object} 转化后的 JSON 字符串。
  43461. */
  43462. getJsonParameters(params) {
  43463. if (!(params instanceof QueryBySQLParameters)) {
  43464. return;
  43465. }
  43466. var me = this,
  43467. jsonParameters = "",
  43468. qp = null;
  43469. qp = me.getQueryParameters(params);
  43470. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  43471. jsonParameters += Util_Util.toJSON(qp);
  43472. jsonParameters = "{" + jsonParameters + "}";
  43473. return jsonParameters;
  43474. }
  43475. }
  43476. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  43477. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43478. * This program are made available under the terms of the Apache License, Version 2.0
  43479. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43480. /**
  43481. * @class QueryService
  43482. * @category iServer Map QueryResults
  43483. * @classdesc 地图查询服务类。
  43484. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  43485. * @extends {ServiceBase}
  43486. * @param {string} url - 服务地址。
  43487. * @param {Object} options - 参数。
  43488. * @param {string} [options.proxy] - 服务代理地址。
  43489. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43490. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43491. * @param {Object} [options.headers] - 请求头。
  43492. * @example
  43493. * new QueryService(url)
  43494. * .queryByBounds(param,function(result){
  43495. * //doSomething
  43496. * })
  43497. * @usage
  43498. */
  43499. class QueryService {
  43500. constructor(url, options) {
  43501. this.options = options || {};
  43502. this.url = url;
  43503. }
  43504. /**
  43505. * @function QueryService.prototype.queryByBounds
  43506. * @description Bounds 查询地图服务。
  43507. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  43508. * @param {RequestCallback} callback - 回调函数。
  43509. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  43510. */
  43511. queryByBounds(params, callback, resultFormat) {
  43512. var me = this;
  43513. var queryService = new QueryByBoundsService(me.url, {
  43514. proxy: me.options.proxy,
  43515. withCredentials: me.options.withCredentials,
  43516. crossOrigin: me.options.crossOrigin,
  43517. headers: me.options.headers,
  43518. eventListeners: {
  43519. scope: me,
  43520. processCompleted: callback,
  43521. processFailed: callback
  43522. },
  43523. format: me._processFormat(resultFormat)
  43524. });
  43525. queryService.processAsync(params);
  43526. }
  43527. /**
  43528. * @function QueryService.prototype.queryByDistance
  43529. * @description 地图距离查询服务。
  43530. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  43531. * @param {RequestCallback} callback - 回调函数。
  43532. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  43533. */
  43534. queryByDistance(params, callback, resultFormat) {
  43535. var me = this;
  43536. var queryByDistanceService = new QueryByDistanceService(me.url, {
  43537. proxy: me.options.proxy,
  43538. withCredentials: me.options.withCredentials,
  43539. crossOrigin: me.options.crossOrigin,
  43540. headers: me.options.headers,
  43541. eventListeners: {
  43542. scope: me,
  43543. processCompleted: callback,
  43544. processFailed: callback
  43545. },
  43546. format: resultFormat
  43547. });
  43548. queryByDistanceService.processAsync(params);
  43549. }
  43550. /**
  43551. * @function QueryService.prototype.queryBySQL
  43552. * @description 地图 SQL 查询服务。
  43553. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  43554. * @param {RequestCallback} callback - 回调函数。
  43555. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  43556. */
  43557. queryBySQL(params, callback, resultFormat) {
  43558. var me = this;
  43559. var queryBySQLService = new QueryBySQLService(me.url, {
  43560. proxy: me.options.proxy,
  43561. withCredentials: me.options.withCredentials,
  43562. crossOrigin: me.options.crossOrigin,
  43563. headers: me.options.headers,
  43564. eventListeners: {
  43565. scope: me,
  43566. processCompleted: callback,
  43567. processFailed: callback
  43568. },
  43569. format: resultFormat
  43570. });
  43571. queryBySQLService.processAsync(params);
  43572. }
  43573. /**
  43574. * @function QueryService.prototype.queryByGeometry
  43575. * @description 地图几何查询服务。
  43576. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  43577. * @param {RequestCallback} callback - 回调函数。
  43578. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  43579. */
  43580. queryByGeometry(params, callback, resultFormat) {
  43581. var me = this;
  43582. var queryByGeometryService = new QueryByGeometryService(me.url, {
  43583. proxy: me.options.proxy,
  43584. withCredentials: me.options.withCredentials,
  43585. crossOrigin: me.options.crossOrigin,
  43586. headers: me.options.headers,
  43587. eventListeners: {
  43588. scope: me,
  43589. processCompleted: callback,
  43590. processFailed: callback
  43591. },
  43592. format: resultFormat
  43593. });
  43594. queryByGeometryService.processAsync(params);
  43595. }
  43596. _processFormat(resultFormat) {
  43597. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  43598. }
  43599. }
  43600. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  43601. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43602. * This program are made available under the terms of the Apache License, Version 2.0
  43603. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43604. /**
  43605. * @class RouteCalculateMeasureParameters
  43606. * @deprecatedclass SuperMap.RouteCalculateMeasureParameters
  43607. * @category iServer SpatialAnalyst RouteCalculateMeasure
  43608. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  43609. * @param {Object} options - 参数。
  43610. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  43611. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  43612. * @param {number} [options.tolerance] - 容限值。
  43613. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  43614. * @usage
  43615. */
  43616. class RouteCalculateMeasureParameters {
  43617. constructor(options) {
  43618. if (!options) {
  43619. return this;
  43620. }
  43621. /**
  43622. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteCalculateMeasureParameters.prototype.sourceRoute
  43623. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  43624. */
  43625. this.sourceRoute = null;
  43626. /**
  43627. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} RouteCalculateMeasureParameters.prototype.point
  43628. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  43629. */
  43630. this.point = null;
  43631. /**
  43632. * @member {number} [RouteCalculateMeasureParameters.prototype.tolerance]
  43633. * @description 容限值。
  43634. */
  43635. this.tolerance = null;
  43636. /**
  43637. * @member {boolean} [RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  43638. * @description 是否忽略子对象之间的距离。
  43639. */
  43640. this.isIgnoreGap = false;
  43641. Util_Util.extend(this, options);
  43642. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  43643. }
  43644. /**
  43645. * @function RouteCalculateMeasureParameters.prototype.destroy
  43646. * @description 释放资源,将引用资源的属性置空。
  43647. */
  43648. destroy() {
  43649. var me = this;
  43650. me.sourceRoute = null;
  43651. me.point = null;
  43652. if (me.tolerance) {
  43653. me.tolerance = null;
  43654. }
  43655. if (me.isIgnoreGap) {
  43656. me.isIgnoreGap = false;
  43657. }
  43658. }
  43659. }
  43660. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  43661. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43662. * This program are made available under the terms of the Apache License, Version 2.0
  43663. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43664. /**
  43665. * @class RouteCalculateMeasureService
  43666. * @deprecatedclass SuperMap.RouteCalculateMeasureService
  43667. * @category iServer SpatialAnalyst RouteCalculateMeasure
  43668. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  43669. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  43670. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  43671. * @extends {SpatialAnalystBase}
  43672. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  43673. * @param {Object} options - 参数。
  43674. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  43675. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43676. * @param {Object} [options.headers] - 请求头。
  43677. * @example 实例化该类如下例所示:
  43678. * (start code)
  43679. * var parameters = new RouteCalculateMeasureParameters({
  43680. * "sourceRoute":{
  43681. * "type":"LINEM",
  43682. * "parts":[4],
  43683. * "points":[
  43684. * {
  43685. * "measure":0,
  43686. * "y":-6674.466867067764,
  43687. * "x":3817.3527876130133
  43688. * },
  43689. * {
  43690. * "measure":199.57954019411724,
  43691. * "y":-6670.830929417594,
  43692. * "x":3617.806369901496
  43693. * },
  43694. * {
  43695. * "measure":609.3656478634477,
  43696. * "y":-6877.837541432356,
  43697. * "x":3264.1498746678444
  43698. * },
  43699. * {
  43700. * "measure":936.0174126282958,
  43701. * "y":-7038.687780615184,
  43702. * "x":2979.846206068903
  43703. * }
  43704. * ]
  43705. * },
  43706. * "tolerance":1,
  43707. * "point":{
  43708. * "x":3330.7754269417,
  43709. * "y":-6838.8394457216
  43710. * },
  43711. * "isIgnoreGap":false
  43712. * });
  43713. *
  43714. * var routeCalculateMeasureService = new RouteCalculateMeasureService(spatialAnalystURL, {
  43715. * eventListeners:{
  43716. * processCompleted:calculateCompleted,
  43717. * processFailed:calculateFailded
  43718. * }
  43719. * );
  43720. * routeCalculateMeasureService.processAsync(parameters);
  43721. *
  43722. * //执行
  43723. * function calculateCompleted(){todo}
  43724. * function calculateFailded(){todo}
  43725. * (end)
  43726. * @usage
  43727. */
  43728. class RouteCalculateMeasureService extends SpatialAnalystBase {
  43729. constructor(url, options) {
  43730. super(url, options);
  43731. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  43732. }
  43733. /**
  43734. * @override
  43735. */
  43736. destroy() {
  43737. super.destroy();
  43738. }
  43739. /**
  43740. * @function RouteCalculateMeasureService.prototype.processAsync
  43741. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  43742. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  43743. */
  43744. processAsync(params) {
  43745. if (!(params instanceof RouteCalculateMeasureParameters)) {
  43746. return;
  43747. }
  43748. var me = this, jsonParameters;
  43749. jsonParameters = me.getJsonParameters(params);
  43750. me.request({
  43751. method: "POST",
  43752. data: jsonParameters,
  43753. scope: me,
  43754. success: me.serviceProcessCompleted,
  43755. failure: me.serviceProcessFailed
  43756. });
  43757. }
  43758. /**
  43759. * @function RouteCalculateMeasureService.prototype.getJsonParameters
  43760. * @description 将参数转化为 JSON 字符串。
  43761. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  43762. * @returns {Object} 转化后的 JSON 字符串。
  43763. */
  43764. getJsonParameters(params) {
  43765. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  43766. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  43767. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  43768. jsonParameters = Util_Util.toJSON(params);
  43769. return jsonParameters;
  43770. }
  43771. }
  43772. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  43773. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43774. * This program are made available under the terms of the Apache License, Version 2.0
  43775. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43776. /**
  43777. * @class RouteLocatorParameters
  43778. * @deprecatedclass SuperMap.RouteLocatorParameters
  43779. * @category iServer SpatialAnalyst RouteLocator
  43780. * @classdesc 路由对象定位空间对象的参数类。
  43781. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数。如果用户两种参数均设置,优先选择 Dataset 方式。
  43782. * @param {Object} options - 参数。
  43783. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。
  43784. * @param {number} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  43785. * @param {string} [options.type] - 类型:点 or 线。
  43786. * @param {number} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  43787. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  43788. * @param {number} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  43789. * @param {number} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  43790. * @usage
  43791. */
  43792. class RouteLocatorParameters {
  43793. constructor(options) {
  43794. if (!options) {
  43795. return this;
  43796. }
  43797. /**
  43798. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteLocatorParameters.prototype.sourceRoute
  43799. * @description 路由对象。
  43800. */
  43801. this.sourceRoute = null;
  43802. /**
  43803. * @member {string} RouteLocatorParameters.prototype.dataset
  43804. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  43805. */
  43806. this.dataset = null;
  43807. /**
  43808. * @member {string} RouteLocatorParameters.prototype.routeIDField
  43809. * @description 路由对象所在的字段名称。
  43810. *
  43811. */
  43812. this.routeIDField = null;
  43813. /**
  43814. * @member {number} RouteLocatorParameters.prototype.routeID
  43815. * @description 路由对象标识。
  43816. *
  43817. */
  43818. this.routeID = null;
  43819. /**
  43820. * @member {string} [RouteLocatorParameters.prototype.type]
  43821. * @description 类型:点 or 线。
  43822. * 可选值为:
  43823. * LINE :根据起始 M 值及终止 M 值定位线对象。
  43824. * POINT : 根据 M 值定位点对象。
  43825. */
  43826. this.type = null;
  43827. /**
  43828. * @member {number} RouteLocatorParameters.prototype.measure
  43829. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  43830. */
  43831. this.measure = null;
  43832. /**
  43833. * @member {number} [RouteLocatorParameters.prototype.offset=0]
  43834. * @description 定位点偏移量。只当路由对象定位点时有意义。
  43835. */
  43836. this.offset = 0;
  43837. /**
  43838. * @member {boolean} [RouteLocatorParameters.prototype.isIgnoreGap=false]
  43839. * @description 是否忽略子对象之间的距离。
  43840. */
  43841. this.isIgnoreGap = false;
  43842. /**
  43843. * @member {number} [RouteLocatorParameters.prototype.startMeasure]
  43844. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  43845. */
  43846. this.startMeasure = null;
  43847. /**
  43848. * @member {number} [RouteLocatorParameters.prototype.endMeasure]
  43849. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  43850. */
  43851. this.endMeasure = null;
  43852. var routeFromClient = options.sourceRoute;
  43853. var routeHandle = {};
  43854. if (routeFromClient && routeFromClient instanceof Geometry_Geometry && routeFromClient.components) {
  43855. routeHandle.type = routeFromClient.type;
  43856. routeHandle.parts = routeFromClient.parts;
  43857. var parts = [];
  43858. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  43859. parts = parts.concat(routeFromClient.components[i].components);
  43860. }
  43861. routeHandle.points = parts;
  43862. options.sourceRoute = routeHandle;
  43863. }
  43864. Util_Util.extend(this, options);
  43865. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  43866. }
  43867. /**
  43868. * @function RouteLocatorParameters.prototype.destroy
  43869. * @description 释放资源,将引用资源的属性置空。
  43870. */
  43871. destroy() {
  43872. var me = this;
  43873. me.sourceRoute = null;
  43874. me.type = null;
  43875. me.measure = null;
  43876. me.offset = 0;
  43877. me.isIgnoreGap = false;
  43878. me.startMeasure = null;
  43879. me.endMeasure = null;
  43880. me.dataset = null;
  43881. me.routeID = null;
  43882. me.routeIDField = null;
  43883. }
  43884. }
  43885. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  43886. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43887. * This program are made available under the terms of the Apache License, Version 2.0
  43888. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43889. /**
  43890. * @class RouteLocatorService
  43891. * @deprecatedclass SuperMap.RouteLocatorService
  43892. * @category iServer SpatialAnalyst RouteLocator
  43893. * @classdesc 路由对象定位空间对象的服务类。
  43894. * @extends {SpatialAnalystBase}
  43895. * @param {string} url -服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  43896. * @param {Object} options - 参数。
  43897. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  43898. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43899. * @param {Object} [options.headers] - 请求头。
  43900. * @example 实例化该类如下例所示:
  43901. * (start code)
  43902. * var routeLocatorParameters_point = new RouteLocatorParameters({
  43903. * "sourceRoute":{
  43904. * "type":"LINEM",
  43905. * "parts":[4],
  43906. * "points":[
  43907. * {
  43908. * "measure":0,
  43909. * "y":-6674.466867067764,
  43910. * "x":3817.3527876130133
  43911. * },
  43912. * {
  43913. * "measure":199.57954019411724,
  43914. * "y":-6670.830929417594,
  43915. * "x":3617.806369901496
  43916. * },
  43917. * {
  43918. * "measure":609.3656478634477,
  43919. * "y":-6877.837541432356,
  43920. * "x":3264.1498746678444
  43921. * },
  43922. * {
  43923. * "measure":936.0174126282958,
  43924. * "y":-7038.687780615184,
  43925. * "x":2979.846206068903
  43926. * }
  43927. * ]
  43928. * },
  43929. * "type":"POINT",
  43930. * "measure":10,
  43931. * "offset":3,
  43932. * "isIgnoreGap":true
  43933. * });
  43934. * var routeLocatorService = new RouteLocatorService(spatialAnalystURL, {
  43935. * eventListeners:{
  43936. * processCompleted:routeLocatorCompleted,
  43937. * processFailed:routeLocatorFailded
  43938. * }
  43939. * );
  43940. * routeLocatorService.processAsync(routeLocatorParameters_point);
  43941. *
  43942. * //执行
  43943. * function routeLocatorCompleted(){todo}
  43944. * function routeLocatorFailded(){todo}
  43945. * (end)
  43946. * @usage
  43947. */
  43948. class RouteLocatorService extends SpatialAnalystBase {
  43949. constructor(url, options) {
  43950. super(url, options);
  43951. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  43952. }
  43953. /**
  43954. * @override
  43955. */
  43956. destroy() {
  43957. super.destroy();
  43958. }
  43959. /**
  43960. * @function RouteLocatorService.prototype.processAsync
  43961. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  43962. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  43963. */
  43964. processAsync(params) {
  43965. if (!(params instanceof RouteLocatorParameters)) {
  43966. return;
  43967. }
  43968. var me = this, jsonParameters;
  43969. jsonParameters = me.getJsonParameters(params);
  43970. me.request({
  43971. method: "POST",
  43972. data: jsonParameters,
  43973. scope: me,
  43974. success: me.serviceProcessCompleted,
  43975. failure: me.serviceProcessFailed
  43976. });
  43977. }
  43978. /**
  43979. * @function RouteLocatorService.prototype.processAsync
  43980. * @description 将参数转化为 JSON 字符串。
  43981. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  43982. * @returns {Object} 转化后的JSON字符串。
  43983. */
  43984. getJsonParameters(params) {
  43985. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  43986. if (params.dataset) {
  43987. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  43988. params.sourceRoute = null;
  43989. }
  43990. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  43991. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  43992. jsonParameters = Util_Util.toJSON(params);
  43993. return jsonParameters;
  43994. }
  43995. }
  43996. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  43997. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43998. * This program are made available under the terms of the Apache License, Version 2.0
  43999. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44000. /**
  44001. * @class ServerFeature
  44002. * @deprecatedclass SuperMap.ServerFeature
  44003. * @category iServer Data Feature
  44004. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  44005. * @param {ServerGeometry} geometry - 矢量要素的几何信息。
  44006. * @param {Object} options - 参数。
  44007. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  44008. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  44009. * @usage
  44010. */
  44011. class ServerFeature {
  44012. constructor(options) {
  44013. /**
  44014. * @member {Array.<string>} [ServerFeature.prototype.fieldNames]
  44015. * @description 矢量要素的属性字段名集合。
  44016. */
  44017. this.fieldNames = null;
  44018. /**
  44019. * @member {Array.<string>} [ServerFeature.prototype.fieldValues]
  44020. * @description 矢量要素的属性字段值集合。
  44021. */
  44022. this.fieldValues = null;
  44023. /**
  44024. * @member {ServerGeometry} ServerFeature.prototype.geometry
  44025. * @description 矢量要素的几何信息。
  44026. */
  44027. this.geometry = null;
  44028. if (options) {
  44029. Util_Util.extend(this, options);
  44030. }
  44031. this.CLASS_NAME = "SuperMap.ServerFeature";
  44032. }
  44033. /**
  44034. * @function ServerFeature.prototype.destroy
  44035. * @description 释放资源,将引用资源的属性置空。
  44036. */
  44037. destroy() {
  44038. var me = this;
  44039. me.fieldNames = null;
  44040. me.fieldValues = null;
  44041. if (me.geometry) {
  44042. me.geometry.destroy();
  44043. me.geometry = null;
  44044. }
  44045. }
  44046. /**
  44047. * @function ServerFeature.prototype.toFeature
  44048. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  44049. * @returns {Vector} 转换后的客户端矢量要素。
  44050. */
  44051. toFeature() {
  44052. var names, values, geo,
  44053. attr = {},
  44054. me = this,
  44055. feature;
  44056. names = me.fieldNames;
  44057. values = me.fieldValues;
  44058. for (var i in names) {
  44059. attr[names[i]] = values[i];
  44060. }
  44061. if (me.geometry) {
  44062. geo = me.geometry.toGeometry();
  44063. }
  44064. feature = new Vector(geo, attr);
  44065. if (me.geometry && me.geometry.id) {
  44066. feature.fid = me.geometry.id;
  44067. }
  44068. return feature;
  44069. }
  44070. /**
  44071. * @function ServerFeature.prototype.fromJson
  44072. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  44073. * @param {Object} jsonObject - 要转换的 JSON 对象。
  44074. * @returns {ServerFeature} 转化后的 ServerFeature 对象。
  44075. */
  44076. static fromJson(jsonObject) {
  44077. var geo = null;
  44078. if (!jsonObject) {
  44079. return;
  44080. }
  44081. geo = jsonObject.geometry;
  44082. if (geo) {
  44083. geo = ServerGeometry.fromJson(geo);
  44084. }
  44085. return new ServerFeature({
  44086. fieldNames: jsonObject.fieldNames,
  44087. fieldValues: jsonObject.fieldValues,
  44088. geometry: geo
  44089. });
  44090. }
  44091. }
  44092. ;// CONCATENATED MODULE: ./src/common/iServer/SetDatasourceParameters.js
  44093. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44094. * This program are made available under the terms of the Apache License, Version 2.0
  44095. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44096. /**
  44097. * @class SetDatasourceParameters
  44098. * @deprecatedclass SuperMap.SetDatasourceParameters
  44099. * @category iServer Data Datasource
  44100. * @classdesc 设置数据源信息参数类。
  44101. * @param {Object} options - 参数。
  44102. * @param {string} options.datasourceName - 数据源名称。
  44103. * @param {string} options.description - 数据源描述信息。
  44104. * @param {string} options.coordUnit - 坐标单位。
  44105. * @param {string} options.distanceUnit - 距离单位。
  44106. * @usage
  44107. */
  44108. class SetDatasourceParameters {
  44109. constructor(options) {
  44110. if (!options) {
  44111. return;
  44112. }
  44113. /**
  44114. * @member {string} SetDatasourceParameters.prototype.datasourceName
  44115. * @description 数据源名称。
  44116. */
  44117. this.datasourceName = null;
  44118. /**
  44119. * @member {string} SetDatasourceParameters.prototype.description
  44120. * @description 数据源描述信息。
  44121. */
  44122. this.description = null;
  44123. /**
  44124. * @member {string} SetDatasourceParameters.prototype.coordUnit
  44125. * @description 坐标单位。
  44126. */
  44127. this.coordUnit = null;
  44128. /**
  44129. * @member {string} SetDatasourceParameters.prototype.distanceUnit
  44130. * @description 距离单位。
  44131. */
  44132. this.distanceUnit = null;
  44133. if (options) {
  44134. Util_Util.extend(this, options);
  44135. }
  44136. this.CLASS_NAME = "SuperMap.SetDatasourceParameters";
  44137. }
  44138. /**
  44139. * @function SetDatasourceParameters.prototype.destroy
  44140. * @description 释放资源,将引用资源的属性置空。
  44141. */
  44142. destroy() {
  44143. var me = this;
  44144. me.datasourceName = null;
  44145. me.description = null;
  44146. me.coordUnit = null;
  44147. me.distanceUnit = null;
  44148. }
  44149. }
  44150. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  44151. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44152. * This program are made available under the terms of the Apache License, Version 2.0
  44153. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44154. /**
  44155. * @class SetLayerInfoParameters
  44156. * @deprecatedclass SuperMap.SetLayerInfoParameters
  44157. * @category iServer Map TempLayersSet
  44158. * @classdesc 设置图层信息参数类。
  44159. * @param {Object} options - 参数。
  44160. * @param {string} options.resourceID - 临时图层的资源 ID。
  44161. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  44162. * @param {string} options.layerInfo - 要更新的图层信息。
  44163. * @usage
  44164. */
  44165. class SetLayerInfoParameters {
  44166. constructor(options) {
  44167. options = options || {};
  44168. /**
  44169. * @member {string} SetLayerInfoParameters.prototype.resourceID
  44170. * @description 临时图层的资源 ID。
  44171. */
  44172. this.resourceID = null;
  44173. /**
  44174. * @member {string} SetLayerInfoParameters.prototype.tempLayerName
  44175. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  44176. */
  44177. this.tempLayerName = null;
  44178. /**
  44179. * @member {Object} SetLayerInfoParameters.prototype.layerInfo
  44180. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  44181. */
  44182. this.layerInfo = null;
  44183. Util_Util.extend(this, options);
  44184. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  44185. }
  44186. /**
  44187. * @function SetLayerInfoParameters.prototype.destroy
  44188. * @description 释放资源,将引用资源的属性置空。
  44189. */
  44190. destroy() {
  44191. var me = this;
  44192. me.resourceID = null;
  44193. me.tempLayerName = null;
  44194. me.layerInfo = null;
  44195. }
  44196. }
  44197. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  44198. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44199. * This program are made available under the terms of the Apache License, Version 2.0
  44200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44201. /**
  44202. * @class SetLayerInfoService
  44203. * @deprecatedclass SuperMap.SetLayerInfoService
  44204. * @category iServer Map TempLayersSet
  44205. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  44206. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  44207. * @extends {CommonServiceBase}
  44208. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  44209. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  44210. * @param {Object} options - 参数。
  44211. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44212. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  44213. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44214. * @param {Object} [options.headers] - 请求头。
  44215. * @usage
  44216. */
  44217. class SetLayerInfoService extends CommonServiceBase {
  44218. constructor(url, options) {
  44219. super(url, options);
  44220. if (options) {
  44221. Util_Util.extend(this, options);
  44222. }
  44223. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  44224. }
  44225. /**
  44226. * @override
  44227. */
  44228. destroy() {
  44229. super.destroy();
  44230. Util_Util.reset(this);
  44231. }
  44232. /**
  44233. * @function SetLayerInfoService.prototype.processAsync
  44234. * @description 负责将客户端的更新参数传递到服务端。
  44235. * @param {Object} params - 修改后的图层资源信息。
  44236. * 该参数可以使用获取图层信息服务<{@link GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  44237. */
  44238. processAsync(params) {
  44239. if (!params) {
  44240. return;
  44241. }
  44242. var me = this;
  44243. var jsonParamsStr = Util_Util.toJSON(params);
  44244. me.request({
  44245. method: "PUT",
  44246. data: jsonParamsStr,
  44247. scope: me,
  44248. success: me.serviceProcessCompleted,
  44249. failure: me.serviceProcessFailed
  44250. });
  44251. }
  44252. }
  44253. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  44254. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44255. * This program are made available under the terms of the Apache License, Version 2.0
  44256. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44257. /**
  44258. * @class SetLayersInfoParameters
  44259. * @deprecatedclass SuperMap.SetLayersInfoParameters
  44260. * @category iServer Map TempLayersSet
  44261. * @classdesc 设置图层信息参数类。
  44262. * @param {Object} options - 参数。
  44263. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  44264. * @param {string} options.resourceID - 临时图层资源 ID。
  44265. * @param {Object} options.layersInfo - 要更新的图层信息。
  44266. * @usage
  44267. */
  44268. class SetLayersInfoParameters {
  44269. constructor(options) {
  44270. options = options || {};
  44271. /**
  44272. * @member {boolean} [SetLayersInfoParameters.prototype.isTempLayers=false]
  44273. * @description 是否是临时图层。
  44274. */
  44275. this.isTempLayers = null;
  44276. /**
  44277. * @member {string} SetLayersInfoParameters.prototype.resourceID
  44278. * @description 临时图层资源 ID。
  44279. */
  44280. this.resourceID = null;
  44281. /**
  44282. * @member {Object} SetLayersInfoParameters.prototype.layersInfo
  44283. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  44284. */
  44285. this.layersInfo = null;
  44286. Util_Util.extend(this, options);
  44287. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  44288. }
  44289. /**
  44290. * @function SetLayersInfoParameters.prototype.destroy
  44291. * @description 释放资源,将引用资源的属性置空。
  44292. */
  44293. destroy() {
  44294. var me = this;
  44295. me.isTempLayers = null;
  44296. me.resourceID = null;
  44297. me.layersInfo = null;
  44298. }
  44299. }
  44300. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  44301. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44302. * This program are made available under the terms of the Apache License, Version 2.0
  44303. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44304. /**
  44305. * @class SetLayersInfoService
  44306. * @deprecatedclass SuperMap.SetLayersInfoService
  44307. * @category iServer Map TempLayersSet
  44308. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  44309. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  44310. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  44311. * @extends {CommonServiceBase}
  44312. * @param url - {string} 服务地址。请求地图服务,URL 应为:
  44313. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  44314. * @param {Object} options - 参数。
  44315. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  44316. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  44317. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44318. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  44319. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44320. * @param {Object} [options.headers] - 请求头。
  44321. * @usage
  44322. */
  44323. class SetLayersInfoService extends CommonServiceBase {
  44324. constructor(url, options) {
  44325. super(url, options);
  44326. /**
  44327. * @member {string} SetLayersInfoService.prototype.resourceID
  44328. * @description 图层资源ID,临时图层的资源ID标记。
  44329. */
  44330. this.resourceID = null;
  44331. /**
  44332. * @function {boolean} SetLayersInfoService.prototype.isTempLayers
  44333. * @description 当前url对应的图层是否是临时图层。
  44334. */
  44335. this.isTempLayers = false;
  44336. if (options) {
  44337. Util_Util.extend(this, options);
  44338. }
  44339. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  44340. }
  44341. /**
  44342. * @override
  44343. */
  44344. destroy() {
  44345. super.destroy();
  44346. Util_Util.reset(this);
  44347. }
  44348. /**
  44349. * @function SetLayersInfoService.prototype.processAsync
  44350. * @description 负责将客户端的更新参数传递到服务端。
  44351. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  44352. */
  44353. processAsync(params) {
  44354. if (!params) {
  44355. return;
  44356. }
  44357. var jsonParams,
  44358. subLayers = [],
  44359. me = this,
  44360. method = "";
  44361. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  44362. if (me.isTempLayers) {
  44363. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  44364. method = "PUT";
  44365. } else {
  44366. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet");
  44367. method = "POST";
  44368. }
  44369. if (!params.subLayers) {
  44370. params.subLayers = {layers: []}
  44371. }
  44372. if (!params.subLayers.layers) {
  44373. params.subLayers.layers = [];
  44374. }
  44375. var layers = params.subLayers.layers,
  44376. len = layers.length;
  44377. for (let i in layers) {
  44378. if (layers[i].ugcLayerType === "GRID") {
  44379. var colorDictionary = {};
  44380. var colorDics = layers[i].colorDictionarys;
  44381. for (var j in colorDics) {
  44382. var key = colorDics[j].elevation;
  44383. colorDictionary[key] = colorDics[j].color;
  44384. }
  44385. }
  44386. layers[i].colorDictionary = colorDictionary;
  44387. delete layers[i].colorDictionarys;
  44388. }
  44389. for (let i = 0; i < len; i++) {
  44390. if (layers[i].toJsonObject) {
  44391. //将图层信息转换成服务端能识别的简单json对象
  44392. subLayers.push(layers[i].toJsonObject());
  44393. } else {
  44394. subLayers.push(layers[i]);
  44395. }
  44396. }
  44397. jsonParams = Util_Util.extend(jsonParams, params);
  44398. jsonParams.subLayers = {"layers": subLayers};
  44399. jsonParams.object = null;
  44400. var jsonParamsStr = Util_Util.toJSON([jsonParams]);
  44401. me.request({
  44402. method: method,
  44403. data: jsonParamsStr,
  44404. scope: me,
  44405. success: me.serviceProcessCompleted,
  44406. failure: me.serviceProcessFailed
  44407. });
  44408. }
  44409. }
  44410. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  44411. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44412. * This program are made available under the terms of the Apache License, Version 2.0
  44413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44414. /**
  44415. * @class SetLayerStatusParameters
  44416. * @deprecatedclass SuperMap.SetLayerStatusParameters
  44417. * @category iServer Map TempLayersSet
  44418. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  44419. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  44420. * @param {Object} options - 参数。
  44421. * @param {Array.<LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link LayerStatus})集合,
  44422. * 集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  44423. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  44424. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  44425. * @usage
  44426. */
  44427. class SetLayerStatusParameters {
  44428. constructor(options) {
  44429. /**
  44430. * @member {Array.<LayerStatus>} SetLayerStatusParameters.prototype.layerStatusList
  44431. * @description 获取或设置图层可见状态({@link LayerStatus})集合,集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  44432. */
  44433. this.layerStatusList = [];
  44434. /**
  44435. * @member {number} [SetLayerStatusParameters.prototype.holdTime=15]
  44436. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  44437. */
  44438. this.holdTime = 15;
  44439. /**
  44440. * @member {string} SetLayerStatusParameters.prototype.resourceID
  44441. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 中进行图层的显示控制;
  44442. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 中进行图层的显示控制。
  44443. */
  44444. this.resourceID = null;
  44445. if (options) {
  44446. Util_Util.extend(this, options);
  44447. }
  44448. }
  44449. /**
  44450. * @function SetLayerStatusParameters.prototype.destroy
  44451. * @description 释放资源,将引用资源的属性置空。
  44452. */
  44453. destroy() {
  44454. var me = this;
  44455. me.layerStatusList = null;
  44456. me.holdTime = null;
  44457. me.resourceID = null;
  44458. }
  44459. /**
  44460. * @function SetLayerStatusParameters.prototype.toJSON
  44461. * @description 生成 JSON。
  44462. * @returns {Object} 对应的 JSON 对象。
  44463. */
  44464. toJSON() {
  44465. var json = '{';
  44466. json += '"layers":[';
  44467. var v = [];
  44468. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  44469. v.push(this.layerStatusList[i].toJSON());
  44470. }
  44471. json += v;
  44472. json += ']';
  44473. json += '}';
  44474. return json;
  44475. }
  44476. }
  44477. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  44478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44479. * This program are made available under the terms of the Apache License, Version 2.0
  44480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44481. /**
  44482. * @class SetLayerStatusService
  44483. * @deprecatedclass SuperMap.SetLayerStatusService
  44484. * @category iServer Map TempLayersSet
  44485. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  44486. * 用户获取服务端返回的各子图层显示状态有两种方式:
  44487. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  44488. * 一种是使用 AsyncResponder 类实现异步处理。
  44489. * @extends {CommonServiceBase}
  44490. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  44491. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  44492. * @param {Object} options - 参数。
  44493. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44494. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  44495. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44496. * @param {Object} [options.headers] - 请求头。
  44497. * @usage
  44498. */
  44499. class SetLayerStatusService extends CommonServiceBase {
  44500. constructor(url, options) {
  44501. super(url, options);
  44502. this.lastparams = null;
  44503. this.mapUrl = url;
  44504. if (options) {
  44505. Util_Util.extend(this, options);
  44506. }
  44507. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  44508. }
  44509. /**
  44510. * @override
  44511. */
  44512. destroy() {
  44513. super.destroy();
  44514. Util_Util.reset(this);
  44515. }
  44516. /**
  44517. * @function SetLayerStatusService.prototype.processAsync
  44518. * @description 负责将客户端的更新参数传递到服务端。
  44519. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SetLayerStatusParameters}
  44520. * 返回图层信息,然后对其属性进行修改来获取。
  44521. */
  44522. processAsync(params) {
  44523. if (!(params instanceof SetLayerStatusParameters)) {
  44524. return;
  44525. }
  44526. var me = this,
  44527. method = "POST";
  44528. me.url = me.mapUrl;
  44529. if (params.resourceID == null) {
  44530. me.url = Util_Util.urlPathAppend(me.url, 'tempLayersSet');
  44531. me.lastparams = params;
  44532. me.request({
  44533. method: method,
  44534. scope: me,
  44535. success: me.createTempLayerComplete,
  44536. failure: me.serviceProcessFailed
  44537. });
  44538. } else {
  44539. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  44540. me.url = Util_Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  44541. var jsonParameters = '[{';
  44542. jsonParameters += '"type":"UGC",';
  44543. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  44544. jsonParameters += '"subLayers":' + params.toJSON();
  44545. }
  44546. jsonParameters += ',"visible":' + true + ',';
  44547. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  44548. jsonParameters += '}]';
  44549. me.request({
  44550. method: "PUT",
  44551. data: jsonParameters,
  44552. scope: me,
  44553. success: me.serviceProcessCompleted,
  44554. failure: me.serviceProcessFailed
  44555. });
  44556. }
  44557. }
  44558. /**
  44559. * @function SetLayerStatusService.prototype.createTempLayerComplete
  44560. * @description 设置完成,执行此方法。
  44561. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  44562. */
  44563. createTempLayerComplete(result) {
  44564. var me = this;
  44565. result = Util_Util.transformResult(result);
  44566. if (result.succeed) {
  44567. me.lastparams.resourceID = result.newResourceID;
  44568. }
  44569. me.processAsync(me.lastparams);
  44570. }
  44571. /**
  44572. * @function SetLayerStatusService.prototype.getMapName
  44573. * @description 获取地图名称。
  44574. * @param {Object} url - 服务地址。
  44575. */
  44576. getMapName(url) {
  44577. var mapUrl = url;
  44578. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  44579. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  44580. }
  44581. var index = mapUrl.lastIndexOf("/");
  44582. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  44583. return mapName;
  44584. }
  44585. /**
  44586. * @function SetLayerStatusService.prototype.setLayerCompleted
  44587. * @description 设置完成,执行此方法。
  44588. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  44589. */
  44590. serviceProcessCompleted(result, options) {
  44591. var me = this;
  44592. result = Util_Util.transformResult(result);
  44593. if (result != null && me.lastparams != null) {
  44594. result.newResourceID = me.lastparams.resourceID;
  44595. }
  44596. me.events.triggerEvent("processCompleted", {result: result, options});
  44597. }
  44598. }
  44599. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  44600. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44601. * This program are made available under the terms of the Apache License, Version 2.0
  44602. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44603. /**
  44604. * @class SingleObjectQueryJobsParameter
  44605. * @deprecatedclass SuperMap.SingleObjectQueryJobsParameter
  44606. * @category iServer ProcessingService Query
  44607. * @classdesc 单对象空间查询分析任务参数类。
  44608. * @param {Object} options - 参数。
  44609. * @param {string} options.datasetName - 数据集名。
  44610. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  44611. * @param {SpatialQueryMode} [options.mode=SpatialQueryMode.CONTAIN] - 空间查询模式。
  44612. * @param {OutputSetting} [options.output] - 输出参数设置。
  44613. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  44614. * @usage
  44615. */
  44616. class SingleObjectQueryJobsParameter {
  44617. constructor(options) {
  44618. if (!options) {
  44619. return;
  44620. }
  44621. /**
  44622. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetName
  44623. * @description 数据集名。
  44624. */
  44625. this.datasetName = "";
  44626. /**
  44627. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetQuery
  44628. * @description 查询对象所在的数据集名称。
  44629. */
  44630. this.datasetQuery = "";
  44631. /**
  44632. * @member {string} SingleObjectQueryJobsParameter.prototype.geometryQuery
  44633. * @description 查询对象所在的几何对象。
  44634. */
  44635. this.geometryQuery = "";
  44636. /**
  44637. * @member {SpatialQueryMode} [SingleObjectQueryJobsParameter.prototype.mode=SpatialQueryMode.CONTAIN]
  44638. * @description 空间查询模式 。
  44639. */
  44640. this.mode = SpatialQueryMode.CONTAIN;
  44641. /**
  44642. * @member {OutputSetting} [SingleObjectQueryJobsParameter.prototype.output]
  44643. * @description 输出参数设置类。
  44644. */
  44645. this.output = null;
  44646. /**
  44647. * @member {MappingParameters} [SingleObjectQueryJobsParameter.prototype.mappingParameters]
  44648. * @description 分析后结果可视化的参数类。
  44649. */
  44650. this.mappingParameters = null;
  44651. Util_Util.extend(this, options);
  44652. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  44653. }
  44654. /**
  44655. * @function SingleObjectQueryJobsParameter.prototype.destroy
  44656. * @description 释放资源,将引用资源的属性置空。
  44657. */
  44658. destroy() {
  44659. this.datasetName = null;
  44660. this.datasetQuery = null;
  44661. this.geometryQuery = null;
  44662. this.mode = null;
  44663. if (this.output instanceof OutputSetting) {
  44664. this.output.destroy();
  44665. this.output = null;
  44666. }
  44667. if (this.mappingParameters instanceof MappingParameters){
  44668. this.mappingParameters.destroy();
  44669. this.mappingParameters = null;
  44670. }
  44671. }
  44672. /**
  44673. * @function SingleObjectQueryJobsParameter.toObject
  44674. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  44675. * @param {Object} tempObj - 目标对象。
  44676. * @description 生成单对象空间查询分析任务对象。
  44677. */
  44678. static toObject(singleObjectQueryJobsParameter, tempObj) {
  44679. for (var name in singleObjectQueryJobsParameter) {
  44680. if (name === "datasetName") {
  44681. tempObj['input'] = tempObj['input'] || {};
  44682. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  44683. continue;
  44684. }
  44685. if (name === "output"){
  44686. tempObj['output'] = tempObj['output'] || {};
  44687. tempObj['output'] = singleObjectQueryJobsParameter[name];
  44688. continue;
  44689. }
  44690. tempObj['analyst'] = tempObj['analyst'] || {};
  44691. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  44692. if(name === 'mappingParameters'){
  44693. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  44694. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  44695. }
  44696. }
  44697. }
  44698. }
  44699. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  44700. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44701. * This program are made available under the terms of the Apache License, Version 2.0
  44702. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44703. /**
  44704. * @class SingleObjectQueryJobsService
  44705. * @deprecatedclass SuperMap.SingleObjectQueryJobsService
  44706. * @category iServer ProcessingService Query
  44707. * @classdesc 单对象查询分析服务类
  44708. * @extends {ProcessingServiceBase}
  44709. * @param {string} url - 服务地址。
  44710. * @param {Object} options - 可选参数。
  44711. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44712. * @param {Object} [options.headers] - 请求头。
  44713. * @usage
  44714. */
  44715. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  44716. constructor(url, options) {
  44717. super(url, options);
  44718. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/query');
  44719. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  44720. }
  44721. /**
  44722. *@override
  44723. */
  44724. destroy() {
  44725. super.destroy();
  44726. }
  44727. /**
  44728. * @function SingleObjectQueryJobsService.protitype.getQueryJobs
  44729. * @description 获取单对象空间查询分析所有任务
  44730. */
  44731. getQueryJobs() {
  44732. super.getJobs(this.url);
  44733. }
  44734. /**
  44735. * @function KernelDensityJobsService.protitype.getQueryJob
  44736. * @description 获取指定id的单对象空间查询分析服务
  44737. * @param {string} id - 指定要获取数据的id
  44738. */
  44739. getQueryJob(id) {
  44740. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  44741. }
  44742. /**
  44743. * @function SingleObjectQueryJobsService.protitype.addQueryJob
  44744. * @description 新建单对象空间查询分析服务
  44745. * @param {SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  44746. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  44747. */
  44748. addQueryJob(params, seconds) {
  44749. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  44750. }
  44751. }
  44752. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  44753. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44754. * This program are made available under the terms of the Apache License, Version 2.0
  44755. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44756. /**
  44757. * @class StopQueryParameters
  44758. * @deprecatedclass SuperMap.StopQueryParameters
  44759. * @category iServer TrafficTransferAnalyst TransferStops
  44760. * @classdesc 站点查询参数类。
  44761. * @param {Object} options - 参数。
  44762. * @param {string} options.keyWord - 站点名称关键字。
  44763. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  44764. * @usage
  44765. */
  44766. class StopQueryParameters {
  44767. constructor(options) {
  44768. options = options || {};
  44769. /**
  44770. * @member {string} StopQueryParameters.prototype.keyWord
  44771. * @description 站点名称关键字。
  44772. */
  44773. this.keyWord = null;
  44774. /**
  44775. * @member {boolean} [StopQueryParameters.prototype.returnPosition=false]
  44776. * @description 是否返回站点坐标信息。
  44777. */
  44778. this.returnPosition = false;
  44779. Util_Util.extend(this, options);
  44780. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  44781. }
  44782. /**
  44783. * @function StopQueryParameters.prototype.destroy
  44784. * @description 释放资源,将引用资源的属性置空。
  44785. */
  44786. destroy() {
  44787. Util_Util.reset(this);
  44788. }
  44789. }
  44790. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  44791. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44792. * This program are made available under the terms of the Apache License, Version 2.0
  44793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44794. /**
  44795. * @class StopQueryService
  44796. * @deprecatedclass SuperMap.StopQueryService
  44797. * @category iServer TrafficTransferAnalyst TransferStops
  44798. * @classdesc 站点查询服务类。
  44799. * 返回结果通过该类支持的事件的监听函数参数获取
  44800. * @extends {CommonServiceBase}
  44801. * @param {string} url - 服务地址。
  44802. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  44803. * @param {Object} options - 参数。
  44804. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  44805. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44806. * @param {Object} [options.headers] - 请求头。
  44807. * @example 例如:
  44808. * (start code)
  44809. * var myService = new StopQueryService(url, {eventListeners: {
  44810. * "processCompleted": StopQueryCompleted,
  44811. * "processFailed": StopQueryError
  44812. * }
  44813. * };
  44814. * (end)
  44815. * @usage
  44816. *
  44817. */
  44818. class StopQueryService extends CommonServiceBase {
  44819. constructor(url, options) {
  44820. super(url, options);
  44821. options = options || {};
  44822. Util_Util.extend(this, options);
  44823. this.CLASS_NAME = "SuperMap.StopQueryService";
  44824. }
  44825. /**
  44826. *@override
  44827. */
  44828. destroy() {
  44829. super.destroy();
  44830. Util_Util.reset(this);
  44831. }
  44832. /**
  44833. * @function StopQueryService.prototype.processAsync
  44834. * @description 负责将客户端的更新参数传递到服务端。
  44835. * @param {StopQueryParameters} params - 交通换乘参数。
  44836. */
  44837. processAsync(params) {
  44838. if (!(params instanceof StopQueryParameters)) {
  44839. return;
  44840. }
  44841. var me = this;
  44842. me.url = Util_Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  44843. me.request({
  44844. method: "GET",
  44845. params: {returnPosition: params.returnPosition},
  44846. scope: me,
  44847. success: me.serviceProcessCompleted,
  44848. failure: me.serviceProcessFailed
  44849. });
  44850. }
  44851. }
  44852. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  44853. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44854. * This program are made available under the terms of the Apache License, Version 2.0
  44855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44856. /**
  44857. * @class SummaryAttributesJobsParameter
  44858. * @deprecatedclass SuperMap.SummaryAttributesJobsParameter
  44859. * @category iServer ProcessingService SummaryAttributes
  44860. * @classdesc 属性汇总分析任务参数类。
  44861. * @param {Object} options - 参数。
  44862. * @param {string} options.datasetName - 数据集名。
  44863. * @param {string} options.groupField - 分组字段。
  44864. * @param {string} options.attributeField - 属性字段。
  44865. * @param {string} options.statisticModes - 统计模式。
  44866. * @param {OutputSetting} [options.output] -输出参数设置。
  44867. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  44868. * @usage
  44869. */
  44870. class SummaryAttributesJobsParameter {
  44871. constructor(options) {
  44872. if (!options) {
  44873. return;
  44874. }
  44875. /**
  44876. * @member {string} SummaryAttributesJobsParameter.prototype.datasetName
  44877. * @description 汇总数据集名称。
  44878. */
  44879. this.datasetName = "";
  44880. /**
  44881. * @member {string} SummaryAttributesJobsParameter.prototype.groupField
  44882. * @description 分组字段。
  44883. */
  44884. this.groupField = "";
  44885. /**
  44886. * @member {string} SummaryAttributesJobsParameter.prototype.attributeField
  44887. * @description 属性字段。
  44888. */
  44889. this.attributeField = "";
  44890. /**
  44891. * @member {string} SummaryAttributesJobsParameter.prototype.statisticModes
  44892. * @description 属性汇总统计模式。
  44893. */
  44894. this.statisticModes = "";
  44895. /**
  44896. * @member {OutputSetting} SummaryAttributesJobsParameter.prototype.output
  44897. * @description 输出参数设置类。
  44898. */
  44899. this.output = null;
  44900. /**
  44901. * @member {MappingParameters} [SummaryAttributesJobsParameter.prototype.mappingParameters]
  44902. * @description 分析后结果可视化的参数类。
  44903. */
  44904. this.mappingParameters = null;
  44905. Util_Util.extend(this, options);
  44906. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  44907. }
  44908. /**
  44909. * @function SummaryAttributesJobsParameter.prototype.destroy
  44910. * @description 释放资源,将资源的属性置空。
  44911. */
  44912. destroy() {
  44913. this.datasetName = null;
  44914. this.groupField = null;
  44915. this.attributeField = null;
  44916. this.statisticModes = null;
  44917. if (this.output instanceof OutputSetting) {
  44918. this.output.destroy();
  44919. this.output = null;
  44920. }
  44921. if (this.mappingParameters instanceof MappingParameters){
  44922. this.mappingParameters.destroy();
  44923. this.mappingParameters = null;
  44924. }
  44925. }
  44926. /**
  44927. * @function SummaryAttributesJobsParameter.toObject
  44928. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  44929. * @param {Object} tempObj - 目标对象。
  44930. * @description 生成属性汇总分析任务对象。
  44931. */
  44932. static toObject(SummaryAttributesJobsParameter, tempObj) {
  44933. for (var name in SummaryAttributesJobsParameter) {
  44934. if (name === "datasetName") {
  44935. tempObj['input'] = tempObj['input'] || {};
  44936. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  44937. continue;
  44938. }
  44939. if (name === "output") {
  44940. tempObj['output'] = tempObj['output'] || {};
  44941. tempObj['output'] = SummaryAttributesJobsParameter[name];
  44942. continue;
  44943. }
  44944. tempObj['analyst'] = tempObj['analyst'] || {};
  44945. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  44946. if(name === 'mappingParameters'){
  44947. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  44948. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  44949. }
  44950. }
  44951. }
  44952. }
  44953. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  44954. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44955. * This program are made available under the terms of the Apache License, Version 2.0
  44956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44957. /**
  44958. * @class SummaryAttributesJobsService
  44959. * @deprecatedclass SuperMap.SummaryAttributesJobsService
  44960. * @category iServer ProcessingService SummaryAttributes
  44961. * @classdesc 属性汇总分析服务类
  44962. * @extends {ProcessingServiceBase}
  44963. * @param {string} url - 服务地址。
  44964. * @param {Object} options - 可选参数。
  44965. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44966. * @param {Object} [options.headers] - 请求头。
  44967. * @usage
  44968. */
  44969. class SummaryAttributesJobsService extends ProcessingServiceBase {
  44970. constructor(url, options) {
  44971. super(url, options);
  44972. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  44973. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  44974. }
  44975. /**
  44976. *@override
  44977. */
  44978. destroy() {
  44979. super.destroy();
  44980. }
  44981. /**
  44982. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  44983. * @description 获取属性汇总分析所有任务
  44984. */
  44985. getSummaryAttributesJobs (){
  44986. super.getJobs(this.url);
  44987. }
  44988. /**
  44989. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  44990. * @description 获取指定id的属性汇总分析服务
  44991. * @param {string} id - 指定要获取数据的id
  44992. */
  44993. getSummaryAttributesJob(id) {
  44994. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  44995. }
  44996. /**
  44997. * @function SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  44998. * @description 新建属性汇总分析服务
  44999. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  45000. * @param {number} seconds - 创建成功结果的时间间隔。
  45001. */
  45002. addSummaryAttributesJob(params, seconds) {
  45003. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  45004. }
  45005. }
  45006. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  45007. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45008. * This program are made available under the terms of the Apache License, Version 2.0
  45009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45010. /**
  45011. * @class SummaryMeshJobParameter
  45012. * @deprecatedclass SuperMap.SummaryMeshJobParameter
  45013. * @category iServer ProcessingService AggregatePoints
  45014. * @classdesc 点聚合分析任务参数类。
  45015. * @param {Object} options - 参数。
  45016. * @param {string} options.datasetName - 数据集名。
  45017. * @param {string} [options.regionDataset ] - 聚合面数据集(聚合类型为多边形聚合时使用的参数)
  45018. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  45019. * @param {number} options.fields - 权重索引。
  45020. * @param {number} [options.resolution=100] - 分辨率。
  45021. * @param {StatisticAnalystMode} [options.statisticModes=StatisticAnalystMode.AVERAGE] - 分析模式。
  45022. * @param {number} [options.meshType=0] - 分析类型。
  45023. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 聚合类型。
  45024. * @param {OutputSetting} [options.output] - 输出参数设置。
  45025. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  45026. * @usage
  45027. */
  45028. class SummaryMeshJobParameter {
  45029. constructor(options) {
  45030. if (!options) {
  45031. return;
  45032. }
  45033. /**
  45034. * @member {string} SummaryMeshJobParameter.prototype.datasetName
  45035. * @description 数据集名。
  45036. */
  45037. this.datasetName = "";
  45038. /**
  45039. * @member {string} SummaryMeshJobParameter.prototype.regionDataset
  45040. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  45041. */
  45042. this.regionDataset = "";
  45043. /**
  45044. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryMeshJobParameter.prototype.query
  45045. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  45046. */
  45047. this.query = "";
  45048. /**
  45049. * @member {number} [SummaryMeshJobParameter.prototype.resolution=100]
  45050. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  45051. */
  45052. this.resolution = 100;
  45053. /**
  45054. * @member {number} [SummaryMeshJobParameter.prototype.meshType=0]
  45055. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  45056. */
  45057. this.meshType = 0;
  45058. /**
  45059. * @member {StatisticAnalystMode} [SummaryMeshJobParameter.prototype.statisticModes=StatisticAnalystMode.AVERAGE]
  45060. * @description 统计模式。
  45061. */
  45062. this.statisticModes = StatisticAnalystMode.AVERAGE;
  45063. /**
  45064. * @member {number} SummaryMeshJobParameter.prototype.fields
  45065. * @description 权重字段。
  45066. */
  45067. this.fields = "";
  45068. /**
  45069. * @member {SummaryType} [SummaryMeshJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  45070. * @description 聚合类型。
  45071. */
  45072. this.type = SummaryType.SUMMARYMESH;
  45073. /**
  45074. * @member {OutputSetting} [SummaryMeshJobParameter.prototype.output]
  45075. * @description 输出参数设置类。
  45076. */
  45077. this.output = null;
  45078. /**
  45079. * @member {MappingParameters} [SummaryMeshJobParameter.prototype.mappingParameters]
  45080. * @description 分析后结果可视化的参数类。
  45081. */
  45082. this.mappingParameters = null;
  45083. Util_Util.extend(this, options);
  45084. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  45085. }
  45086. /**
  45087. * @function SummaryMeshJobParameter.prototype.destroy
  45088. * @description 释放资源,将资源的属性置空。
  45089. */
  45090. destroy() {
  45091. this.datasetName = null;
  45092. this.query = null;
  45093. this.resolution = null;
  45094. this.statisticModes = null;
  45095. this.meshType = null;
  45096. this.fields = null;
  45097. this.regionDataset = null;
  45098. this.type = null;
  45099. if (this.output instanceof OutputSetting) {
  45100. this.output.destroy();
  45101. this.output = null;
  45102. }
  45103. if (this.mappingParameters instanceof MappingParameters){
  45104. this.mappingParameters.destroy();
  45105. this.mappingParameters = null;
  45106. }
  45107. }
  45108. /**
  45109. * @function SummaryMeshJobParameter.toObject
  45110. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  45111. * @param {Object} tempObj - 目标对象。
  45112. * @description 生成点聚合分析任务对象。
  45113. */
  45114. static toObject(summaryMeshJobParameter, tempObj) {
  45115. for (var name in summaryMeshJobParameter) {
  45116. if (name === "datasetName") {
  45117. tempObj['input'] = tempObj['input'] || {};
  45118. tempObj['input'][name] = summaryMeshJobParameter[name];
  45119. continue;
  45120. }
  45121. if (name === "type") {
  45122. tempObj['type'] = summaryMeshJobParameter[name];
  45123. continue;
  45124. }
  45125. if (name === "output") {
  45126. tempObj['output'] = tempObj['output'] || {};
  45127. tempObj['output'] = summaryMeshJobParameter[name];
  45128. continue;
  45129. }
  45130. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  45131. tempObj['analyst'] = tempObj['analyst'] || {};
  45132. if (name === 'query' && summaryMeshJobParameter[name]) {
  45133. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  45134. } else {
  45135. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  45136. }
  45137. if(name === 'mappingParameters'){
  45138. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  45139. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  45140. }
  45141. }
  45142. }
  45143. function contains(arr, obj) {
  45144. var i = arr.length;
  45145. while (i--) {
  45146. if (arr[i] === obj) {
  45147. return true;
  45148. }
  45149. }
  45150. return false;
  45151. }
  45152. }
  45153. }
  45154. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  45155. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45156. * This program are made available under the terms of the Apache License, Version 2.0
  45157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45158. /**
  45159. * @class SummaryMeshJobsService
  45160. * @deprecatedclass SuperMap.SummaryMeshJobsService
  45161. * @category iServer ProcessingService AggregatePoints
  45162. * @classdesc 点聚合分析任务类。
  45163. * @param {string} url - 服务地址。
  45164. * @param {Object} options - 参数。
  45165. * @param {Events} options.events - 处理所有事件的对象。
  45166. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  45167. * @param {number} options.index - 服务地址在数组中的位置。
  45168. * @param {number} options.length - 服务地址数组长度。
  45169. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45170. * @param {Object} [options.headers] - 请求头。
  45171. * @usage
  45172. */
  45173. class SummaryMeshJobsService extends ProcessingServiceBase {
  45174. constructor(url, options) {
  45175. super(url, options);
  45176. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  45177. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  45178. }
  45179. /**
  45180. * @override
  45181. */
  45182. destroy() {
  45183. super.destroy();
  45184. }
  45185. /**
  45186. * @function SummaryMeshJobsService.prototype.getSummaryMeshJobs
  45187. * @description 获取点聚合分析任务
  45188. */
  45189. getSummaryMeshJobs() {
  45190. super.getJobs(this.url);
  45191. }
  45192. /**
  45193. * @function SummaryMeshJobsService.prototype.getSummaryMeshJob
  45194. * @description 获取指定ip的点聚合分析任务
  45195. * @param {string} id - 指定要获取数据的id
  45196. */
  45197. getSummaryMeshJob(id) {
  45198. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  45199. }
  45200. /**
  45201. * @function SummaryMeshJobsService.prototype.addSummaryMeshJob
  45202. * @description 新建点聚合分析服务
  45203. * @param {SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  45204. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  45205. */
  45206. addSummaryMeshJob(params, seconds) {
  45207. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  45208. }
  45209. }
  45210. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  45211. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45212. * This program are made available under the terms of the Apache License, Version 2.0
  45213. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45214. /**
  45215. * @class SummaryRegionJobParameter
  45216. * @deprecatedclass SuperMap.SummaryRegionJobParameter
  45217. * @category iServer ProcessingService SummaryRegion
  45218. * @classdesc 区域汇总分析任务参数类。
  45219. * @param {Object} options - 参数。
  45220. * @param {string} options.datasetName - 数据集名。
  45221. * @param {string} [options.regionDataset] - 汇总数据源(多边形汇总时用到的参数)。
  45222. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  45223. * @param {string} [options.standardFields] - 标准属性字段名称。
  45224. * @param {string} [options.weightedFields] - 权重字段名称。
  45225. * @param {StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  45226. * @param {StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  45227. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  45228. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属性字段统计。
  45229. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  45230. * @param {number} [options.resolution=100] - 网格大小。
  45231. * @param {number} [options.meshType=0] - 网格面汇总类型。
  45232. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  45233. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 汇总类型。
  45234. * @param {OutputSetting} [options.output] - 输出参数设置。
  45235. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  45236. * @usage
  45237. */
  45238. class SummaryRegionJobParameter {
  45239. constructor(options) {
  45240. if (!options) {
  45241. return;
  45242. }
  45243. /**
  45244. * @member {string} SummaryRegionJobParameter.prototype.datasetName
  45245. * @description 数据集名。
  45246. */
  45247. this.datasetName = "";
  45248. /**
  45249. * @member {string} SummaryRegionJobParameter.prototype.regionDataset
  45250. * @description 汇总数据源(多边形汇总时用到的参数)。
  45251. */
  45252. this.regionDataset = "";
  45253. /**
  45254. * @member {boolean} [SummaryRegionJobParameter.prototype.sumShape=true]
  45255. * @description 是否统计长度或面积。
  45256. */
  45257. this.sumShape = true;
  45258. /**
  45259. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryRegionJobParameter.prototype.query
  45260. * @description 分析范围。
  45261. */
  45262. this.query = "";
  45263. /**
  45264. * @member {boolean} [SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  45265. * @description 是否以标准属字段统计。
  45266. */
  45267. this.standardSummaryFields = false;
  45268. /**
  45269. * @member {string} SummaryRegionJobParameter.prototype.standardFields
  45270. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  45271. */
  45272. this.standardFields = "";
  45273. /**
  45274. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.standardStatisticModes
  45275. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  45276. */
  45277. this.standardStatisticModes = "";
  45278. /**
  45279. * @member {boolean} [SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  45280. * @description 是否以权重字段统计。
  45281. */
  45282. this.weightedSummaryFields = false;
  45283. /**
  45284. * @member {string} SummaryRegionJobParameter.prototype.weightedFields
  45285. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  45286. */
  45287. this.weightedFields = "";
  45288. /**
  45289. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.weightedStatisticModes
  45290. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  45291. */
  45292. this.weightedStatisticModes = "";
  45293. /**
  45294. * @member {number} [SummaryRegionJobParameter.prototype.meshType=0]
  45295. * @description 网格面汇总类型。
  45296. */
  45297. this.meshType = 0;
  45298. /**
  45299. * @member {number} [SummaryRegionJobParameter.prototype.resolution=100]
  45300. * @description 网格大小。
  45301. */
  45302. this.resolution = 100;
  45303. /**
  45304. * @member {AnalystSizeUnit} [SummaryRegionJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  45305. * @description 网格大小单位。
  45306. */
  45307. this.meshSizeUnit = AnalystSizeUnit.METER;
  45308. /**
  45309. * @member {SummaryType} [SummaryRegionJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  45310. * @description 汇总类型。
  45311. */
  45312. this.type = SummaryType.SUMMARYMESH;
  45313. /**
  45314. * @member {OutputSetting} SummaryRegionJobParameter.prototype.output
  45315. * @description 输出参数设置类。
  45316. */
  45317. this.output = null;
  45318. /**
  45319. * @member {MappingParameters} [SummaryRegionJobParameter.prototype.mappingParameters]
  45320. * @description 分析后结果可视化的参数类。
  45321. */
  45322. this.mappingParameters = null;
  45323. Util_Util.extend(this, options);
  45324. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  45325. }
  45326. /**
  45327. * @function SummaryRegionJobParameter.prototype.destroy
  45328. * @description 释放资源,将引用资源的属性置空。
  45329. */
  45330. destroy() {
  45331. this.datasetName = null;
  45332. this.sumShape = null;
  45333. this.regionDataset = null;
  45334. this.query = null;
  45335. this.standardSummaryFields = null;
  45336. this.standardFields = null;
  45337. this.standardStatisticModes = null;
  45338. this.weightedSummaryFields = null;
  45339. this.weightedFields = null;
  45340. this.weightedStatisticModes = null;
  45341. this.meshType = null;
  45342. this.resolution = null;
  45343. this.meshSizeUnit = null;
  45344. this.type = null;
  45345. if (this.output instanceof OutputSetting) {
  45346. this.output.destroy();
  45347. this.output = null;
  45348. }
  45349. if (this.mappingParameters instanceof MappingParameters){
  45350. this.mappingParameters.destroy();
  45351. this.mappingParameters = null;
  45352. }
  45353. }
  45354. /**
  45355. * @function SummaryRegionJobParameter.toObject
  45356. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  45357. * @param {Object} tempObj - 目标对象。
  45358. * @description 生成区域汇总分析服务对象。
  45359. */
  45360. static toObject(summaryRegionJobParameter, tempObj) {
  45361. for (var name in summaryRegionJobParameter) {
  45362. if (name === "datasetName") {
  45363. tempObj['input'] = tempObj['input'] || {};
  45364. tempObj['input'][name] = summaryRegionJobParameter[name];
  45365. continue;
  45366. }
  45367. if (name === "type") {
  45368. tempObj['type'] = summaryRegionJobParameter[name];
  45369. continue;
  45370. }
  45371. if (name === "type") {
  45372. tempObj['type'] = summaryRegionJobParameter[name];
  45373. continue;
  45374. }
  45375. if (name === "output") {
  45376. tempObj['output'] = tempObj['output'] || {};
  45377. tempObj['output'] = summaryRegionJobParameter[name];
  45378. continue;
  45379. }
  45380. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  45381. tempObj['analyst'] = tempObj['analyst'] || {};
  45382. if (name === 'query' && summaryRegionJobParameter[name]) {
  45383. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  45384. } else {
  45385. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  45386. }
  45387. if(name === 'mappingParameters'){
  45388. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  45389. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  45390. }
  45391. }
  45392. }
  45393. }
  45394. }
  45395. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  45396. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45397. * This program are made available under the terms of the Apache License, Version 2.0
  45398. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45399. /**
  45400. * @class SummaryRegionJobsService
  45401. * @deprecatedclass SuperMap.SummaryRegionJobsService
  45402. * @category iServer ProcessingService SummaryRegion
  45403. * @classdesc 区域汇总分析服务类
  45404. * @extends {ProcessingServiceBase}
  45405. * @param {string} url - 服务地址。
  45406. * @param {Object} options - 可选参数。
  45407. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45408. * @param {Object} [options.headers] - 请求头。
  45409. * @usage
  45410. */
  45411. class SummaryRegionJobsService extends ProcessingServiceBase {
  45412. constructor(url, options) {
  45413. super(url, options);
  45414. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  45415. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  45416. }
  45417. /**
  45418. *@override
  45419. */
  45420. destroy() {
  45421. super.destroy();
  45422. }
  45423. /**
  45424. * @function SummaryRegionJobsService.prototype.getSummaryRegionJobs
  45425. * @description 获取区域汇总分析任务集合。
  45426. */
  45427. getSummaryRegionJobs() {
  45428. super.getJobs(this.url);
  45429. }
  45430. /**
  45431. * @function SummaryRegionJobsService.prototype.getSummaryRegionJob
  45432. * @description 获取指定id的区域汇总分析任务。
  45433. * @param {string} id -要获取区域汇总分析任务的id
  45434. */
  45435. getSummaryRegionJob(id) {
  45436. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  45437. }
  45438. /**
  45439. * @function SummaryRegionJobsService.prototype.addSummaryRegionJob
  45440. * @description 新建区域汇总任务。
  45441. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  45442. * @param {number} seconds - 创建成功结果的时间间隔。
  45443. */
  45444. addSummaryRegionJob(params, seconds) {
  45445. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  45446. }
  45447. }
  45448. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  45449. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45450. * This program are made available under the terms of the Apache License, Version 2.0
  45451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45452. /**
  45453. * @class SupplyCenter
  45454. * @deprecatedclass SuperMap.SupplyCenter
  45455. * @category iServer NetworkAnalyst Location
  45456. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  45457. * @param {Object} options - 参数。
  45458. * @param {number} options.maxWeight - 最大耗费值。
  45459. * @param {number} options.nodeID - 结点 ID 号。资源供给中心必须是结点。
  45460. * @param {number} options.resourceValue - 能提供的最大服务量或商品数量。
  45461. * @param {SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  45462. * @usage
  45463. */
  45464. class SupplyCenter {
  45465. constructor(options) {
  45466. /**
  45467. * @member {number} SupplyCenter.prototype.maxWeight
  45468. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  45469. * 最大阻力值是用来限制需求点到中心点的花费。
  45470. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  45471. */
  45472. this.maxWeight = null;
  45473. /**
  45474. * @member {number} SupplyCenter.prototype.nodeID
  45475. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  45476. */
  45477. this.nodeID = null;
  45478. /**
  45479. * @member {number} SupplyCenter.prototype.resourceValue
  45480. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  45481. */
  45482. this.resourceValue = null;
  45483. /**
  45484. * @member {SupplyCenterType} [SupplyCenter.prototype.type]
  45485. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  45486. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  45487. */
  45488. this.type = null;
  45489. if (options) {
  45490. Util_Util.extend(this, options);
  45491. }
  45492. this.CLASS_NAME = "SuperMap.SupplyCenter";
  45493. }
  45494. /**
  45495. * @function SupplyCenter.prototype.destroy
  45496. * @description 释放资源,将引用资源的属性置空。
  45497. */
  45498. destroy() {
  45499. var me = this;
  45500. me.maxWeight = null;
  45501. me.nodeID = null;
  45502. me.resourceValue = null;
  45503. me.type = null;
  45504. }
  45505. /**
  45506. * @function SupplyCenter.fromJson
  45507. * @description 将服务端 JSON 对象转换成当前客户端对象。
  45508. * @param {Object} jsonObject - 要转换的 JSON 对象。
  45509. * @returns {SupplyCenter} SupplyCenter 对象。
  45510. */
  45511. static fromJson(jsonObject) {
  45512. if (!jsonObject) {
  45513. return;
  45514. }
  45515. return new SupplyCenter({
  45516. maxWeight: jsonObject.maxWeight,
  45517. nodeID: jsonObject.nodeID,
  45518. resourceValue: jsonObject.resourceValue,
  45519. type: jsonObject.type
  45520. });
  45521. }
  45522. }
  45523. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  45524. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45525. * This program are made available under the terms of the Apache License, Version 2.0
  45526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45527. /**
  45528. * @class SurfaceAnalystService
  45529. * @deprecatedclass SuperMap.SurfaceAnalystService
  45530. * @category iServer SpatialAnalyst SurfaceAnalyst
  45531. * @classdesc 表面分析服务类。
  45532. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  45533. * 表面分析结果通过该类支持的事件的监听函数参数获取
  45534. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  45535. * @param {Object} options - 参数。
  45536. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  45537. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45538. * @param {Object} [options.headers] - 请求头。
  45539. * @extends {SpatialAnalystBase}
  45540. * @example 例如:
  45541. * (start code)
  45542. * var mySurfaceAnalystService = new SurfaceAnalystService(url, {
  45543. * eventListeners: {
  45544. * "processCompleted": surfaceAnalysCompleted,
  45545. * "processFailed": surfaceAnalysFailed
  45546. * }
  45547. * });
  45548. * (end)
  45549. * @usage
  45550. */
  45551. class SurfaceAnalystService extends SpatialAnalystBase {
  45552. constructor(url, options) {
  45553. super(url, options);
  45554. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  45555. }
  45556. /**
  45557. * @function SurfaceAnalystService.prototype.destroy
  45558. * @description 释放资源,将引用的资源属性置空。
  45559. */
  45560. destroy() {
  45561. super.destroy();
  45562. }
  45563. /**
  45564. * @function SurfaceAnalystService.prototype.processAsync
  45565. * @description 负责将客户端的表面分析服务参数传递到服务端。
  45566. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  45567. */
  45568. processAsync(params) {
  45569. if (!(params instanceof SurfaceAnalystParameters)) {
  45570. return;
  45571. }
  45572. var me = this, jsonParameters;
  45573. jsonParameters = me.getJsonParameters(params);
  45574. me.request({
  45575. method: "POST",
  45576. data: jsonParameters,
  45577. scope: me,
  45578. success: me.serviceProcessCompleted,
  45579. failure: me.serviceProcessFailed
  45580. });
  45581. }
  45582. /**
  45583. * @function SurfaceAnalystService.prototype.getJsonParameters
  45584. * @description 将参数转化为 JSON 字符串。
  45585. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  45586. * @returns {Object} 转化后的JSON字符串。
  45587. */
  45588. getJsonParameters(params) {
  45589. var jsonParameters = '';
  45590. var parameterObject = {};
  45591. var me = this;
  45592. if (params instanceof DatasetSurfaceAnalystParameters) {
  45593. me.url = Util_Util.urlPathAppend(
  45594. me.url,
  45595. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  45596. );
  45597. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  45598. jsonParameters = Util_Util.toJSON(parameterObject);
  45599. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  45600. me.url = Util_Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  45601. jsonParameters = Util_Util.toJSON(params);
  45602. } else {
  45603. return;
  45604. }
  45605. this.returnContent = true;
  45606. return jsonParameters;
  45607. }
  45608. dataFormat() {
  45609. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  45610. }
  45611. }
  45612. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  45613. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45614. * This program are made available under the terms of the Apache License, Version 2.0
  45615. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45616. /**
  45617. * @class TerrainCurvatureCalculationParameters
  45618. * @deprecatedclass SuperMap.TerrainCurvatureCalculationParameters
  45619. * @category iServer SpatialAnalyst TerrainCalculation
  45620. * @classdesc 地形曲率计算参数类。
  45621. * @param {Object} options - 参数。
  45622. * @param {string} options.dataset - 地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  45623. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  45624. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  45625. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  45626. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  45627. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  45628. * @usage
  45629. */
  45630. class TerrainCurvatureCalculationParameters {
  45631. constructor(options) {
  45632. if (!options) {
  45633. return;
  45634. }
  45635. /**
  45636. * @member {string} TerrainCurvatureCalculationParameters.prototype.dataset
  45637. * @description 要用来做地形曲率计算数据源中数据集的名称。
  45638. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  45639. * 注:地形曲率计算必须为栅格数据集。
  45640. */
  45641. this.dataset = null;
  45642. /**
  45643. * @member {number} [TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  45644. * @description 指定的高程缩放系数。1.0 表示不缩放。
  45645. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  45646. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  45647. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  45648. */
  45649. this.zFactor = 1.0;
  45650. /**
  45651. * @member {string} TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  45652. * @description 结果数据集:平均曲率数据集的名称。
  45653. */
  45654. this.averageCurvatureName = null;
  45655. /**
  45656. * @member {string} TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  45657. * @description 结果数据集:剖面曲率数据集的名称。
  45658. */
  45659. this.profileCurvatureName = "";
  45660. /**
  45661. * @member {string} TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  45662. * @description 结果数据集:平面曲率数据集的名称。
  45663. */
  45664. this.planCurvatureName = "";
  45665. /**
  45666. * @member {boolean} [TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  45667. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  45668. */
  45669. this.deleteExistResultDataset = false;
  45670. Util_Util.extend(this, options);
  45671. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  45672. }
  45673. /**
  45674. * @function TerrainCurvatureCalculationParameters.prototype.destroy
  45675. * @description 释放资源,将引用资源的属性置空。
  45676. */
  45677. destroy() {
  45678. var me = this;
  45679. me.dataset = null;
  45680. me.zFactor = 1.0;
  45681. me.averageCurvatureName = null;
  45682. me.profileCurvatureName = null;
  45683. me.planCurvatureName = null;
  45684. me.deleteExistResultDataset = true;
  45685. }
  45686. /**
  45687. * @function TerrainCurvatureCalculationParameters.toObject
  45688. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  45689. * @param {Object} tempObj - 目标对象。
  45690. * @description 生成地形曲率计算对象。
  45691. */
  45692. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  45693. for (var name in derrainCurvatureCalculationParameters) {
  45694. if (name !== "dataset") {
  45695. tempObj[name] = derrainCurvatureCalculationParameters[name];
  45696. }
  45697. }
  45698. }
  45699. }
  45700. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  45701. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45702. * This program are made available under the terms of the Apache License, Version 2.0
  45703. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45704. /**
  45705. * @class TerrainCurvatureCalculationService
  45706. * @deprecatedclass SuperMap.TerrainCurvatureCalculationService
  45707. * @category iServer SpatialAnalyst TerrainCalculation
  45708. * @classdesc 地形曲率计算服务类。
  45709. * @extends {SpatialAnalystBase}
  45710. * @param {Object} options - 参数。
  45711. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  45712. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  45713. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45714. * @param {Object} [options.headers] - 请求头。
  45715. * @example 例如:
  45716. * (start code)
  45717. * var myTerrainCurvatureCalculationService = new TerrainCurvatureCalculationService(url);
  45718. * myTerrainCurvatureCalculationService.on({
  45719. * "processCompleted": processCompleted,
  45720. * "processFailed": processFailed
  45721. * }
  45722. * );
  45723. * (end)
  45724. * @usage
  45725. */
  45726. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  45727. constructor(url, options) {
  45728. super(url, options);
  45729. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  45730. }
  45731. /**
  45732. *@override
  45733. */
  45734. destroy() {
  45735. super.destroy();
  45736. }
  45737. /**
  45738. * @function TerrainCurvatureCalculationService.prototype.processAsync
  45739. * @description 负责将客户端的查询参数传递到服务端。
  45740. * @param {TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  45741. */
  45742. processAsync(parameter) {
  45743. var me = this;
  45744. var parameterObject = {};
  45745. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  45746. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  45747. }
  45748. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  45749. var jsonParameters = Util_Util.toJSON(parameterObject);
  45750. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  45751. me.request({
  45752. method: "POST",
  45753. data: jsonParameters,
  45754. scope: me,
  45755. success: me.serviceProcessCompleted,
  45756. failure: me.serviceProcessFailed
  45757. });
  45758. }
  45759. }
  45760. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  45761. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45762. * This program are made available under the terms of the Apache License, Version 2.0
  45763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45764. /**
  45765. * @class ThemeFlow
  45766. * @deprecatedclass SuperMap.ThemeFlow
  45767. * @private
  45768. * @category iServer Map Theme
  45769. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  45770. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  45771. * @param {Object} options - 可选参数。
  45772. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  45773. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  45774. * @param {ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  45775. * @usage
  45776. */
  45777. class ThemeFlow {
  45778. constructor(options) {
  45779. /**
  45780. * @member {boolean} [ThemeFlow.prototype.flowEnabled=false]
  45781. * @description 是否流动显示标签或符号。<br>
  45782. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  45783. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  45784. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  45785. */
  45786. this.flowEnabled = false;
  45787. /**
  45788. * @member {boolean} [ThemeFlow.prototype.leaderLineDisplayed=false]
  45789. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  45790. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  45791. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  45792. */
  45793. this.leaderLineDisplayed = false;
  45794. /**
  45795. * @member {ServerStyle} ThemeFlow.prototype.leaderLineStyle
  45796. * @description 标签或符号与其标注对象之间牵引线的风格。
  45797. */
  45798. this.leaderLineStyle = new ServerStyle();
  45799. if (options) {
  45800. Util_Util.extend(this, options);
  45801. }
  45802. this.CLASS_NAME = "SuperMap.ThemeFlow";
  45803. }
  45804. /**
  45805. * @function ThemeFlow.prototype.destroy
  45806. * @description 释放资源,将引用资源的属性置空。
  45807. */
  45808. destroy() {
  45809. var me = this;
  45810. me.flowEnabled = null;
  45811. me.leaderLineDisplayed = null;
  45812. if (me.leaderLineStyle) {
  45813. me.leaderLineStyle.destroy();
  45814. me.leaderLineStyle = null;
  45815. }
  45816. }
  45817. /**
  45818. * @function ThemeFlow.fromObj
  45819. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  45820. * @param {Object} obj - 传入对象。
  45821. * @returns {ThemeFlow} ThemeFlow 对象。
  45822. */
  45823. static fromObj(obj) {
  45824. if (!obj) {
  45825. return;
  45826. }
  45827. var res = new ThemeFlow();
  45828. Util_Util.copy(res, obj);
  45829. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  45830. return res;
  45831. }
  45832. }
  45833. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  45834. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45835. * This program are made available under the terms of the Apache License, Version 2.0
  45836. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45837. /**
  45838. * @class ThemeGridRangeItem
  45839. * @deprecatedclass SuperMap.ThemeGridRangeItem
  45840. * @category iServer Map Theme
  45841. * @classdesc 栅格分段专题图子项类。在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  45842. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  45843. * @param {Object} options - 参数。
  45844. * @param {ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  45845. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  45846. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  45847. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  45848. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  45849. * @usage
  45850. */
  45851. class ThemeGridRangeItem {
  45852. constructor(options) {
  45853. /**
  45854. * @member {string} [ThemeGridRangeItem.prototype.caption]
  45855. * @description 栅格分段专题图子项的标题。
  45856. */
  45857. this.caption = null;
  45858. /**
  45859. * @member {ServerColor} ThemeGridRangeItem.prototype.color
  45860. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  45861. */
  45862. this.color = new ServerColor();
  45863. /**
  45864. * @member {number} [ThemeGridRangeItem.prototype.end=0]
  45865. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  45866. */
  45867. this.end = 0;
  45868. /**
  45869. * @member {number} [ThemeGridRangeItem.prototype.start=0]
  45870. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  45871. */
  45872. this.start = 0;
  45873. /**
  45874. * @member {boolean} [ThemeGridRangeItem.prototype.visible=true]
  45875. * @description 栅格分段专题图子项是否可见。
  45876. */
  45877. this.visible = true;
  45878. if (options) {
  45879. Util_Util.extend(this, options);
  45880. }
  45881. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  45882. }
  45883. /**
  45884. * @function ThemeGridRangeItem.prototype.destroy
  45885. * @description 释放资源,将引用资源的属性置空。
  45886. */
  45887. destroy() {
  45888. var me = this;
  45889. me.caption = null;
  45890. me.end = null;
  45891. me.start = null;
  45892. //需要验证是够存在destroy方法
  45893. if (me.color) {
  45894. me.color.destroy();
  45895. me.color = null;
  45896. }
  45897. me.visible = null;
  45898. }
  45899. /**
  45900. * @function ThemeGridRangeItem.prototype.toServerJSONObject
  45901. * @description 转换成对应的 JSON 格式对象。
  45902. * @returns {Object} 对应的 JSON 格式对象。
  45903. */
  45904. toServerJSONObject() {
  45905. var obj = {};
  45906. obj = Util_Util.copyAttributes(obj, this);
  45907. if (obj.color) {
  45908. if (obj.color.toServerJSONObject) {
  45909. obj.color = obj.color.toServerJSONObject();
  45910. }
  45911. }
  45912. return obj;
  45913. }
  45914. /**
  45915. * @function ThemeGridRangeItem.fromObj
  45916. * @description 从传入对象获取栅格分段专题图子项类。
  45917. * @param {Object} obj - 传入对象。
  45918. * @returns {ThemeGridRangeItem} ThemeGridRangeItem 对象。
  45919. */
  45920. static fromObj(obj) {
  45921. if (!obj) {
  45922. return;
  45923. }
  45924. var res = new ThemeGridRangeItem();
  45925. Util_Util.copy(res, obj);
  45926. res.color = ServerColor.fromJson(obj.color);
  45927. return res;
  45928. }
  45929. }
  45930. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  45931. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45932. * This program are made available under the terms of the Apache License, Version 2.0
  45933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45934. /**
  45935. * @class ThemeGridRange
  45936. * @deprecatedclass SuperMap.ThemeGridRange
  45937. * @category iServer Map Theme
  45938. * @classdesc 栅格分段专题图。栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。一般用来反映连续分布现象的数量或程度特征。
  45939. * 比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  45940. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  45941. * @extends {CommonTheme}
  45942. * @param {Object} options - 参数。
  45943. * @param {Array.<ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  45944. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  45945. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  45946. * @param {number} [options.rangeParameter=0] - 分段参数。
  45947. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  45948. * @usage
  45949. */
  45950. class ThemeGridRange extends Theme {
  45951. constructor(options) {
  45952. super("GRIDRANGE", options);
  45953. /**
  45954. * @member {Array.<ThemeGridRangeItem>} ThemeGridRange.prototype.items
  45955. * @description 栅格分段专题图子项数组。<br>
  45956. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  45957. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  45958. */
  45959. this.items = null;
  45960. /**
  45961. * @member {RangeMode} [ThemeGridRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  45962. * @description 分段专题图的分段模式。<br>
  45963. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  45964. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  45965. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  45966. */
  45967. this.rangeMode = RangeMode.EQUALINTERVAL;
  45968. /**
  45969. * @member {number} [ThemeGridRange.prototype.rangeParameter=0]
  45970. * @description 分段参数。<br>
  45971. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  45972. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  45973. */
  45974. this.rangeParameter = 0;
  45975. /**
  45976. * @member {ColorGradientType} [ThemeGridRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  45977. * @description 渐变颜色枚举类。
  45978. *
  45979. */
  45980. this.colorGradientType = ColorGradientType.YELLOW_RED;
  45981. /**
  45982. * @member {boolean} ThemeGridRange.prototype.reverseColor
  45983. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  45984. */
  45985. this.reverseColor = false;
  45986. if (options) {
  45987. Util_Util.extend(this, options);
  45988. }
  45989. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  45990. }
  45991. /**
  45992. * @function ThemeGridRange.prototype.destroy
  45993. * @override
  45994. */
  45995. destroy() {
  45996. super.destroy();
  45997. var me = this;
  45998. if (me.items) {
  45999. if (me.items.length > 0) {
  46000. for (var item in me.items) {
  46001. me.items[item].destroy();
  46002. me.items[item] = null;
  46003. }
  46004. }
  46005. me.items = null;
  46006. }
  46007. me.reverseColor = null;
  46008. me.rangeMode = null;
  46009. me.rangeParameter = null;
  46010. me.colorGradientType = null;
  46011. }
  46012. /**
  46013. * @function ThemeGridRange.fromObj
  46014. * @description 从传入对象获取栅格分段专题图。
  46015. * @param {Object} obj - 传入对象。
  46016. * @returns {ThemeGridRange} ThemeGridRange 对象。
  46017. */
  46018. static fromObj(obj) {
  46019. if (!obj) {
  46020. return;
  46021. }
  46022. var res = new ThemeGridRange();
  46023. Util_Util.copy(res, obj);
  46024. var itemsR = obj.items;
  46025. var len = itemsR ? itemsR.length : 0;
  46026. res.items = [];
  46027. for (var i = 0; i < len; i++) {
  46028. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  46029. }
  46030. return res;
  46031. }
  46032. }
  46033. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  46034. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46035. * This program are made available under the terms of the Apache License, Version 2.0
  46036. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46037. /**
  46038. * @class ThemeGridUniqueItem
  46039. * @deprecatedclass SuperMap.ThemeGridUniqueItem
  46040. * @category iServer Map Theme
  46041. * @classdesc 栅格单值专题图子项类。
  46042. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  46043. * @param {Object} options - 可选参数。
  46044. * @param {string} [options.caption] - 子项的名称。
  46045. * @param {ServerColor} [options.color] - 子项的显示颜色。
  46046. * @param {number} options.unique - 子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  46047. * @param {boolean} [options.visible=true] - 子项是否可见。
  46048. * @usage
  46049. */
  46050. class ThemeGridUniqueItem {
  46051. constructor(options) {
  46052. /**
  46053. * @member {string} [ThemeGridUniqueItem.prototype.caption]
  46054. * @description 栅格单值专题图子项的名称。
  46055. */
  46056. this.caption = null;
  46057. /**
  46058. * @member {ServerColor} [ThemeGridUniqueItem.prototype.color]
  46059. * @description 栅格单值专题图子项的显示颜色。
  46060. */
  46061. this.color = new ServerColor();
  46062. /**
  46063. * @member {number} ThemeGridUniqueItem.prototype.unique
  46064. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  46065. */
  46066. this.unique = null;
  46067. /**
  46068. * @member {boolean} [ThemeGridUniqueItem.prototype.visible=true]
  46069. * @description 栅格单值专题图子项是否可见。
  46070. */
  46071. this.visible = true;
  46072. if (options) {
  46073. Util_Util.extend(this, options);
  46074. }
  46075. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  46076. }
  46077. /**
  46078. * @function ThemeGridUniqueItem.prototype.destroy
  46079. * @description 释放资源,将引用资源的属性置空。
  46080. */
  46081. destroy() {
  46082. var me = this;
  46083. me.caption = null;
  46084. me.unique = null;
  46085. if (me.color) {
  46086. me.color.destroy();
  46087. me.color = null;
  46088. }
  46089. me.visible = null;
  46090. }
  46091. /**
  46092. * @function ThemeGridUniqueItem.prototype.toServerJSONObject
  46093. * @description 转换成对应的 JSON 格式对象。
  46094. * @returns {Object} 对应的 JSON 格式对象。
  46095. */
  46096. toServerJSONObject() {
  46097. var obj = {};
  46098. obj = Util_Util.copyAttributes(obj, this);
  46099. if (obj.color) {
  46100. if (obj.color.toServerJSONObject) {
  46101. obj.color = obj.color.toServerJSONObject();
  46102. }
  46103. }
  46104. return obj;
  46105. }
  46106. /**
  46107. * @function ThemeGridUniqueItem.fromObj
  46108. * @description 从传入对象获取栅格单值专题图子项类。
  46109. * @param {Object} obj - 传入对象。
  46110. * @returns {ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  46111. */
  46112. static fromObj(obj) {
  46113. var res = new ThemeGridUniqueItem();
  46114. Util_Util.copy(res, obj);
  46115. res.color = ServerColor.fromJson(obj.color);
  46116. return res;
  46117. }
  46118. }
  46119. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  46120. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46121. * This program are made available under the terms of the Apache License, Version 2.0
  46122. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46123. /**
  46124. * @class ThemeGridUnique
  46125. * @deprecatedclass SuperMap.ThemeGridUnique
  46126. * @category iServer Map Theme
  46127. * @classdesc 栅格单值专题图类。栅格单值专题图是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。
  46128. * 适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  46129. * @extends {CommonTheme}
  46130. * @param {Object} options - 参数。
  46131. * @param {Array.<ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  46132. * @param {ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  46133. * @usage
  46134. */
  46135. class ThemeGridUnique extends Theme {
  46136. constructor(options) {
  46137. super("GRIDUNIQUE", options);
  46138. /**
  46139. * @member {ServerColor} ThemeGridUnique.prototype.defaultcolor
  46140. * @description 栅格单值专题图的默认颜色。
  46141. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  46142. */
  46143. this.defaultcolor = new ServerColor();
  46144. /**
  46145. * @member {Array.<ThemeGridUniqueItem>} ThemeGridUnique.prototype.items
  46146. * @description 栅格单值专题图子项数组。
  46147. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  46148. */
  46149. this.items = null;
  46150. if (options) {
  46151. Util_Util.extend(this, options);
  46152. }
  46153. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  46154. }
  46155. /**
  46156. * @function ThemeGridUnique.prototype.destroy
  46157. * @override
  46158. */
  46159. destroy() {
  46160. super.destroy();
  46161. var me = this;
  46162. if (me.items) {
  46163. if (me.items.length > 0) {
  46164. for (var item in me.items) {
  46165. me.items[item].destroy();
  46166. me.items[item] = null;
  46167. }
  46168. }
  46169. me.items = null;
  46170. }
  46171. if (me.defaultcolor) {
  46172. me.defaultcolor.destroy();
  46173. me.defaultcolor = null;
  46174. }
  46175. }
  46176. /**
  46177. * @function ThemeGridUnique.prototype.toServerJSONObject
  46178. * @description 转换成对应的 JSON 格式对象。
  46179. * @returns {Object} 对应的 JSON 格式对象
  46180. */
  46181. toServerJSONObject() {
  46182. var obj = {};
  46183. obj = Util_Util.copyAttributes(obj, this);
  46184. if (obj.defaultcolor) {
  46185. if (obj.defaultcolor.toServerJSONObject) {
  46186. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  46187. }
  46188. }
  46189. if (obj.items) {
  46190. var items = [],
  46191. len = obj.items.length;
  46192. for (var i = 0; i < len; i++) {
  46193. items.push(obj.items[i].toServerJSONObject());
  46194. }
  46195. obj.items = items;
  46196. }
  46197. return obj;
  46198. }
  46199. /**
  46200. * @function ThemeGridUnique.fromObj
  46201. * @description 从传入对象获取栅格单值专题图类。
  46202. * @param {Object} obj - 传入对象
  46203. * @returns {ThemeGridUnique} ThemeGridUnique 对象
  46204. */
  46205. static fromObj(obj) {
  46206. var res = new ThemeGridUnique();
  46207. var uItems = obj.items;
  46208. var len = uItems ? uItems.length : 0;
  46209. Util_Util.extend(res, obj);
  46210. res.items = [];
  46211. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  46212. for (var i = 0; i < len; i++) {
  46213. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  46214. }
  46215. return res;
  46216. }
  46217. }
  46218. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  46219. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46220. * This program are made available under the terms of the Apache License, Version 2.0
  46221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46222. /**
  46223. * @class ThemeLabelUniqueItem
  46224. * @deprecatedclass SuperMap.ThemeLabelUniqueItem
  46225. * @category iServer Map Theme
  46226. * @classdesc 单值标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  46227. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  46228. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  46229. * @param {Object} options - 参数。
  46230. * @param {string} options.unique - 子项的值,可以为数字、字符串等。
  46231. * @param {string} [options.caption] - 子项的名称。
  46232. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  46233. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  46234. * @param {boolean} [options.visible=true] - 子项是否可见。
  46235. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  46236. * @usage
  46237. */
  46238. class ThemeLabelUniqueItem {
  46239. constructor(options) {
  46240. /**
  46241. * @member {string} [ThemeLabelUniqueItem.prototype.caption]
  46242. * @description 标签专题子项的标题。
  46243. */
  46244. this.caption = null;
  46245. /**
  46246. * @member {string} ThemeLabelUniqueItem.prototype.unique
  46247. * @description 单值专题图子项的值,可以为数字、字符串等。
  46248. */
  46249. this.unique = null;
  46250. /**
  46251. * @member {number} [ThemeLabelUniqueItem.prototype.offsetX=0]
  46252. * @description 标签在 X 方向偏移量。
  46253. */
  46254. this.offsetX = 0;
  46255. /**
  46256. * @member {number} [ThemeLabelUniqueItem.prototype.offsetY=0]
  46257. * @description 标签在 Y 方向偏移量。
  46258. */
  46259. this.offsetY = 0;
  46260. /**
  46261. * @member {boolean} [ThemeLabelUniqueItem.prototype.visible=true]
  46262. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  46263. */
  46264. this.visible = true;
  46265. /**
  46266. * @member {ServerTextStyle} ThemeLabelUniqueItem.prototype.style
  46267. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  46268. * uniformMixedStyle(标签文本的复合风格),ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  46269. */
  46270. this.style = new ServerTextStyle();
  46271. if (options) {
  46272. Util_Util.extend(this, options);
  46273. }
  46274. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  46275. }
  46276. /**
  46277. * @function ThemeLabelUniqueItem.prototype.destroy
  46278. * @description 释放资源,将引用资源的属性置空。
  46279. */
  46280. destroy() {
  46281. var me = this;
  46282. me.unique = null;
  46283. me.caption = null;
  46284. me.offsetX = null;
  46285. me.offsetY = null;
  46286. if (me.style) {
  46287. me.style.destroy();
  46288. me.style = null;
  46289. }
  46290. me.visible = null;
  46291. }
  46292. /**
  46293. * @function ThemeLabelUniqueItem.fromObj
  46294. * @description 从传入对象获取单值标签专题图的子项类。
  46295. * @param {Object} obj - 传入对象。
  46296. * @returns {ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  46297. */
  46298. static fromObj(obj) {
  46299. if (!obj) {
  46300. return;
  46301. }
  46302. var t = new ThemeLabelUniqueItem();
  46303. Util_Util.copy(t, obj);
  46304. return t;
  46305. }
  46306. }
  46307. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  46308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46309. * This program are made available under the terms of the Apache License, Version 2.0
  46310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46311. /**
  46312. * @class ThemeMemoryData
  46313. * @deprecatedclass SuperMap.ThemeMemoryData
  46314. * @category iServer Map Theme
  46315. * @classdesc 专题图内存数据类。
  46316. * @param {Array} srcData - 原始值数组。
  46317. * @param {Array} targetData - 外部值数组。
  46318. * @usage
  46319. */
  46320. class ThemeMemoryData {
  46321. constructor(srcData, targetData) {
  46322. /**
  46323. * @member {Array} ThemeMemoryData.prototype.srcData
  46324. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  46325. */
  46326. this.srcData = srcData;
  46327. /**
  46328. * @member {Array} ThemeMemoryData.prototype.targetData
  46329. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  46330. */
  46331. this.targetData = targetData;
  46332. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  46333. }
  46334. /**
  46335. * @function ThemeMemoryData.prototype.destroy
  46336. * @description 释放资源,将引用资源的属性置空。
  46337. */
  46338. destroy() {
  46339. var me = this;
  46340. me.srcData = null;
  46341. me.targetData = null;
  46342. }
  46343. /**
  46344. * @function ThemeMemoryData.prototype.toJSON
  46345. * @description 将 ThemeMemoryData 对象转化为 JSON 字符串。
  46346. * @returns {string} 返回转换后的 JSON 字符串。
  46347. */
  46348. toJSON() {
  46349. if (this.srcData && this.targetData) {
  46350. var memoryDataStr = "";
  46351. var count = Math.min(this.srcData.length, this.targetData.length);
  46352. for (var i = 0; i < count; i++) {
  46353. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  46354. }
  46355. //去除多余的逗号
  46356. if (i > 0) {
  46357. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  46358. }
  46359. return "{" + memoryDataStr + "}";
  46360. } else {
  46361. return null;
  46362. }
  46363. }
  46364. }
  46365. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  46366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46367. * This program are made available under the terms of the Apache License, Version 2.0
  46368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46369. /**
  46370. * @class ThemeParameters
  46371. * @deprecatedclass SuperMap.ThemeParameters
  46372. * @category iServer Map Theme
  46373. * @classdesc 专题图参数类。
  46374. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  46375. * @param {Object} options - 参数。
  46376. * @param {Array.<string>} options.datasetNames - 数据集数组。
  46377. * @param {Array.<string>} options.dataSourceNames - 数据源数组。
  46378. * @param {Array.<JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  46379. * @param {Array.<CommonTheme>} options.themes - 专题图对象列表。
  46380. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  46381. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  46382. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  46383. * @usage
  46384. */
  46385. class ThemeParameters {
  46386. constructor(options) {
  46387. /**
  46388. * @member {Array.<string>} ThemeParameters.prototype.datasetNames
  46389. * @description 要制作专题图的数据集数组。
  46390. */
  46391. this.datasetNames = null;
  46392. /**
  46393. * @member {Array.<string>} ThemeParameters.prototype.dataSourceNames
  46394. * @description 要制作专题图的数据集所在的数据源数组。
  46395. */
  46396. this.dataSourceNames = null;
  46397. /**
  46398. * @member {Array.<JoinItem>} [ThemeParameters.prototype.joinItems]
  46399. * @description 设置与外部表的连接信息 JoinItem 数组。
  46400. * 使用此属性可以制作与外部表连接的专题图。
  46401. */
  46402. this.joinItems = null;
  46403. /**
  46404. * @member {Array.<CommonTheme>} ThemeParameters.prototype.themes
  46405. * @description 专题图对象列表。
  46406. * 该参数为实例化的各类专题图对象的集合。
  46407. */
  46408. this.themes = null;
  46409. /**
  46410. * @member {Array.<string>} [ThemeParameters.prototype.displayFilters]
  46411. * @description 专题图属性过滤条件。
  46412. */
  46413. this.displayFilters = null;
  46414. /**
  46415. * @member {Array.<string>} [ThemeParameters.prototype.displayOrderBys]
  46416. * @description 专题图对象生成符号叠加次序排序字段。
  46417. */
  46418. this.displayOrderBys = null;
  46419. /**
  46420. * @member {Object} [ThemeParameters.prototype.fieldValuesDisplayFilter]
  46421. * @property {Array.<number>} values - 待过滤的值。
  46422. * @property {string} fieldName - 待过滤的字段名称只支持数字类型的字段。
  46423. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  46424. */
  46425. this.fieldValuesDisplayFilter = null;
  46426. if (options) {
  46427. Util_Util.extend(this, options);
  46428. }
  46429. this.CLASS_NAME = "SuperMap.ThemeParameters";
  46430. }
  46431. /**
  46432. * @function ThemeParameters.prototype.destroy
  46433. * @description 释放资源,将引用资源的属性置空。
  46434. */
  46435. destroy() {
  46436. var me = this;
  46437. me.datasetNames = null;
  46438. me.dataSourceNames = null;
  46439. if (me.joinItems) {
  46440. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  46441. joinItems[i].destroy();
  46442. }
  46443. me.joinItems = null;
  46444. }
  46445. if (me.themes) {
  46446. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  46447. themes[i].destroy();
  46448. }
  46449. me.themes = null;
  46450. }
  46451. }
  46452. }
  46453. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  46454. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46455. * This program are made available under the terms of the Apache License, Version 2.0
  46456. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46457. /**
  46458. * @class ThemeService
  46459. * @deprecatedclass SuperMap.ThemeService
  46460. * @category iServer Map Theme
  46461. * @classdesc 专题图服务类。
  46462. * @extends {CommonServiceBase}
  46463. * @example
  46464. * var myThemeService = new ThemeService(url, {
  46465. * eventListeners: {
  46466. * "processCompleted": themeCompleted,
  46467. * "processFailed": themeFailed
  46468. * }
  46469. * });
  46470. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  46471. * @param {Object} options - 参数。
  46472. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46473. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46474. * @param {Object} [options.headers] - 请求头。
  46475. * @usage
  46476. */
  46477. class ThemeService extends CommonServiceBase {
  46478. constructor(url, options) {
  46479. super(url, options);
  46480. if (options) {
  46481. Util_Util.extend(this, options);
  46482. }
  46483. this.eventCount = 0;
  46484. this.url = Util_Util.urlPathAppend(this.url, 'tempLayersSet');
  46485. this.CLASS_NAME = 'SuperMap.ThemeService';
  46486. }
  46487. /**
  46488. * @override
  46489. */
  46490. destroy() {
  46491. super.destroy();
  46492. }
  46493. /**
  46494. * @function ThemeService.prototype.processAsync
  46495. * @description 负责将客户端的专题图参数传递到服务端。
  46496. * @param {ThemeParameters} params - 专题图参数类。
  46497. */
  46498. processAsync(params, callback) {
  46499. if (!(params instanceof ThemeParameters)) {
  46500. return;
  46501. }
  46502. var me = this,
  46503. jsonParameters = null;
  46504. jsonParameters = me.getJsonParameters(params);
  46505. let eventId = ++this.eventCount;
  46506. let eventListeners = {
  46507. scope: this,
  46508. processCompleted: function(result) {
  46509. if (eventId === result.result.eventId && callback) {
  46510. delete result.result.eventId;
  46511. callback(result);
  46512. this.events && this.events.un(eventListeners);
  46513. return false;
  46514. }
  46515. },
  46516. processFailed: function(result) {
  46517. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  46518. callback(result);
  46519. this.events && this.events.un(eventListeners);
  46520. return false;
  46521. }
  46522. }
  46523. }
  46524. this.events.on(eventListeners);
  46525. me.request({
  46526. method: "POST",
  46527. data: jsonParameters,
  46528. scope: me,
  46529. success(result, options) {
  46530. result.eventId = eventId;
  46531. this.serviceProcessCompleted(result, options);
  46532. },
  46533. failure(result, options) {
  46534. if (result.error) {
  46535. result.error.eventId = eventId;
  46536. }
  46537. result.eventId = eventId;
  46538. this.serviceProcessFailed(result, options);
  46539. }
  46540. });
  46541. }
  46542. /**
  46543. * @function ThemeService.prototype.getJsonParameters
  46544. * @description 将专题图参数参数转化为 JSON 字符串。
  46545. * @param {ThemeParameters} parameter - 专题图参数类。
  46546. * @returns {Object} 转化后的JSON字符串。
  46547. */
  46548. getJsonParameters(parameter) {
  46549. var jsonParameters = "",
  46550. themeObj = null,
  46551. filters = null,
  46552. orderBys = null,
  46553. fieldValuesDisplayFilter;
  46554. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  46555. for (var i = 0; i < parameter.themes.length; i++) {
  46556. themeObj = parameter.themes[i];
  46557. var jsonTheme = Util_Util.toJSON(themeObj);
  46558. jsonTheme = jsonTheme.slice(0, -1);
  46559. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  46560. filters = parameter.displayFilters;
  46561. if (filters && filters.length > 0) {
  46562. if (filters.length === 1) {
  46563. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  46564. } else {
  46565. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  46566. }
  46567. }
  46568. orderBys = parameter.displayOrderBy;
  46569. if (orderBys && orderBys.length > 0) {
  46570. if (orderBys.length === 1) {
  46571. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  46572. } else {
  46573. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  46574. }
  46575. }
  46576. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  46577. if (fieldValuesDisplayFilter) {
  46578. jsonParameters += "'fieldValuesDisplayFilter':" + Util_Util.toJSON(fieldValuesDisplayFilter) + ",";
  46579. }
  46580. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  46581. jsonParameters += "'joinItems':[" + Util_Util.toJSON(parameter.joinItems[i]) + "],";
  46582. }
  46583. if (parameter.datasetNames && parameter.dataSourceNames) {
  46584. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  46585. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  46586. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  46587. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  46588. } else {
  46589. jsonParameters += "},";
  46590. }
  46591. }
  46592. //去除多余的逗号
  46593. if (parameter.themes && parameter.themes.length > 0) {
  46594. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  46595. }
  46596. jsonParameters += "]},";
  46597. var urlArray = this.url.split("/");
  46598. var jsonMapName = urlArray[urlArray.length - 2];
  46599. jsonParameters += "'name': '" + jsonMapName + "'}]";
  46600. return jsonParameters;
  46601. }
  46602. }
  46603. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  46604. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46605. * This program are made available under the terms of the Apache License, Version 2.0
  46606. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46607. /**
  46608. * @class ThiessenAnalystService
  46609. * @deprecatedclass SuperMap.ThiessenAnalystService
  46610. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  46611. * @classdesc
  46612. * 泰森多边形分析服务类
  46613. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  46614. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  46615. * 泰森多边形分析的参数支持两种,当参数为 {@link DatasetThiessenAnalystParameters} 类型
  46616. * 时,执行数据集泰森多边形分析,当参数为 {@link GeometryThiessenAnalystParameters} 类型时,
  46617. * 执行几何对象泰森多边形分析。
  46618. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  46619. * @param {Object} options - 参数。
  46620. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46621. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46622. * @param {Object} [options.headers] - 请求头。
  46623. * @extends {SpatialAnalystBase}
  46624. * @example 例如:
  46625. * (start code)
  46626. * var myThiessenAnalystService = new ThiessenAnalystService(url, {
  46627. * eventListeners: {
  46628. * "processCompleted": bufferCompleted,
  46629. * "processFailed": bufferFailed
  46630. * }
  46631. * });
  46632. * (end)
  46633. * @usage
  46634. */
  46635. class ThiessenAnalystService extends SpatialAnalystBase {
  46636. constructor(url, options) {
  46637. super(url, options);
  46638. /**
  46639. * @member {string} ThiessenAnalystService.prototype.mode
  46640. * @description 缓冲区分析类型
  46641. */
  46642. this.mode = null;
  46643. if (options) {
  46644. Util_Util.extend(this, options);
  46645. }
  46646. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  46647. }
  46648. /**
  46649. * @override
  46650. */
  46651. destroy() {
  46652. super.destroy();
  46653. this.mode = null;
  46654. }
  46655. /**
  46656. * @function ThiessenAnalystService.prototype.processAsync
  46657. * @description 负责将客户端的查询参数传递到服务端。
  46658. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} parameter - 泰森多边形分析参数基类。
  46659. */
  46660. processAsync(parameter) {
  46661. var parameterObject = {};
  46662. var me = this;
  46663. if (parameter instanceof DatasetThiessenAnalystParameters) {
  46664. me.mode = "datasets";
  46665. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  46666. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  46667. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  46668. me.mode = "geometry";
  46669. me.url = Util_Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  46670. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  46671. }
  46672. var jsonParameters = Util_Util.toJSON(parameterObject);
  46673. this.returnContent = true;
  46674. me.request({
  46675. method: "POST",
  46676. data: jsonParameters,
  46677. scope: me,
  46678. success: me.serviceProcessCompleted,
  46679. failure: me.serviceProcessFailed
  46680. });
  46681. }
  46682. dataFormat() {
  46683. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  46684. }
  46685. }
  46686. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  46687. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46688. * This program are made available under the terms of the Apache License, Version 2.0
  46689. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46690. /**
  46691. * @class GeometryBatchAnalystService
  46692. * @deprecatedclass SuperMap.GeometryBatchAnalystService
  46693. * @category iServer SpatialAnalyst BatchAnalyst
  46694. * @classdesc 批量空间分析服务类
  46695. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  46696. * 获取的结果数据包括 originResult 、result 两种,
  46697. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  46698. * @extends {SpatialAnalystBase}
  46699. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  46700. * @param {Object} options - 参数。
  46701. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46702. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46703. * @param {Object} [options.headers] - 请求头。
  46704. * @example
  46705. * var myOverlayAnalystService = new GeometryBatchAnalystService(url, {
  46706. * eventListeners: {
  46707. * "processCompleted": OverlayCompleted,
  46708. * "processFailed": OverlayFailed
  46709. * }
  46710. * });
  46711. * @usage
  46712. */
  46713. class GeometryBatchAnalystService extends SpatialAnalystBase {
  46714. constructor(url, options) {
  46715. super(url, options);
  46716. if (options) {
  46717. Util_Util.extend(this, options);
  46718. }
  46719. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  46720. }
  46721. /**
  46722. * @function GeometryBatchAnalystService.prototype.processAsync
  46723. * @description 负责将客户端的查询参数传递到服务端。
  46724. * @param {GeometryOverlayAnalystParameter} parameter - 批量几何对象叠加分析参数类
  46725. *
  46726. */
  46727. processAsync(parameters) {
  46728. var me = this;
  46729. me.url = Util_Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  46730. me.url = Util_Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  46731. var parameterObjects = me._processParams(parameters);
  46732. var jsonParameters = Util_Util.toJSON(parameterObjects);
  46733. me.request({
  46734. method: "POST",
  46735. data: jsonParameters,
  46736. scope: me,
  46737. success: me.serviceProcessCompleted,
  46738. failure: me.serviceProcessFailed
  46739. });
  46740. }
  46741. _processParams(parameters) {
  46742. var me = this;
  46743. if (!Util_Util.isArray(parameters)) {
  46744. return;
  46745. }
  46746. var processParams = [];
  46747. parameters.map(function (item) {
  46748. processParams.push(me._toJSON(item));
  46749. return item;
  46750. });
  46751. return processParams;
  46752. }
  46753. _toJSON(parameter) {
  46754. var tempObj = {};
  46755. if(parameter.analystName ==="buffer"){
  46756. tempObj.analystName = "buffer";
  46757. tempObj.param = {};
  46758. //几何对象的批量空间分析,
  46759. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  46760. }else if(parameter.analystName ==="overlay"){
  46761. tempObj.analystName = "overlay";
  46762. tempObj.param = {};
  46763. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  46764. }else if(parameter.analystName ==="interpolationDensity"){
  46765. tempObj.analystName = "interpolationDensity";
  46766. tempObj.param = {};
  46767. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  46768. }else if(parameter.analystName ==="interpolationidw"){
  46769. tempObj.analystName = "interpolationidw";
  46770. tempObj.param = {};
  46771. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  46772. }else if(parameter.analystName ==="interpolationRBF"){
  46773. tempObj.analystName = "interpolationRBF";
  46774. tempObj.param = {};
  46775. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  46776. }else if(parameter.analystName ==="interpolationKriging"){
  46777. tempObj.analystName = "interpolationKriging";
  46778. tempObj.param = {};
  46779. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  46780. }else if(parameter.analystName ==="thiessenpolygon"){
  46781. tempObj.analystName = "thiessenpolygon";
  46782. tempObj.param = {};
  46783. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  46784. }else {
  46785. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  46786. return parameter;
  46787. }
  46788. return tempObj;
  46789. }
  46790. /**
  46791. * @override
  46792. */
  46793. destroy() {
  46794. super.destroy();
  46795. }
  46796. }
  46797. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  46798. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46799. * This program are made available under the terms of the Apache License, Version 2.0
  46800. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46801. /**
  46802. * @class TilesetsService
  46803. * @deprecatedclass SuperMap.TilesetsService
  46804. * @category iServer Map Tilesets
  46805. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  46806. * @extends {CommonServiceBase}
  46807. * @param {string} url - 服务地址。URL 应为:
  46808. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  46809. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  46810. * @param {Object} options - 参数。
  46811. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  46812. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  46813. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46814. * @param {Object} [options.headers] - 请求头。
  46815. * @usage
  46816. */
  46817. class TilesetsService extends CommonServiceBase {
  46818. constructor(url, options) {
  46819. super(url, options);
  46820. this.CLASS_NAME = "SuperMap.TilesetsService";
  46821. }
  46822. /**
  46823. * @override
  46824. */
  46825. destroy() {
  46826. super.destroy();
  46827. }
  46828. /**
  46829. * @function TilesetsService.prototype.processAsync
  46830. * @description 负责将客户端的查询参数传递到服务端。
  46831. */
  46832. processAsync() {
  46833. if (!this.url) {
  46834. return;
  46835. }
  46836. var me = this;
  46837. me.url = Util_Util.urlPathAppend(me.url, 'tilesets');
  46838. me.request({
  46839. method: "GET",
  46840. scope: me,
  46841. success: me.serviceProcessCompleted,
  46842. failure: me.serviceProcessFailed
  46843. });
  46844. }
  46845. }
  46846. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  46847. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46848. * This program are made available under the terms of the Apache License, Version 2.0
  46849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46850. /**
  46851. * @class TopologyValidatorJobsParameter
  46852. * @deprecatedclass SuperMap.TopologyValidatorJobsParameter
  46853. * @category iServer ProcessingService TopologyValidator
  46854. * @classdesc 拓扑检查分析任务参数类。
  46855. * @param {Object} options - 参数。
  46856. * @param {string} options.datasetName - 数据集名。
  46857. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  46858. * @param {TopologyValidatorRule} [options.rule=TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  46859. * @param {string} [options.tolerance] - 容限。
  46860. * @param {OutputSetting} [options.output] - 输出参数设置。
  46861. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  46862. * @usage
  46863. */
  46864. class TopologyValidatorJobsParameter {
  46865. constructor(options) {
  46866. if (!options) {
  46867. return;
  46868. }
  46869. /**
  46870. * @member {string} TopologyValidatorJobsParameter.prototype.datasetName
  46871. * @description 数据集名。
  46872. */
  46873. this.datasetName = "";
  46874. /**
  46875. * @member {string} TopologyValidatorJobsParameter.prototype.datasetTopology
  46876. * @description 拓扑检查对象所在的数据集名称。
  46877. */
  46878. this.datasetTopology = "";
  46879. /**
  46880. * @member {string} [TopologyValidatorJobsParameter.prototype.tolerance]
  46881. * @description 容限,指定的拓扑错误检查时使用的容限。
  46882. */
  46883. this.tolerance = "";
  46884. /**
  46885. * @member {TopologyValidatorRule} [TopologyValidatorJobsParameter.prototype.rule=TopologyValidatorRule.REGIONNOOVERLAP]
  46886. * @description 拓扑检查模式。
  46887. */
  46888. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  46889. /**
  46890. * @member {OutputSetting} [TopologyValidatorJobsParameter.prototype.output]
  46891. * @description 输出参数设置类。
  46892. */
  46893. this.output = null;
  46894. /**
  46895. * @member {MappingParameters} [TopologyValidatorJobsParameter.prototype.mappingParameters]
  46896. * @description 分析后结果可视化的参数类。
  46897. */
  46898. this.mappingParameters = null;
  46899. Util_Util.extend(this, options);
  46900. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  46901. }
  46902. /**
  46903. * @function TopologyValidatorJobsParameter.prototype.destroy
  46904. * @description 释放资源,将引用资源的属性置空。
  46905. */
  46906. destroy() {
  46907. this.datasetName = null;
  46908. this.datasetTopology = null;
  46909. this.tolerance = null;
  46910. this.rule = null;
  46911. if (this.output instanceof OutputSetting) {
  46912. this.output.destroy();
  46913. this.output = null;
  46914. }
  46915. if (this.mappingParameters instanceof MappingParameters) {
  46916. this.mappingParameters.destroy();
  46917. this.mappingParameters = null;
  46918. }
  46919. }
  46920. /**
  46921. * @function TopologyValidatorJobsParameter.toObject
  46922. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  46923. * @param {Object} tempObj - 目标对象。
  46924. * @description 生成拓扑检查分析任务对象。
  46925. */
  46926. static toObject(TopologyValidatorJobsParameter, tempObj) {
  46927. for (var name in TopologyValidatorJobsParameter) {
  46928. if (name === "datasetName") {
  46929. tempObj['input'] = tempObj['input'] || {};
  46930. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  46931. continue;
  46932. }
  46933. if (name === "output") {
  46934. tempObj['output'] = tempObj['output'] || {};
  46935. tempObj['output'] = TopologyValidatorJobsParameter[name];
  46936. continue;
  46937. }
  46938. tempObj['analyst'] = tempObj['analyst'] || {};
  46939. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  46940. if(name === 'mappingParameters'){
  46941. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  46942. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  46943. }
  46944. }
  46945. }
  46946. }
  46947. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  46948. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46949. * This program are made available under the terms of the Apache License, Version 2.0
  46950. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46951. /**
  46952. * @class TopologyValidatorJobsService
  46953. * @deprecatedclass SuperMap.TopologyValidatorJobsService
  46954. * @category iServer ProcessingService TopologyValidator
  46955. * @classdesc 拓扑检查分析服务类
  46956. * @extends {ProcessingServiceBase}
  46957. * @param {string} url - 服务地址。
  46958. * @param {Object} options - 可选参数。
  46959. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46960. * @param {Object} [options.headers] - 请求头。
  46961. * @usage
  46962. */
  46963. class TopologyValidatorJobsService extends ProcessingServiceBase {
  46964. constructor(url, options) {
  46965. super(url, options);
  46966. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  46967. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  46968. }
  46969. /**
  46970. *@override
  46971. */
  46972. destroy() {
  46973. super.destroy();
  46974. }
  46975. /**
  46976. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  46977. * @description 获取拓扑检查分析所有任务
  46978. */
  46979. getTopologyValidatorJobs() {
  46980. super.getJobs(this.url);
  46981. }
  46982. /**
  46983. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  46984. * @description 获取指定id的拓扑检查分析服务
  46985. * @param {string} id - 指定要获取数据的id
  46986. */
  46987. getTopologyValidatorJob(id) {
  46988. super.getJobs( Util_Util.urlPathAppend(this.url, id));
  46989. }
  46990. /**
  46991. * @function TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  46992. * @description 新建拓扑检查分析服务
  46993. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  46994. * @param {number} seconds -创建成功结果的时间间隔。
  46995. */
  46996. addTopologyValidatorJob(params, seconds) {
  46997. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  46998. }
  46999. }
  47000. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  47001. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47002. * This program are made available under the terms of the Apache License, Version 2.0
  47003. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47004. /**
  47005. * @class TransferLine
  47006. * @deprecatedclass SuperMap.TransferLine
  47007. * @category iServer TrafficTransferAnalyst TransferPath
  47008. * @classdesc 换乘路线信息类。
  47009. * @param {Object} options - 参数。
  47010. * @param {number} options.lineID - 乘车路线 ID。
  47011. * @param {string} options.lineName - 乘车路线名称。
  47012. * @param {string} options.lineAliasName - 乘车路线别名。
  47013. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  47014. * @param {string} options.startStopName - 上车站点名称。
  47015. * @param {string} options.startStopAliasName - 上车站点别名。
  47016. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  47017. * @param {string} options.endStopName - 下车站点名称。
  47018. * @param {string} options.endStopAliasName - 下车站点别名。
  47019. * @usage
  47020. */
  47021. class TransferLine {
  47022. constructor(options) {
  47023. options = options || {};
  47024. /**
  47025. * @member {number} TransferLine.prototype.lineID
  47026. * @description 乘车路线 ID。
  47027. */
  47028. this.lineID = null;
  47029. /**
  47030. * @member {string} TransferLine.prototype.lineName
  47031. * @description 乘车路线名称。
  47032. */
  47033. this.lineName = null;
  47034. /**
  47035. * @member {string} TransferLine.prototype.lineAliasName
  47036. * @description 乘车路线别名。
  47037. */
  47038. this.lineAliasName = null;
  47039. /**
  47040. * @member {number} TransferLine.prototype.startStopIndex
  47041. * @description 上车站点在本公交路线中的索引。
  47042. */
  47043. this.startStopIndex = null;
  47044. /**
  47045. * @member {string} TransferLine.prototype.startStopName
  47046. * @description 上车站点名称。
  47047. */
  47048. this.startStopName = null;
  47049. /**
  47050. * @member {string} TransferLine.prototype.startStopAliasName
  47051. * @description 上车站点别名。
  47052. */
  47053. this.startStopAliasName = null;
  47054. /**
  47055. * @member {number} TransferLine.prototype.endStopIndex
  47056. * @description 下车站点在本公交路线中的索引。
  47057. */
  47058. this.endStopIndex = null;
  47059. /**
  47060. * @member {string} TransferLine.prototype.endStopName
  47061. * @description 下车站点名称。
  47062. */
  47063. this.endStopName = null;
  47064. /**
  47065. * @member {string} TransferLine.prototype.endStopAliasName
  47066. * @description 下车站点别名。
  47067. */
  47068. this.endStopAliasName = null;
  47069. Util_Util.extend(this, options);
  47070. this.CLASS_NAME = "SuperMap.TransferLine";
  47071. }
  47072. /**
  47073. * @function TransferLine.prototype.destroy
  47074. * @description 释放资源,将引用资源的属性置空。
  47075. */
  47076. destroy() {
  47077. Util_Util.reset(this);
  47078. }
  47079. /**
  47080. * @function TransferLine.fromJson
  47081. * @description 将返回结果转化为 {@link TransferLine} 对象。
  47082. * @param {Object} jsonObject - 新的返回结果。
  47083. * @returns {TransferLine} 转化后的 {@link TransferLine} 对象。
  47084. */
  47085. static fromJson(jsonObject) {
  47086. if (!jsonObject) {
  47087. return;
  47088. }
  47089. return new TransferLine({
  47090. lineID: jsonObject['lineID'],
  47091. lineName: jsonObject['lineName'],
  47092. lineAliasName: jsonObject['lineAliasName'],
  47093. startStopIndex: jsonObject['startStopIndex'],
  47094. startStopName: jsonObject['startStopName'],
  47095. startStopAliasName: jsonObject['startStopAliasName'],
  47096. endStopIndex: jsonObject['endStopIndex'],
  47097. endStopName: jsonObject['endStopName'],
  47098. endStopAliasName: jsonObject['endStopAliasName']
  47099. });
  47100. }
  47101. }
  47102. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  47103. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47104. * This program are made available under the terms of the Apache License, Version 2.0
  47105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47106. /**
  47107. * @class TransferPathParameters
  47108. * @deprecatedclass SuperMap.TransferPathParameters
  47109. * @category iServer TrafficTransferAnalyst TransferPath
  47110. * @classdesc 交通换乘线路查询参数类。
  47111. * @param {Object} options - 参数。
  47112. * @param {Array.<TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  47113. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  47114. * @usage
  47115. */
  47116. class TransferPathParameters {
  47117. constructor(options) {
  47118. options = options || {};
  47119. /**
  47120. * @member {Array.<TransferLine>} TransferPathParameters.prototype.transferLines
  47121. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  47122. */
  47123. this.transferLines = null;
  47124. /**
  47125. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferPathParameters.prototype.points
  47126. * @description 两种查询方式:<br>
  47127. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  47128. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  47129. */
  47130. this.points = null;
  47131. Util_Util.extend(this, options);
  47132. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  47133. }
  47134. /**
  47135. * @function TransferPathParameters.prototype.destroy
  47136. * @description 释放资源,将引用资源的属性置空。
  47137. */
  47138. destroy() {
  47139. Util_Util.reset(this);
  47140. }
  47141. /**
  47142. * @function TransferPathParameters.toJson
  47143. * @description 将 {@link TransferPathParameters} 对象参数转换为 JSON 字符串。
  47144. * @param {TransferPathParameters} params - 交通换乘参数。
  47145. * @returns {string} 转化后的 JSON 字符串。
  47146. */
  47147. static toJson(params) {
  47148. if (params) {
  47149. return Util_Util.toJSON(params);
  47150. }
  47151. }
  47152. }
  47153. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  47154. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47155. * This program are made available under the terms of the Apache License, Version 2.0
  47156. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47157. /**
  47158. * @class TransferPathService
  47159. * @deprecatedclass SuperMap.TransferPathService
  47160. * @category iServer TrafficTransferAnalyst TransferPath
  47161. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  47162. * 返回结果通过该类支持的事件的监听函数参数获取
  47163. * @extends {CommonServiceBase}
  47164. * @example 例如:
  47165. * var myService = new TransferPathService(url, {eventListeners: {
  47166. * "processCompleted": TrafficTransferCompleted,
  47167. * "processFailed": TrafficTransferError
  47168. * }
  47169. * };
  47170. * @param {string} url - 服务地址。
  47171. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  47172. * @param {Object} options - 参数。
  47173. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47174. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47175. * @param {Object} [options.headers] - 请求头。
  47176. * @usage
  47177. */
  47178. class TransferPathService extends CommonServiceBase {
  47179. constructor(url, options) {
  47180. super(url, options);
  47181. this.CLASS_NAME = "SuperMap.TransferPathService";
  47182. }
  47183. /**
  47184. * @override
  47185. */
  47186. destroy() {
  47187. super.destroy();
  47188. }
  47189. /**
  47190. * @function TransferPathService.prototype.processAsync
  47191. * @description 负责将客户端的更新参数传递到服务端。
  47192. * @param {TransferPathParameters} params - 交通换乘参数。
  47193. */
  47194. processAsync(params) {
  47195. if (!(params instanceof TransferPathParameters)) {
  47196. return;
  47197. }
  47198. var me = this,
  47199. method = "GET",
  47200. jsonParameters;
  47201. me.url = Util_Util.urlPathAppend(me.url, 'path');
  47202. jsonParameters = {
  47203. points: Util_Util.toJSON(params.points),
  47204. transferLines: Util_Util.toJSON(params['transferLines'])
  47205. };
  47206. me.request({
  47207. method: method,
  47208. params: jsonParameters,
  47209. scope: me,
  47210. success: me.serviceProcessCompleted,
  47211. failure: me.serviceProcessFailed
  47212. });
  47213. }
  47214. }
  47215. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  47216. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47217. * This program are made available under the terms of the Apache License, Version 2.0
  47218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47219. /**
  47220. * @class TransferSolutionParameters
  47221. * @deprecatedclass SuperMap.TransferSolutionParameters
  47222. * @category iServer TrafficTransferAnalyst TransferSolutions
  47223. * @classdesc 交通换乘方案查询参数类。
  47224. * @param {Object} options - 参数。
  47225. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  47226. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  47227. * @param {TransferTactic} [options.transferTactic=TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  47228. * @param {TransferPreference} [options.transferPreference=TransferPreference.NONE] - 乘车偏好枚举。
  47229. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  47230. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  47231. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  47232. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  47233. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  47234. * @param {string} [options.travelTime] - 出行的时间。
  47235. * @usage
  47236. */
  47237. class TransferSolutionParameters {
  47238. constructor(options) {
  47239. options = options || {};
  47240. /**
  47241. * @member {number} [TransferSolutionParameters.prototype.solutionCount=6]
  47242. * @description 乘车方案的数量。
  47243. */
  47244. this.solutionCount = 6;
  47245. /**
  47246. * @member {TransferPreference} [TransferSolutionParameters.prototype.transferPreference=TransferPreference.NONE]
  47247. * @description 乘车偏好枚举。
  47248. */
  47249. this.transferPreference = TransferPreference.NONE;
  47250. /**
  47251. * @member {TransferTactic} [TransferSolutionParameters.prototype.transferTactic=TransferTactic|TransferTactic.LESS_TIME]
  47252. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  47253. */
  47254. this.transferTactic = TransferTactic.LESS_TIME;
  47255. /**
  47256. * @member {number} [TransferSolutionParameters.prototype.walkingRatio=10]
  47257. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  47258. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  47259. * 方案1:坐车 10 公里,走路 1 公里;</br>
  47260. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  47261. * 1. 假设权重比为 15:</br>
  47262. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  47263. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  47264. * 此时方案 2 消耗更低。</br>
  47265. * 2. 假设权重比为2:</br>
  47266. * •方案 1 的总消耗为:10+1*2 = 12</br>
  47267. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  47268. * 此时方案 1 消耗更低。</br>
  47269. */
  47270. this.walkingRatio = null;
  47271. /**
  47272. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferSolutionParameters.prototype.points
  47273. * @description 两种查询方式:</br>
  47274. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  47275. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  47276. */
  47277. this.points = false;
  47278. /**
  47279. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeLinesnull]
  47280. * @description 避让路线 ID。
  47281. * */
  47282. this.evadeLines = null;
  47283. /**
  47284. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeStops=TransferLine]
  47285. * @description 避让站点 ID。
  47286. * */
  47287. this.evadeStops = null;
  47288. /**
  47289. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorLines]
  47290. * @description 优先路线 ID。
  47291. * */
  47292. this.priorLines = null;
  47293. /**
  47294. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorStops]
  47295. * @description 优先站点 ID。
  47296. * */
  47297. this.priorStops = null;
  47298. /**
  47299. * @member {string} TransferSolutionParameters.prototype.travelTime
  47300. * @description 出行的时间;格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  47301. */
  47302. this.travelTime = null;
  47303. Util_Util.extend(this, options);
  47304. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  47305. }
  47306. /**
  47307. * @function TransferSolutionParameters.prototype.destroy
  47308. * @description 释放资源,将引用资源的属性置空。
  47309. */
  47310. destroy() {
  47311. Util_Util.reset(this);
  47312. }
  47313. /**
  47314. * @function TransferSolutionParameters.toJsonParameters
  47315. * @description 将 {@link TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  47316. * @param {TransferSolutionParameters} params - 交通换乘参数。
  47317. * @returns {string} 转化后的 JSON 字符串。
  47318. */
  47319. static toJson(params) {
  47320. if (params) {
  47321. return Util_Util.toJSON(params);
  47322. }
  47323. }
  47324. }
  47325. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  47326. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47327. * This program are made available under the terms of the Apache License, Version 2.0
  47328. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47329. /**
  47330. * @class TransferSolutionService
  47331. * @deprecatedclass SuperMap.TransferSolutionService
  47332. * @category iServer TrafficTransferAnalyst TransferSolutions
  47333. * @classdesc 交通换乘方案查询服务类。
  47334. * 返回结果通过该类支持的事件的监听函数参数获取。
  47335. * @param {string} url - 服务地址。
  47336. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  47337. * @param {Object} options - 参数。</br>
  47338. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  47339. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47340. * @param {Object} [options.headers] - 请求头。
  47341. * @extends {CommonServiceBase}
  47342. * @example 例如:
  47343. * (start code)
  47344. * var myService = new TransferSolutionService(url, {eventListeners: {
  47345. * "processCompleted": trafficTransferCompleted,
  47346. * "processFailed": trafficTransferError
  47347. * }
  47348. * };
  47349. * (end)
  47350. * @usage
  47351. */
  47352. class TransferSolutionService extends CommonServiceBase {
  47353. constructor(url, options) {
  47354. super(url, options);
  47355. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  47356. }
  47357. /**
  47358. * @override
  47359. */
  47360. destroy() {
  47361. super.destroy();
  47362. }
  47363. /**
  47364. * @function TransferSolutionService.prototype.processAsync
  47365. * @description 负责将客户端的更新参数传递到服务端。
  47366. * @param {TransferSolutionParameters} params - 交通换乘参数。
  47367. */
  47368. processAsync(params) {
  47369. if (!(params instanceof TransferSolutionParameters)) {
  47370. return;
  47371. }
  47372. var me = this,
  47373. method = "GET",
  47374. jsonParameters;
  47375. me.url = Util_Util.urlPathAppend(me.url, 'solutions');
  47376. jsonParameters = {
  47377. points: Util_Util.toJSON(params.points),
  47378. walkingRatio: params['walkingRatio'],
  47379. transferTactic: params['transferTactic'],
  47380. solutionCount: params['solutionCount'],
  47381. transferPreference: params["transferPreference"]
  47382. };
  47383. if (params.evadeLines) {
  47384. jsonParameters["evadeLines"] = Util_Util.toJSON(params.evadeLines);
  47385. }
  47386. if (params.evadeStops) {
  47387. jsonParameters["evadeStops"] = Util_Util.toJSON(params.evadeStops);
  47388. }
  47389. if (params.priorLines) {
  47390. jsonParameters["priorLines"] = Util_Util.toJSON(params.priorLines);
  47391. }
  47392. if (params.priorStops) {
  47393. jsonParameters["priorStops"] = Util_Util.toJSON(params.priorStops);
  47394. }
  47395. if (params.travelTime) {
  47396. jsonParameters["travelTime"] = params.travelTime;
  47397. }
  47398. me.request({
  47399. method: method,
  47400. params: jsonParameters,
  47401. scope: me,
  47402. success: me.serviceProcessCompleted,
  47403. failure: me.serviceProcessFailed
  47404. });
  47405. }
  47406. }
  47407. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  47408. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47409. * This program are made available under the terms of the Apache License, Version 2.0
  47410. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47411. /**
  47412. * @class UpdateEdgeWeightParameters
  47413. * @deprecatedclass SuperMap.UpdateEdgeWeightParameters
  47414. * @category iServer NetworkAnalyst EdgeWeight
  47415. * @classdesc 边的耗费权重更新服务参数类。
  47416. * @param {Object} options - 参数。
  47417. * @param {string} options.edgeId - 所在边的 ID。
  47418. * @param {string} options.fromNodeId - 起始转向点的 ID。
  47419. * @param {string} options.toNodeId - 终止转向点的 ID。
  47420. * @param {string} options.weightField - 边的耗费字段。
  47421. * @param {string} options.edgeWeight - 耗费权重。
  47422. * @usage
  47423. */
  47424. class UpdateEdgeWeightParameters {
  47425. constructor(options) {
  47426. if (!options) {
  47427. return;
  47428. }
  47429. /**
  47430. * @member {string} UpdateEdgeWeightParameters.prototype.edgeId
  47431. * @description 所在边的 ID。
  47432. */
  47433. this.edgeId = "";
  47434. /**
  47435. * @member {string} UpdateEdgeWeightParameters.prototype.fromNodeId
  47436. * @description 起始转向点的 ID。
  47437. */
  47438. this.fromNodeId = "";
  47439. /**
  47440. * @member {string} UpdateEdgeWeightParameters.prototype.toNodeId
  47441. * @description 终止转向点的 ID。
  47442. */
  47443. this.toNodeId = "";
  47444. /**
  47445. * @member {string} UpdateEdgeWeightParameters.prototype.weightField
  47446. * @description 边的耗费字段。
  47447. */
  47448. this.weightField = "";
  47449. /**
  47450. * @member {string} UpdateEdgeWeightParameters.prototype.edgeWeight
  47451. * @description 耗费权重。
  47452. */
  47453. this.edgeWeight = "";
  47454. Util_Util.extend(this, options);
  47455. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  47456. }
  47457. /**
  47458. * @function UpdateEdgeWeightParameters.prototype.destroy
  47459. * @description 释放资源,将引用资源的属性置空。
  47460. */
  47461. destroy() {
  47462. this.edgeId = null;
  47463. this.fromNodeId = null;
  47464. this.toNodeId = null;
  47465. this.weightField = null;
  47466. this.edgeWeight = null;
  47467. }
  47468. }
  47469. ;// CONCATENATED MODULE: ./src/common/iServer/CreateDatasetParameters.js
  47470. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47471. * This program are made available under the terms of the Apache License, Version 2.0
  47472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47473. /**
  47474. * @class CreateDatasetParameters
  47475. * @deprecatedclass SuperMap.CreateDatasetParameters
  47476. * @category iServer Data Dataset
  47477. * @classdesc 数据集创建参数类。
  47478. * @param {Object} options - 参数。
  47479. * @param {string} options.datasourceName - 数据源名称,此为必选参数。
  47480. * @param {string} options.datasetName - 数据集名称,此为必选参数。
  47481. * @param {string} options.datasetType - 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  47482. * @usage
  47483. */
  47484. class CreateDatasetParameters {
  47485. constructor(options) {
  47486. if (!options) {
  47487. return;
  47488. }
  47489. /**
  47490. * @member {string} CreateDatasetParameters.prototype.datasourceName
  47491. * @description 数据源名称,此为必选参数。
  47492. */
  47493. this.datasourceName = null;
  47494. /**
  47495. * @member {string} CreateDatasetParameters.prototype.datasetName
  47496. * @description 数据集名称,此为必选参数。
  47497. */
  47498. this.datasetName = null;
  47499. /**
  47500. * @member {string} CreateDatasetParameters.prototype.datasetType
  47501. * @description 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  47502. */
  47503. this.datasetType = null;
  47504. if (options) {
  47505. Util_Util.extend(this, options);
  47506. }
  47507. this.CLASS_NAME = "SuperMap.CreateDatasetParameters";
  47508. }
  47509. /**
  47510. * @function CreateDatasetParameters.prototype.destroy
  47511. * @description 释放资源,将引用资源的属性置空。
  47512. */
  47513. destroy() {
  47514. var me = this;
  47515. me.datasourceName = null;
  47516. me.datasetName = null;
  47517. me.datasetType = null;
  47518. }
  47519. }
  47520. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  47521. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47522. * This program are made available under the terms of the Apache License, Version 2.0
  47523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47524. /**
  47525. * @class UpdateEdgeWeightService
  47526. * @deprecatedclass SuperMap.UpdateEdgeWeightService
  47527. * @category iServer NetworkAnalyst EdgeWeight
  47528. * @classdesc 更新边的边的耗费权重服务
  47529. * @extends {NetworkAnalystServiceBase}
  47530. * @example
  47531. *(start code)
  47532. * var updateEdgeWeightService = new UpdateEdgeWeightService(url, {
  47533. * eventListeners: {
  47534. * "processCompleted": UpdateEdgeWeightCompleted,
  47535. * "processFailed": UpdateEdgeWeightError
  47536. * }
  47537. * });
  47538. * (end)
  47539. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  47540. * @param {Object} options - 参数。
  47541. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47542. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47543. * @param {Object} [options.headers] - 请求头。
  47544. * @usage
  47545. */
  47546. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  47547. constructor(url, options) {
  47548. super(url, options);
  47549. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  47550. }
  47551. /**
  47552. * @override
  47553. */
  47554. destroy() {
  47555. super.destroy();
  47556. }
  47557. /**
  47558. * @function UpdateEdgeWeightService.prototype.processAsync
  47559. * @description 开始异步执行边的边的耗费权重的更新
  47560. * @param {UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  47561. * @example
  47562. * (code)
  47563. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  47564. * edgeId:"20",
  47565. * fromNodeId:"26",
  47566. * toNodeId:"109",
  47567. * weightField:"time",
  47568. * edgeWeight:"25"
  47569. * });
  47570. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  47571. * (end)
  47572. */
  47573. processAsync(params) {
  47574. if (!(params instanceof UpdateEdgeWeightParameters)) {
  47575. return;
  47576. }
  47577. var me = this;
  47578. var paramStr = me.parse(params);
  47579. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  47580. var data = params.edgeWeight ? params.edgeWeight : null;
  47581. me.request({
  47582. method: "PUT",
  47583. scope: me,
  47584. data: data,
  47585. success: me.serviceProcessCompleted,
  47586. failure: me.serviceProcessFailed
  47587. });
  47588. }
  47589. /**
  47590. * @function UpdateEdgeWeightService.prototype.parse
  47591. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  47592. */
  47593. parse(params) {
  47594. if (!params) {
  47595. return;
  47596. }
  47597. var paramStr = "";
  47598. for (var attr in params) {
  47599. if (params[attr] === "" || params[attr] === "edgeWeight") {
  47600. continue;
  47601. }
  47602. switch (attr) {
  47603. case "edgeId":
  47604. paramStr += "/edgeweight/" + params[attr];
  47605. break;
  47606. case "fromNodeId":
  47607. paramStr += "/fromnode/" + params[attr];
  47608. break;
  47609. case "toNodeId":
  47610. paramStr += "/tonode/" + params[attr];
  47611. break;
  47612. case "weightField":
  47613. paramStr += "/weightfield/" + params[attr];
  47614. break;
  47615. default :
  47616. break;
  47617. }
  47618. }
  47619. return paramStr;
  47620. }
  47621. }
  47622. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  47623. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47624. * This program are made available under the terms of the Apache License, Version 2.0
  47625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47626. /**
  47627. * @class UpdateTurnNodeWeightParameters
  47628. * @deprecatedclass SuperMap.UpdateTurnNodeWeightParameters
  47629. * @category iServer NetworkAnalyst TurnNodeWeight
  47630. * @classdesc 转向耗费权重更新服务参数类。
  47631. * @param {Object} options - 参数。
  47632. * @param {string} options.nodeId - 转向结点的 ID。
  47633. * @param {string} options.fromEdgeId - 起始边的 ID。
  47634. * @param {string} options.toEdgeId - 终止边的 ID。
  47635. * @param {string} options.weightField - 转向结点的耗费字段。
  47636. * @param {string} options.turnNodeWeight - 耗费权重。
  47637. * @usage
  47638. */
  47639. class UpdateTurnNodeWeightParameters {
  47640. constructor(options) {
  47641. if (!options) {
  47642. return;
  47643. }
  47644. /**
  47645. * @member {string} UpdateTurnNodeWeightParameters.prototype.nodeId
  47646. * @description 转向结点的 ID。
  47647. */
  47648. this.nodeId = "";
  47649. /**
  47650. * @member {string} UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  47651. * @description 起始边的 ID。
  47652. */
  47653. this.fromEdgeId = "";
  47654. /**
  47655. * @member {string} UpdateTurnNodeWeightParameters.prototype.toEdgeId
  47656. * @description 终止边的 ID。
  47657. */
  47658. this.toEdgeId = "";
  47659. /**
  47660. * @member {string} UpdateTurnNodeWeightParameters.prototype.weightField
  47661. * @description 转向结点的耗费字段。
  47662. */
  47663. this.weightField = "";
  47664. /**
  47665. * @member {string} UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  47666. * @description 耗费权重。
  47667. */
  47668. this.turnNodeWeight = "";
  47669. Util_Util.extend(this, options);
  47670. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  47671. }
  47672. /**
  47673. * @function UpdateTurnNodeWeightParameters.prototype.destroy
  47674. * @description 释放资源,将引用资源的属性置空。
  47675. */
  47676. destroy() {
  47677. this.nodeId = null;
  47678. this.fromEdgeId = null;
  47679. this.toEdgeId = null;
  47680. this.weightField = null;
  47681. this.turnNodeWeight = null;
  47682. }
  47683. }
  47684. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  47685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47686. * This program are made available under the terms of the Apache License, Version 2.0
  47687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47688. /**
  47689. * @class UpdateTurnNodeWeightService
  47690. * @deprecatedclass SuperMap.UpdateTurnNodeWeightService
  47691. * @category iServer NetworkAnalyst TurnNodeWeight
  47692. * @classdesc 转向耗费权重更新服务类
  47693. * @extends {NetworkAnalystServiceBase}
  47694. * @example
  47695. * var UpdateTurnNodeWeightService = new UpdateTurnNodeWeightService(url, {
  47696. * eventListeners: {
  47697. * "processCompleted": UpdateTurnNodeWeightCompleted,
  47698. * "processFailed": UpdateTurnNodeWeightError
  47699. * }
  47700. * });
  47701. * @param {string} url - 服务地址。如:
  47702. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  47703. * @param {Object} options - 参数。
  47704. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47705. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47706. * @param {Object} [options.headers] - 请求头。
  47707. * @usage
  47708. */
  47709. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  47710. constructor(url, options) {
  47711. super(url, options);
  47712. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  47713. }
  47714. /**
  47715. * @override
  47716. */
  47717. destroy() {
  47718. super.destroy();
  47719. }
  47720. /**
  47721. * @function UpdateTurnNodeWeightService.prototype.processAsync
  47722. * @description 开始异步执行转向耗费权重的更新
  47723. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  47724. * @example
  47725. * (code)
  47726. * var updateTurnNodeWeightParam=new UpdateTurnNodeWeightParameters({
  47727. * nodeId:"106",
  47728. * fromEdgeId:"6508",
  47729. * toEdgeId:"6504",
  47730. * weightField:"TurnCost",
  47731. * turnNodeWeight:"50"
  47732. * });
  47733. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  47734. * (end)
  47735. **/
  47736. processAsync(params) {
  47737. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  47738. return;
  47739. }
  47740. var me = this;
  47741. var paramStr = me.parse(params);
  47742. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  47743. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  47744. me.request({
  47745. method: "PUT",
  47746. scope: me,
  47747. data: data,
  47748. success: me.serviceProcessCompleted,
  47749. failure: me.serviceProcessFailed
  47750. });
  47751. }
  47752. /**
  47753. * @function UpdateTurnNodeWeightService.prototype.parse
  47754. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  47755. */
  47756. parse(params) {
  47757. if (!params) {
  47758. return;
  47759. }
  47760. var paramStr = "";
  47761. for (var attr in params) {
  47762. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  47763. continue;
  47764. }
  47765. switch (attr) {
  47766. case "nodeId":
  47767. paramStr += "/turnnodeweight/" + params[attr];
  47768. break;
  47769. case "fromEdgeId":
  47770. paramStr += "/fromedge/" + params[attr];
  47771. break;
  47772. case "toEdgeId":
  47773. paramStr += "/toedge/" + params[attr];
  47774. break;
  47775. case "weightField":
  47776. paramStr += "/weightfield/" + params[attr];
  47777. break;
  47778. default :
  47779. break;
  47780. }
  47781. }
  47782. return paramStr;
  47783. }
  47784. }
  47785. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateDatasetParameters.js
  47786. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47787. * This program are made available under the terms of the Apache License, Version 2.0
  47788. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47789. /**
  47790. * @class UpdateDatasetParameters
  47791. * @deprecatedclass SuperMap.UpdateDatasetParameters
  47792. * @category iServer Data Dataset
  47793. * @classdesc 数据集信息更改参数类。
  47794. * @param {Object} options - 参数。
  47795. * @param {string} options.datasourceName - 数据源名称。
  47796. * @param {string} options.datasetName - 数据集名称。
  47797. * @param {boolean} options.isFileCache - 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  47798. * @param {string} options.description - 数据集描述信息。
  47799. * @param {string} options.prjCoordSys - 投影坐标系。
  47800. * @param {Object} options.charset - 矢量数据集的字符集。当数据集类型为矢量数据集时,可以传递此参数。如果用户传递空值,则编码方式保持不变。
  47801. * @param {Array.<string>} options.palette - 影像数据的颜色调色板。当数据集类型为影像数据集时,可以传递此参数。
  47802. * @param {number} options.noValue - 栅格数据集中没有数据的像元的栅格值。当数据集类型为栅格数据集时,可以传递此参数。
  47803. * @usage
  47804. */
  47805. class UpdateDatasetParameters {
  47806. constructor(options) {
  47807. if (!options) {
  47808. return;
  47809. }
  47810. /**
  47811. * @member {string} UpdateDatasetParameters.prototype.datasourceName
  47812. * @description 数据源名称。
  47813. */
  47814. this.datasourceName = null;
  47815. /**
  47816. * @member {string} UpdateDatasetParameters.prototype.datasetName
  47817. * @description 数据集名称。
  47818. */
  47819. this.datasetName = null;
  47820. /**
  47821. * @member {boolean} UpdateDatasetParameters.prototype.isFileCache
  47822. * @description 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  47823. */
  47824. this.isFileCache = null;
  47825. /**
  47826. * @member {string} UpdateDatasetParameters.prototype.description
  47827. * @description 数据集描述信息。
  47828. */
  47829. this.description = null;
  47830. /**
  47831. * @member {string} UpdateDatasetParameters.prototype.prjCoordSys
  47832. * @description 投影坐标系。
  47833. */
  47834. this.prjCoordSys = null;
  47835. /**
  47836. * @member {Object} UpdateDatasetParameters.prototype.charset
  47837. * @description 矢量数据集的字符集。
  47838. */
  47839. this.charset = null;
  47840. /**
  47841. * @member {Array.<string>} UpdateDatasetParameters.prototype.palette
  47842. * @description 影像数据的颜色调色板。
  47843. */
  47844. this.palette = null;
  47845. /**
  47846. * @member {number} UpdateDatasetParameters.prototype.noValue
  47847. * @description 栅格数据集中没有数据的像元的栅格值。
  47848. */
  47849. this.noValue = null;
  47850. if (options) {
  47851. Util_Util.extend(this, options);
  47852. }
  47853. this.CLASS_NAME = "SuperMap.UpdateDatasetParameters";
  47854. }
  47855. /**
  47856. * @function UpdateDatasetParameters.prototype.destroy
  47857. * @description 释放资源,将引用资源的属性置空。
  47858. */
  47859. destroy() {
  47860. var me = this;
  47861. me.datasourceName = null;
  47862. me.datasetName = null;
  47863. me.isFileCache = null;
  47864. me.prjCoordSys = null;
  47865. me.charset = null;
  47866. me.palette = null;
  47867. me.noValue = null;
  47868. }
  47869. }
  47870. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  47871. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47872. * This program are made available under the terms of the Apache License, Version 2.0
  47873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47874. /**
  47875. * @class VectorClipJobsParameter
  47876. * @deprecatedclass SuperMap.VectorClipJobsParameter
  47877. * @category iServer ProcessingService VectorClip
  47878. * @classdesc 矢量裁剪分析任务参数类。
  47879. * @param {Object} options - 参数。
  47880. * @param {string} options.datasetName - 数据集名。
  47881. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  47882. * @param {ClipAnalystMode} [options.mode=ClipAnalystMode.CLIP] - 裁剪分析模式。
  47883. * @param {string} [options.geometryClip] - 裁剪几何对象。
  47884. * @param {OutputSetting} [options.output] - 输出参数设置。
  47885. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  47886. * @usage
  47887. */
  47888. class VectorClipJobsParameter {
  47889. constructor(options) {
  47890. options = options || {};
  47891. /**
  47892. * @member {string} VectorClipJobsParameter.prototype.datasetName
  47893. * @description 数据集名。
  47894. */
  47895. this.datasetName = "";
  47896. /**
  47897. * @member {string} VectorClipJobsParameter.prototype.datasetOverlay
  47898. * @description 裁剪对象数据集。
  47899. */
  47900. this.datasetVectorClip = "";
  47901. /**
  47902. * @member {string} VectorClipJobsParameter.prototype.geometryClip
  47903. * @description 裁剪几何对象。
  47904. */
  47905. this.geometryClip = "";
  47906. /**
  47907. * @member {ClipAnalystMode} [VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  47908. * @description 裁剪分析模式 。
  47909. */
  47910. this.mode = ClipAnalystMode.CLIP;
  47911. /**
  47912. * @member {OutputSetting} VectorClipJobsParameter.prototype.output
  47913. * @description 输出参数设置类。
  47914. */
  47915. this.output = null;
  47916. /**
  47917. * @member {MappingParameters} [VectorClipJobsParameter.prototype.mappingParameters]
  47918. * @description 分析后结果可视化的参数类。
  47919. */
  47920. this.mappingParameters = null;
  47921. Util_Util.extend(this, options);
  47922. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  47923. }
  47924. /**
  47925. * @function VectorClipJobsParameter.prototype.destroy
  47926. * @description 释放资源,将引用资源的属性置空。
  47927. */
  47928. destroy() {
  47929. this.datasetName = null;
  47930. this.datasetVectorClip = null;
  47931. this.geometryClip = null;
  47932. this.mode = null;
  47933. if (this.output instanceof OutputSetting) {
  47934. this.output.destroy();
  47935. this.output = null;
  47936. }
  47937. if (this.mappingParameters instanceof MappingParameters) {
  47938. this.mappingParameters.destroy();
  47939. this.mappingParameters = null;
  47940. }
  47941. }
  47942. /**
  47943. * @function VectorClipJobsParameter.toObject
  47944. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  47945. * @param {Object} tempObj - 目标对象。
  47946. * @description 矢量裁剪分析任务对象。
  47947. */
  47948. static toObject(vectorClipJobsParameter, tempObj) {
  47949. for (var name in vectorClipJobsParameter) {
  47950. if (name === "datasetName") {
  47951. tempObj['input'] = tempObj['input'] || {};
  47952. tempObj['input'][name] = vectorClipJobsParameter[name];
  47953. continue;
  47954. }
  47955. if (name === "output"){
  47956. tempObj['output'] = tempObj['output'] || {};
  47957. tempObj['output'] = vectorClipJobsParameter[name];
  47958. continue;
  47959. }
  47960. tempObj['analyst'] = tempObj['analyst'] || {};
  47961. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  47962. if(name === 'mappingParameters'){
  47963. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  47964. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  47965. }
  47966. }
  47967. }
  47968. }
  47969. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  47970. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47971. * This program are made available under the terms of the Apache License, Version 2.0
  47972. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47973. /**
  47974. * @class VectorClipJobsService
  47975. * @deprecatedclass SuperMap.VectorClipJobsService
  47976. * @category iServer ProcessingService VectorClip
  47977. * @classdesc 矢量裁剪分析服务类
  47978. * @extends {ProcessingServiceBase}
  47979. * @param {string} url -服务地址。
  47980. * @param {Object} options - 可选参数。
  47981. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47982. * @param {Object} [options.headers] - 请求头。
  47983. * @usage
  47984. */
  47985. class VectorClipJobsService extends ProcessingServiceBase {
  47986. constructor(url, options) {
  47987. super(url, options);
  47988. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  47989. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  47990. }
  47991. /**
  47992. *@override
  47993. */
  47994. destroy() {
  47995. super.destroy();
  47996. }
  47997. /**
  47998. * @function VectorClipJobsService.protitype.getVectorClipJobs
  47999. * @description 获取矢量裁剪分析所有任务
  48000. */
  48001. getVectorClipJobs() {
  48002. super.getJobs(this.url);
  48003. }
  48004. /**
  48005. * @function KernelDensityJobsService.protitype.getVectorClipJob
  48006. * @description 获取指定id的矢量裁剪分析服务
  48007. * @param {string} id - 指定要获取数据的id
  48008. */
  48009. getVectorClipJob(id) {
  48010. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  48011. }
  48012. /**
  48013. * @function VectorClipJobsService.protitype.addVectorClipJob
  48014. * @description 新建矢量裁剪分析服务
  48015. * @param {VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  48016. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  48017. */
  48018. addVectorClipJob(params, seconds) {
  48019. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  48020. }
  48021. }
  48022. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  48023. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48024. * This program are made available under the terms of the Apache License, Version 2.0
  48025. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48026. /**
  48027. * @class RasterFunctionParameter
  48028. * @deprecatedclass SuperMap.RasterFunctionParameter
  48029. * @category iServer Map Tile
  48030. * @classdesc iServer 地图服务栅格分析参数基类。
  48031. * @param {Object} options - 参数。
  48032. * @param {RasterFunctionType} options.type - 栅格分析方法。
  48033. * @usage
  48034. */
  48035. class RasterFunctionParameter {
  48036. constructor(options) {
  48037. options = options || {};
  48038. /**
  48039. * @member {RasterFunctionType} [RasterFunctionParameter.prototype.type]
  48040. * @description 栅格分析方法。
  48041. */
  48042. this.type = null;
  48043. Util_Util.extend(this, options);
  48044. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  48045. }
  48046. /**
  48047. * @function RasterFunctionParameter.prototype.destroy
  48048. * @description 释放资源,将资源的属性置空。
  48049. */
  48050. destroy() {
  48051. this.type = null;
  48052. }
  48053. }
  48054. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  48055. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48056. * This program are made available under the terms of the Apache License, Version 2.0
  48057. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48058. /**
  48059. * @class NDVIParameter
  48060. * @deprecatedclass SuperMap.NDVIParameter
  48061. * @category iServer Map Tile
  48062. * @classdesc 归一化植被指数参数类。
  48063. * @param {Object} options - 参数。
  48064. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  48065. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  48066. * @param {string} [options.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"] - 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  48067. * @extends {RasterFunctionParameter}
  48068. * @usage
  48069. */
  48070. class NDVIParameter extends RasterFunctionParameter {
  48071. constructor(options) {
  48072. super(options);
  48073. /**
  48074. * @member {number} [NDVIParameter.prototype.redIndex=0]
  48075. * @description 红光谱波段索引。
  48076. */
  48077. this.redIndex = 0;
  48078. /**
  48079. * @member {number} [NDVIParameter.prototype.nirIndex=1]
  48080. * @description 近红外光谱波段索引。
  48081. */
  48082. this.nirIndex = 1;
  48083. /**
  48084. * @member {string} [NDVIParameter.prototype.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"]
  48085. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  48086. */
  48087. this.colorMap =
  48088. '0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff';
  48089. /**
  48090. * @member {RasterFunctionType} [NDVIParameter.prototype.type]
  48091. * @description 栅格分析方法。
  48092. */
  48093. this.type = RasterFunctionType.NDVI;
  48094. Util_Util.extend(this, options);
  48095. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  48096. }
  48097. /**
  48098. * @function NDVIParameter.prototype.destroy
  48099. * @override
  48100. */
  48101. destroy() {
  48102. super.destroy();
  48103. this.redIndex = null;
  48104. this.nirIndex = null;
  48105. this.colorMap = null;
  48106. }
  48107. /**
  48108. * @function NDVIParameter.prototype.toJSON
  48109. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  48110. * @returns {string} 返回转换后的 JSON 字符串。
  48111. */
  48112. toJSON() {
  48113. return {
  48114. redIndex: this.redIndex,
  48115. nirIndex: this.nirIndex,
  48116. colorMap: this.colorMap,
  48117. type: this.type
  48118. };
  48119. }
  48120. }
  48121. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  48122. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48123. * This program are made available under the terms of the Apache License, Version 2.0
  48124. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48125. /**
  48126. * @class HillshadeParameter
  48127. * @deprecatedclass SuperMap.HillshadeParameter
  48128. * @category iServer Map Tile
  48129. * @classdesc 阴影面分析参数类。
  48130. * @param {Object} options - 可选参数。
  48131. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  48132. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  48133. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  48134. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  48135. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  48136. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  48137. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  48138. * Latitude Z-factor
  48139. * 0 0.00000898
  48140. * 10 0.00000912
  48141. * 20 0.00000956
  48142. * 30 0.00001036
  48143. * 40 0.00001171
  48144. * 50 0.00001395
  48145. * 60 0.00001792
  48146. * 70 0.00002619
  48147. * 80 0.00005156
  48148. * @extends {RasterFunctionParameter}
  48149. * @usage
  48150. */
  48151. class HillshadeParameter extends RasterFunctionParameter {
  48152. constructor(options) {
  48153. super(options);
  48154. /**
  48155. * @member {number} [HillshadeParameter.prototype.altitude = 45]
  48156. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  48157. */
  48158. this.altitude = 45;
  48159. /**
  48160. * @member {number} [HillshadeParameter.prototype.azimuth = 315]
  48161. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  48162. */
  48163. this.azimuth = 315;
  48164. /**
  48165. * @member {number} [HillshadeParameter.prototype.zFactor = 1]
  48166. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  48167. */
  48168. this.zFactor = 1;
  48169. /**
  48170. * @member {RasterFunctionType} HillshadeParameter.prototype.type
  48171. * @description 栅格分析方法。
  48172. */
  48173. this.type = RasterFunctionType.HILLSHADE;
  48174. Util_Util.extend(this, options);
  48175. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  48176. }
  48177. /**
  48178. * @function HillshadeParameter.prototype.destroy
  48179. * @override
  48180. */
  48181. destroy() {
  48182. super.destroy();
  48183. this.altitude = null;
  48184. this.azimuth = null;
  48185. this.zFactor = null;
  48186. }
  48187. /**
  48188. * @function HillshadeParameter.prototype.toJSON
  48189. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  48190. * @returns {string} 返回转换后的 JSON 字符串。
  48191. */
  48192. toJSON() {
  48193. return {
  48194. altitude: this.altitude,
  48195. azimuth: this.azimuth,
  48196. zFactor: this.zFactor,
  48197. type: this.type
  48198. };
  48199. }
  48200. }
  48201. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  48202. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48203. * This program are made available under the terms of the Apache License, Version 2.0
  48204. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48205. /**
  48206. * @class WebPrintingJobCustomItems
  48207. * @deprecatedclass SuperMap.WebPrintingJobCustomItems
  48208. * @classdesc Web 打印图例元素参数类。
  48209. * @version 10.1.0
  48210. * @category iServer WebPrintingJob
  48211. * @param {Object} option - 参数。
  48212. * @param {string} option.name - 图例元素的名称。
  48213. * @param {string} option.picAsUrl - 图例元素 Base64 格式图片。
  48214. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。如果已填了 URL 参数,此参数可不传。
  48215. * @usage
  48216. */
  48217. class WebPrintingJobCustomItems {
  48218. constructor(option) {
  48219. /**
  48220. * @member {string} WebPrintingJobCustomItems.prototype.name
  48221. * @description 图例元素的名称。
  48222. */
  48223. this.name = null;
  48224. /**
  48225. * @member {string} [WebPrintingJobCustomItems.prototype.picAsUrl]
  48226. * @description 图例元素 Base64 格式图片。
  48227. */
  48228. this.picAsUrl = null;
  48229. /**
  48230. * @member {string} [WebPrintingJobCustomItems.prototype.picAsBase64]
  48231. * @description 图例元素图片的获取地址。
  48232. */
  48233. this.picAsBase64 = null;
  48234. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  48235. Util_Util.extend(this, option);
  48236. }
  48237. /**
  48238. * @function WebPrintingJobCustomItems.prototype.destroy
  48239. * @description 释放资源,将引用资源的属性置空。
  48240. */
  48241. destroy() {
  48242. var me = this;
  48243. me.name = null;
  48244. me.picAsUrl = null;
  48245. me.picAsBase64 = null;
  48246. }
  48247. /**
  48248. * @function WebPrintingJobCustomItems.prototype.toJSON
  48249. * @description 将 WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  48250. * @returns {string} 转换后的 JSON 字符串。
  48251. */
  48252. toJSON() {
  48253. var params = {
  48254. name: this.name
  48255. };
  48256. if (this.title) {
  48257. params.title = this.title;
  48258. }
  48259. if (this.picAsUrl) {
  48260. params.picAsUrl = this.picAsUrl;
  48261. } else if (this.picAsBase64) {
  48262. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  48263. }
  48264. return Util_Util.toJSON(params);
  48265. }
  48266. }
  48267. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  48268. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48269. * This program are made available under the terms of the Apache License, Version 2.0
  48270. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48271. /**
  48272. * @class WebPrintingJobImage
  48273. * @deprecatedclass SuperMap.WebPrintingJobImage
  48274. * @classdesc 表达小地图的静态图片参数类。
  48275. * @version 10.1.0
  48276. * @category iServer WebPrintingJob
  48277. * @param {Object} option - 参数。
  48278. * @param {string} option.picAsUrl - 小地图的图片 URL 地址。
  48279. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。如果已填了 URL 参数,此参数可不传。
  48280. * @usage
  48281. */
  48282. class WebPrintingJobImage {
  48283. constructor(option) {
  48284. /**
  48285. * @member {string} [WebPrintingJobImage.prototype.picAsUrl]
  48286. * @description 小地图的图片 URL 地址。
  48287. */
  48288. this.picAsUrl = null;
  48289. /**
  48290. * @member {string} [WebPrintingJobImage.prototype.picAsBase64]
  48291. * @description 小地图的base64位图片信息。
  48292. */
  48293. this.picAsBase64 = null;
  48294. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  48295. Util_Util.extend(this, option);
  48296. }
  48297. /**
  48298. * @function WebPrintingJobImage.prototype.destroy
  48299. * @description 释放资源,将引用资源的属性置空。
  48300. */
  48301. destroy() {
  48302. this.picAsUrl = null;
  48303. this.picAsBase64 = null;
  48304. }
  48305. /**
  48306. * @function WebPrintingJobImage.prototype.toJSON
  48307. * @description 将 WebPrintingJobImage 对象转化为 JSON 字符串。
  48308. * @returns {string} 转换后的 JSON 字符串。
  48309. */
  48310. toJSON() {
  48311. var params = {};
  48312. if (this.picAsUrl) {
  48313. params.picAsUrl = this.picAsUrl;
  48314. }
  48315. if (this.picAsBase64) {
  48316. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  48317. }
  48318. return Util_Util.toJSON(params);
  48319. }
  48320. }
  48321. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  48322. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48323. * This program are made available under the terms of the Apache License, Version 2.0
  48324. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48325. /**
  48326. * @class WebPrintingJobLayers
  48327. * @deprecatedclass SuperMap.WebPrintingJobLayers
  48328. * @classdesc 将图例添加到布局的业务图层参数类。
  48329. * @version 10.1.0
  48330. * @category iServer WebPrintingJob
  48331. * @param {Object} option - 参数。
  48332. * @param {string} option.name - 图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  48333. * @usage
  48334. */
  48335. class WebPrintingJobLayers {
  48336. constructor(option) {
  48337. /**
  48338. * @member {string} WebPrintingJobLayers.prototype.name
  48339. * @description 图层 name。
  48340. */
  48341. this.name = null;
  48342. /**
  48343. * @member {string} WebPrintingJobLayers.prototype.layerType
  48344. * @description 图层 type。
  48345. */
  48346. this.layerType = null;
  48347. /**
  48348. * @member {string} WebPrintingJobLayers.prototype.url
  48349. * @description 图层 URL。
  48350. */
  48351. this.url = null;
  48352. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  48353. Util_Util.extend(this, option);
  48354. }
  48355. /**
  48356. * @function WebPrintingJobLayers.prototype.destroy
  48357. * @description 释放资源,将引用资源的属性置空。
  48358. */
  48359. destroy() {
  48360. this.name = null;
  48361. this.layerType = null;
  48362. this.url = null;
  48363. }
  48364. }
  48365. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  48366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48367. * This program are made available under the terms of the Apache License, Version 2.0
  48368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48369. /**
  48370. * @class WebPrintingJobLegendOptions
  48371. * @deprecatedclass SuperMap.WebPrintingJobLegendOptions
  48372. * @classdesc Web 打印图例参数类。
  48373. * @version 10.1.0
  48374. * @category iServer WebPrintingJob
  48375. * @param {Object} option - 参数。
  48376. * @param {string} [option.title] - 图例名称。
  48377. * @param {string} [option.picAsUrl] - 图例的图片 URL 地址。
  48378. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  48379. * @param {WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  48380. * @param {WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  48381. * @usage
  48382. */
  48383. class WebPrintingJobLegendOptions {
  48384. constructor(option) {
  48385. /**
  48386. * @member {string} WebPrintingJobLegendOptions.prototype.title
  48387. * @description 图例名称。
  48388. */
  48389. this.title = null;
  48390. /**
  48391. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsUrl]
  48392. * @description 图例的图片 URL 地址。
  48393. */
  48394. this.picAsUrl = null;
  48395. /**
  48396. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsBase64]
  48397. * @description 图例的 base64 位图片信息。
  48398. */
  48399. this.picAsBase64 = null;
  48400. /**
  48401. * @member {WebPrintingJobLayers} [WebPrintingJobLegendOptions.prototype.layers]
  48402. * @description 图例的布局业务图层参数类。
  48403. */
  48404. this.layers = null;
  48405. /**
  48406. * @member {WebPrintingJobCustomItems} [WebPrintingJobLegendOptions.prototype.customItems]
  48407. * @description 自定义图例元素参数类。
  48408. */
  48409. this.customItems = null;
  48410. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  48411. Util_Util.extend(this, option);
  48412. }
  48413. /**
  48414. * @function WebPrintingJobLegendOptions.prototype.destroy
  48415. * @description 释放资源,将引用资源的属性置空。
  48416. */
  48417. destroy() {
  48418. this.title = null;
  48419. this.picAsUrl = null;
  48420. this.picAsBase64 = null;
  48421. if (this.layers instanceof WebPrintingJobLayers) {
  48422. this.layers.destroy();
  48423. this.layers = null;
  48424. }
  48425. if (this.customItems instanceof WebPrintingJobCustomItems) {
  48426. this.customItems.destroy();
  48427. this.customItems = null;
  48428. }
  48429. }
  48430. /**
  48431. * @function WebPrintingJobLegendOptions.prototype.toJSON
  48432. * @description 将 WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  48433. * @returns {string} 转换后的 JSON 字符串。
  48434. */
  48435. toJSON() {
  48436. var params = {
  48437. title: this.title || ""
  48438. };
  48439. if (this.picAsUrl) {
  48440. params.picAsUrl = this.picAsUrl;
  48441. } else if (this.picAsBase64) {
  48442. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  48443. } else if (this.customItems) {
  48444. params.customItems = this.customItems;
  48445. }
  48446. return Util_Util.toJSON(params);
  48447. }
  48448. }
  48449. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  48450. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48451. * This program are made available under the terms of the Apache License, Version 2.0
  48452. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48453. /**
  48454. * @class WebPrintingJobLittleMapOptions
  48455. * @deprecatedclass SuperMap.WebPrintingJobLittleMapOptions
  48456. * @classdesc Web 打印小地图参数类。
  48457. * @version 10.1.0
  48458. * @category iServer WebPrintingJob
  48459. * @param {Object} option - 参数。
  48460. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  48461. * @param {number} [option.scale] - 小地图的比例尺。
  48462. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  48463. * @param {WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  48464. * @param {WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  48465. * @usage
  48466. */
  48467. class WebPrintingJobLittleMapOptions {
  48468. constructor(option) {
  48469. /**
  48470. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} WebPrintingJobLittleMapOptions.prototype.center
  48471. * @description 小地图的中心点。
  48472. */
  48473. this.center = null;
  48474. /**
  48475. * @member {number} [WebPrintingJobLittleMapOptions.prototype.scale]
  48476. * @description 小地图的比例尺。
  48477. */
  48478. this.scale = null;
  48479. /**
  48480. * @member {Array.<string>} WebPrintingJobLittleMapOptions.prototype.layerNames
  48481. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  48482. */
  48483. this.layerNames = null;
  48484. /**
  48485. * @member {WebPrintingJobImage} [WebPrintingJobLittleMapOptions.prototype.image]
  48486. * @description 表达小地图的静态图类。暂不支持。
  48487. */
  48488. this.image = null;
  48489. /**
  48490. * @member {WebPrintingJobLayers} [WebPrintingJobLittleMapOptions.prototype.layers]
  48491. * @description 指定 WebMap 中的 layers 图层类。
  48492. */
  48493. this.layers = null;
  48494. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  48495. Util_Util.extend(this, option);
  48496. }
  48497. /**
  48498. * @function WebPrintingJobLittleMapOptions.prototype.destroy
  48499. * @description 释放资源,将引用资源的属性置空。
  48500. */
  48501. destroy() {
  48502. this.center = null;
  48503. this.scale = null;
  48504. this.layerNames = null;
  48505. if (this.image instanceof WebPrintingJobImage) {
  48506. this.image.destroy();
  48507. this.image = null;
  48508. }
  48509. if (this.layers instanceof WebPrintingJobLayers) {
  48510. this.layers.destroy();
  48511. this.layers = null;
  48512. }
  48513. }
  48514. /**
  48515. * @function WebPrintingJobLittleMapOptions.prototype.toJSON
  48516. * @description 将 WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  48517. * @returns {string} 转换后的 JSON 字符串。
  48518. */
  48519. toJSON() {
  48520. var params = {
  48521. scale: this.scale,
  48522. center: this.center
  48523. };
  48524. if (this.layerNames) {
  48525. params.layerNames = this.layerNames;
  48526. } else if (this.layers) {
  48527. params.layers = this.layers;
  48528. }
  48529. if (this.image) {
  48530. params.image = this.image;
  48531. }
  48532. return Util_Util.toJSON(params);
  48533. }
  48534. }
  48535. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  48536. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48537. * This program are made available under the terms of the Apache License, Version 2.0
  48538. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48539. /**
  48540. * @class WebPrintingJobNorthArrowOptions
  48541. * @deprecatedclass SuperMap.WebPrintingJobNorthArrowOptions
  48542. * @classdesc Web 打印地图指北针参数类。
  48543. * @version 10.1.0
  48544. * @category iServer WebPrintingJob
  48545. * @param {Object} option - 参数。
  48546. * @param {string} option.picAsUrl - 指北针的图片 URL 地址。
  48547. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  48548. * @usage
  48549. */
  48550. class WebPrintingJobNorthArrowOptions {
  48551. constructor(option) {
  48552. /**
  48553. * @member {string} WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  48554. * @description 指北针的图片 URL 地址。
  48555. */
  48556. this.picAsUrl = null;
  48557. /**
  48558. * @member {string} [WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  48559. * @description 指北针的base64位图片信息。
  48560. */
  48561. this.picAsBase64 = null;
  48562. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  48563. Util_Util.extend(this, option);
  48564. }
  48565. /**
  48566. * @function WebPrintingJobNorthArrowOptions.prototype.destroy
  48567. * @description 释放资源,将引用资源的属性置空。
  48568. */
  48569. destroy() {
  48570. this.picAsUrl = null;
  48571. this.picAsBase64 = null;
  48572. }
  48573. /**
  48574. * @function WebPrintingJobNorthArrowOptions.prototype.toJSON
  48575. * @description 将 WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  48576. * @returns {string} 转换后的 JSON 字符串。
  48577. */
  48578. toJSON() {
  48579. var params = {};
  48580. if (this.picAsUrl) {
  48581. params.picAsUrl = this.picAsUrl;
  48582. } else if (this.picAsBase64) {
  48583. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  48584. }
  48585. return Util_Util.toJSON(params);
  48586. }
  48587. }
  48588. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  48589. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48590. * This program are made available under the terms of the Apache License, Version 2.0
  48591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48592. /**
  48593. * @class WebPrintingJobScaleBarOptions
  48594. * @deprecatedclass SuperMap.WebPrintingJobScaleBarOptions
  48595. * @classdesc Web 打印比例尺参数类。
  48596. * @category iServer WebPrintingJob
  48597. * @version 10.1.0
  48598. * @param {Object} option - 参数。
  48599. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000。
  48600. * @param {WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  48601. * @param {WebScaleType} [option.type] - 比例尺的样式。
  48602. * @param {number} [option.intervals] - 比例尺条的段数。
  48603. * @param {WebScaleUnit} [option.unit] - 比例尺的单位制。
  48604. * @usage
  48605. */
  48606. class WebPrintingJobScaleBarOptions {
  48607. constructor(option) {
  48608. /**
  48609. * @member {string} WebPrintingJobScaleBarOptions.prototype.scaleText
  48610. * @description 比例尺文本信息。
  48611. */
  48612. this.scaleText = null;
  48613. /**
  48614. * @member {WebScaleOrientationType} [WebPrintingJobScaleBarOptions.prototype.orientation]
  48615. * @description 比例尺的方位样式。
  48616. */
  48617. this.orientation = null;
  48618. /**
  48619. * @member {WebScaleType} [WebPrintingJobScaleBarOptions.prototype.type]
  48620. * @description 比例尺的样式。
  48621. */
  48622. this.type = null;
  48623. /**
  48624. * @member {Object} [WebPrintingJobScaleBarOptions.prototype.intervals]
  48625. * @description 比例尺条的段数。
  48626. */
  48627. this.intervals = null;
  48628. /**
  48629. * @member {WebScaleUnit} [WebPrintingJobScaleBarOptions.prototype.unit]
  48630. * @description 比例尺的单位制。
  48631. */
  48632. this.unit = null;
  48633. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  48634. Util_Util.extend(this, option);
  48635. }
  48636. /**
  48637. * @function WebPrintingJobScaleBarOptions.prototype.destroy
  48638. * @description 释放资源,将引用资源的属性置空。
  48639. */
  48640. destroy() {
  48641. this.scaleText = null;
  48642. this.orientation = null;
  48643. this.type = null;
  48644. this.intervals = null;
  48645. this.unit = null;
  48646. }
  48647. /**
  48648. * @function WebPrintingJobScaleBarOptions.prototype.toJSON
  48649. * @description 将 WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  48650. * @returns {string} 转换后的 JSON 字符串。
  48651. */
  48652. toJSON() {
  48653. var params = {
  48654. scaleText: this.scaleText || "",
  48655. type: this.type || "BAR",
  48656. intervals: this.intervals || "",
  48657. unit: this.unit || "METER"
  48658. };
  48659. if (this.orientation) {
  48660. params.orientation = this.orientation;
  48661. }
  48662. return Util_Util.toJSON(params);
  48663. }
  48664. }
  48665. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  48666. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48667. * This program are made available under the terms of the Apache License, Version 2.0
  48668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48669. /**
  48670. * @class WebPrintingJobContent
  48671. * @deprecatedclass SuperMap.WebPrintingJobContent
  48672. * @classdesc Web 打印内容参数类。
  48673. * @version 10.1.0
  48674. * @category iServer WebPrintingJob
  48675. * @param {Object} option - 参数。
  48676. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP。
  48677. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 URL 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson 。
  48678. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  48679. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。如果已填了 URL 参数,此参数可不传。
  48680. * @usage
  48681. */
  48682. class WebPrintingJobContent {
  48683. constructor(option) {
  48684. /**
  48685. * @member {string} WebPrintingJobContent.prototype.type
  48686. * @description Web 打印内容支持的类型。
  48687. */
  48688. this.type = null;
  48689. /**
  48690. * @member {string} [WebPrintingJobContent.prototype.url]
  48691. * @description 待打印的 SuperMap iPortal WebMap 的 URL 地址。
  48692. */
  48693. this.url = null;
  48694. /**
  48695. * @member {string} [WebPrintingJobContent.prototype.token]
  48696. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  48697. */
  48698. this.token = null;
  48699. /**
  48700. * @member {WebMapSummaryObject} [WebPrintingJobContent.prototype.value]
  48701. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。
  48702. */
  48703. this.value = null;
  48704. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  48705. Util_Util.extend(this, option);
  48706. }
  48707. /**
  48708. * @function WebPrintingJobContent.prototype.destroy
  48709. * @description 释放资源,将引用资源的属性置空。
  48710. */
  48711. destroy() {
  48712. this.type = false || "WEBMAP";
  48713. this.url = null;
  48714. this.token = null;
  48715. this.value = null;
  48716. }
  48717. /**
  48718. * @function WebPrintingJobContent.prototype.toJSON
  48719. * @description 将 WebPrintingJobContent 对象转化为 JSON 字符串。
  48720. * @returns {string} 转换后的 JSON 字符串。
  48721. */
  48722. toJSON() {
  48723. var params = {
  48724. type: this.type
  48725. };
  48726. if (this.token) {
  48727. params.token = this.token;
  48728. }
  48729. if (this.url) {
  48730. params.url = this.url;
  48731. } else if (this.value) {
  48732. params.value = this.value;
  48733. }
  48734. return Util_Util.toJSON(params);
  48735. }
  48736. }
  48737. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  48738. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48739. * This program are made available under the terms of the Apache License, Version 2.0
  48740. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48741. /**
  48742. * @class WebPrintingJobLayoutOptions
  48743. * @deprecatedclass SuperMap.WebPrintingJobLayoutOptions
  48744. * @classdesc Web 打印的布局参数类。
  48745. * @version 10.1.0
  48746. * @category iServer WebPrintingJob
  48747. * @param {Object} option - 参数。
  48748. * @param {string} option.templateName - 布局模板的名称。
  48749. * @param {string} option.title - 地图主标题名称。
  48750. * @param {string} option.subTitle - 地图副标题名称。
  48751. * @param {string} option.author - 作者名称。
  48752. * @param {string} option.copyright - 版权信息。
  48753. * @param {WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  48754. * @param {WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  48755. * @param {WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  48756. * @param {WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  48757. * @usage
  48758. */
  48759. class WebPrintingJobLayoutOptions {
  48760. constructor(option) {
  48761. /**
  48762. * @member {string} WebPrintingJobLayoutOptions.prototype.templateName
  48763. * @description 布局模板的名称。
  48764. */
  48765. this.templateName = null;
  48766. /**
  48767. * @member {string} WebPrintingJobLayoutOptions.prototype.title
  48768. * @description 地图主标题名称。
  48769. */
  48770. this.title = null;
  48771. /**
  48772. * @member {string} WebPrintingJobLayoutOptions.prototype.subTitle
  48773. * @description 地图副标题名称。
  48774. */
  48775. this.subTitle = null;
  48776. /**
  48777. * @member {string} WebPrintingJobLayoutOptions.prototype.author
  48778. * @description 地图作者名称。
  48779. */
  48780. this.author = null;
  48781. /**
  48782. * @member {string} WebPrintingJobLayoutOptions.prototype.copyright
  48783. * @description 地图版权信息。
  48784. */
  48785. this.copyright = null;
  48786. /**
  48787. * @member {WebPrintingJobScaleBarOptions} [WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  48788. * @description 地图比例尺参数类。
  48789. */
  48790. this.scaleBarOptions = null;
  48791. /**
  48792. * @member {WebPrintingJobNorthArrowOptions} [WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  48793. * @description 地图指北针参数类。
  48794. */
  48795. this.northArrowOptions = null;
  48796. /**
  48797. * @member {WebPrintingJobLittleMapOptions} WebPrintingJobLayoutOptions.prototype.littleMapOptions
  48798. * @description 小地图参数类。
  48799. */
  48800. this.littleMapOptions = null;
  48801. /**
  48802. * @member {WebPrintingJobLegendOptions} WebPrintingJobLayoutOptions.prototype.legendOptions
  48803. * @description 图例参数类。
  48804. */
  48805. this.legendOptions = null;
  48806. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  48807. Util_Util.extend(this, option);
  48808. }
  48809. /**
  48810. * @function WebPrintingJobLayoutOptions.prototype.destroy
  48811. * @description 释放资源,将引用资源的属性置空。
  48812. */
  48813. destroy() {
  48814. this.templateName = null;
  48815. this.title = null;
  48816. this.subTitle = null;
  48817. this.author = null;
  48818. this.copyright = null;
  48819. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  48820. this.scaleBarOptions.destroy();
  48821. this.scaleBarOptions = null;
  48822. }
  48823. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  48824. this.northArrowOptions.destroy();
  48825. this.northArrowOptions = null;
  48826. }
  48827. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  48828. this.littleMapOptions.destroy();
  48829. this.littleMapOptions = null;
  48830. }
  48831. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  48832. this.legendOptions.destroy();
  48833. this.legendOptions = null;
  48834. }
  48835. }
  48836. /**
  48837. * @function WebPrintingJobLayoutOptions.prototype.toJSON
  48838. * @description 将 WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  48839. * @returns {string} 转换后的 JSON 字符串。
  48840. */
  48841. toJSON() {
  48842. var params = {
  48843. templateName: this.templateName,
  48844. title: this.title,
  48845. subTitle: this.subTitle,
  48846. author: this.author,
  48847. copyright: this.copyright
  48848. };
  48849. if (this.scaleBarOptions) {
  48850. params.scaleBarOptions = this.scaleBarOptions;
  48851. }
  48852. if (this.northArrowOptions) {
  48853. params.northArrowOptions = this.northArrowOptions;
  48854. }
  48855. if (this.littleMapOptions) {
  48856. params.littleMapOptions = this.littleMapOptions;
  48857. }
  48858. if (this.legendOptions) {
  48859. params.legendOptions = this.legendOptions;
  48860. }
  48861. return Util_Util.toJSON(params);
  48862. }
  48863. }
  48864. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  48865. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48866. * This program are made available under the terms of the Apache License, Version 2.0
  48867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48868. /**
  48869. * @class WebPrintingJobExportOptions
  48870. * @deprecatedclass SuperMap.WebPrintingJobExportOptions
  48871. * @classdesc Web 打印的输出参数类。
  48872. * @version 10.1.0
  48873. * @category iServer WebPrintingJob
  48874. * @param {Object} option - 参数。
  48875. * @param {WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  48876. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 DPI。
  48877. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  48878. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  48879. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  48880. * @usage
  48881. */
  48882. class WebPrintingJobExportOptions {
  48883. constructor(option) {
  48884. /**
  48885. * @member {WebExportFormatType} WebPrintingJobExportOptions.prototype.format
  48886. * @description Web 打印输出的格式。
  48887. */
  48888. this.format = null;
  48889. /**
  48890. * @member {number} [WebPrintingJobExportOptions.prototype.dpi=96]
  48891. * @description Web 打印输出的分辨率,单位为每英寸点数。
  48892. */
  48893. this.dpi = 96;
  48894. /**
  48895. * @member {number} [WebPrintingJobExportOptions.prototype.scale]
  48896. * @description Web 打印输出的地图比例尺。
  48897. */
  48898. this.scale = null;
  48899. /**
  48900. * @member {number} [WebPrintingJobExportOptions.prototype.rotation]
  48901. * @description Web 打印输出的地图角度。
  48902. */
  48903. this.rotation = null;
  48904. /**
  48905. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [WebPrintingJobExportOptions.prototype.center]
  48906. * @description Web 打印输出的地图中心点。
  48907. */
  48908. this.center = null;
  48909. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  48910. Util_Util.extend(this, option);
  48911. }
  48912. /**
  48913. * @function WebPrintingJobExportOptions.prototype.destroy
  48914. * @description 释放资源,将引用资源的属性置空。
  48915. */
  48916. destroy() {
  48917. this.format = null;
  48918. this.dpi = null;
  48919. this.scale = null;
  48920. this.rotation = null;
  48921. this.center = null;
  48922. this.outputSize = null;
  48923. }
  48924. /**
  48925. * @function WebPrintingJobExportOptions.prototype.toJSON
  48926. * @description 将 WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  48927. * @returns {string} 转换后的 JSON 字符串。
  48928. */
  48929. toJSON() {
  48930. var params = {
  48931. format: this.format || "PDF",
  48932. dpi: this.dpi,
  48933. scale: this.scale,
  48934. center: this.center
  48935. };
  48936. if (this.rotation) {
  48937. params.rotation = this.rotation;
  48938. }
  48939. if (this.outputSize) {
  48940. params.outputSize = this.outputSize;
  48941. }
  48942. return Util_Util.toJSON(params);
  48943. }
  48944. }
  48945. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  48946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48947. * This program are made available under the terms of the Apache License, Version 2.0
  48948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48949. /**
  48950. * @class WebPrintingJobParameters
  48951. * @deprecatedclass SuperMap.WebPrintingJobParameters
  48952. * @category iServer WebPrintingJob
  48953. * @version 10.1.0
  48954. * @classdesc Web 打印参数类。
  48955. * @param {Object} options - 参数。
  48956. * @param {WebPrintingJobContent} options.content - Web 打印的内容类。
  48957. * @param {WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  48958. * @param {WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  48959. * @usage
  48960. */
  48961. class WebPrintingJobParameters {
  48962. constructor(options) {
  48963. if (!options) {
  48964. return;
  48965. }
  48966. /**
  48967. * @member {WebPrintingJobContent} WebPrintingJobParameters.prototype.content
  48968. * @description Web 打印的内容类。
  48969. */
  48970. this.content = null;
  48971. /**
  48972. * @member {WebPrintingJobLayoutOptions} WebPrintingJobParameters.prototype.layoutOptions
  48973. * @description Web 打印的布局类,包含各种布局元素的设置。
  48974. */
  48975. this.layoutOptions = null;
  48976. /**
  48977. * @member {WebPrintingJobExportOptions} WebPrintingJobParameters.prototype.exportOptions
  48978. * @description Web 打印的输出类,包含 DPI、页面大小等。
  48979. */
  48980. this.exportOptions = null;
  48981. Util_Util.extend(this, options);
  48982. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  48983. }
  48984. /**
  48985. * @function WebPrintingJobParameters.prototype.destroy
  48986. * @description 释放资源,将引用资源的属性置空。
  48987. */
  48988. destroy() {
  48989. if (this.content instanceof WebPrintingJobContent) {
  48990. this.content.destroy();
  48991. this.content = null;
  48992. }
  48993. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  48994. this.layoutOptions.destroy();
  48995. this.layoutOptions = null;
  48996. }
  48997. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  48998. this.exportOptions.destroy();
  48999. this.exportOptions = null;
  49000. }
  49001. }
  49002. }
  49003. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  49004. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49005. * This program are made available under the terms of the Apache License, Version 2.0
  49006. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49007. /**
  49008. * @class WebPrintingService
  49009. * @deprecatedclass SuperMap.WebPrintingService
  49010. * @category iServer WebPrintingJob
  49011. * @version 10.1.0
  49012. * @classdesc 打印地图服务基类。
  49013. * @extends {CommonServiceBase}
  49014. * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  49015. * @param {Object} options - 参数。
  49016. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  49017. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49018. * @param {Object} [options.headers] - 请求头。
  49019. * @usage
  49020. */
  49021. class WebPrintingService extends CommonServiceBase {
  49022. constructor(url, options) {
  49023. super(url, options);
  49024. if (options) {
  49025. Util_Util.extend(this, options);
  49026. }
  49027. this.eventCount = 0;
  49028. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  49029. if (!this.url) {
  49030. return;
  49031. }
  49032. }
  49033. /**
  49034. * @function WebPrintingService.prototype.destroy
  49035. * @description 释放资源,将引用资源的属性置空。
  49036. */
  49037. destroy() {
  49038. super.destroy();
  49039. }
  49040. /**
  49041. * @function WebPrintingService.prototype.createWebPrintingJob
  49042. * @description 创建 Web 打印任务。
  49043. * @param {WebPrintingJobParameters} params - Web 打印的请求参数。
  49044. */
  49045. createWebPrintingJob(params, callback) {
  49046. if (!params) {
  49047. return;
  49048. }
  49049. if (params.layoutOptions) {
  49050. if (params.layoutOptions.legendOptions) {
  49051. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  49052. params.layoutOptions.legendOptions.picAsBase64 =
  49053. params.layoutOptions.legendOptions.picAsBase64 &&
  49054. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  49055. if (
  49056. params.layoutOptions.legendOptions.customItems &&
  49057. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  49058. ) {
  49059. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  49060. /^data:.+;base64,/,
  49061. ''
  49062. );
  49063. }
  49064. }
  49065. }
  49066. this.processAsync('jobs', 'POST', callback, params)
  49067. }
  49068. /**
  49069. * @function WebPrintingService.prototype.getPrintingJob
  49070. * @description 获取 Web 打印输出文档任务。
  49071. * @param {string} jobId - Web 打印任务 ID
  49072. */
  49073. getPrintingJob(jobId, callback) {
  49074. var me = this;
  49075. me.processAsync(`jobs/${jobId}`, 'GET', function(result) {
  49076. me.rollingProcess(result, me._processUrl(`jobs/${jobId}`), callback);
  49077. });
  49078. }
  49079. /**
  49080. * @function WebPrintingService.prototype.getPrintingJobResult
  49081. * @description 获取 Web 打印任务的输出文档。
  49082. * @param {string} jobId - Web 打印输入文档任务 ID。
  49083. */
  49084. getPrintingJobResult(jobId, callback) {
  49085. this.processAsync(`jobs/${jobId}/result`, 'GET', callback);
  49086. }
  49087. /**
  49088. * @function WebPrintingService.prototype.getLayoutTemplates
  49089. * @description 查询 Web 打印服务所有可用的模板信息。
  49090. */
  49091. getLayoutTemplates(callback) {
  49092. this.processAsync('layouts', 'GET', callback);
  49093. }
  49094. /**
  49095. * @function WebPrintingService.prototype.rollingProcess
  49096. * @description 轮询查询 Web 打印任务。
  49097. * @param {Object} result - 服务器返回的结果对象。
  49098. */
  49099. rollingProcess(result, url, callback) {
  49100. var me = this;
  49101. if (!result) {
  49102. return;
  49103. }
  49104. var id = setInterval(function () {
  49105. let eventId = ++me.eventCount;
  49106. let eventListeners = {
  49107. scope: this,
  49108. processCompleted: function(result) {
  49109. if (eventId === result.result.eventId && callback) {
  49110. delete result.result.eventId;
  49111. callback(result);
  49112. me.events.un(eventListeners);
  49113. return false;
  49114. }
  49115. },
  49116. processFailed: function(result) {
  49117. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  49118. callback(result);
  49119. me.events.un(eventListeners);
  49120. return false;
  49121. }
  49122. }
  49123. }
  49124. me.events.on(eventListeners);
  49125. me.request({
  49126. url,
  49127. method: 'GET',
  49128. scope: me,
  49129. success: function (result, options) {
  49130. result.eventId = eventId;
  49131. switch (result.status) {
  49132. case 'FINISHED':
  49133. clearInterval(id);
  49134. me.serviceProcessCompleted(result, options);
  49135. break;
  49136. case 'ERROR':
  49137. clearInterval(id);
  49138. me.serviceProcessFailed(result, options);
  49139. break;
  49140. case 'RUNNING':
  49141. me.events.triggerEvent('processRunning', result);
  49142. break;
  49143. }
  49144. },
  49145. failure: me.serviceProcessFailed
  49146. });
  49147. }, 1000);
  49148. }
  49149. processAsync(url, method, callback, params) {
  49150. let eventId = ++this.eventCount;
  49151. let eventListeners = {
  49152. scope: this,
  49153. processCompleted: function(result) {
  49154. if (eventId === result.result.eventId && callback) {
  49155. delete result.result.eventId;
  49156. callback(result);
  49157. this.events && this.events.un(eventListeners);
  49158. return false;
  49159. }
  49160. },
  49161. processFailed: function(result) {
  49162. if (eventId === result.error.eventId || eventId === result.eventId) {
  49163. callback(result);
  49164. this.events && this.events.un(eventListeners);
  49165. return false;
  49166. }
  49167. }
  49168. }
  49169. this.events.on(eventListeners);
  49170. var me = this;
  49171. let requestConfig = {
  49172. url: me._processUrl(url),
  49173. method,
  49174. scope: me,
  49175. success(result, options) {
  49176. result.eventId = eventId;
  49177. this.serviceProcessCompleted(result, options);
  49178. },
  49179. failure(result, options) {
  49180. if (result.error) {
  49181. result.error.eventId = eventId;
  49182. }
  49183. result.eventId = eventId;
  49184. this.serviceProcessFailed(result, options);
  49185. }
  49186. };
  49187. params && (requestConfig.data = Util_Util.toJSON(params));
  49188. me.request(requestConfig);
  49189. }
  49190. _processUrl(appendContent) {
  49191. if (appendContent) {
  49192. return Util_Util.urlPathAppend(this.url, appendContent);
  49193. }
  49194. return this.url;
  49195. }
  49196. }
  49197. ;// CONCATENATED MODULE: ./src/common/iServer/ImageCollectionService.js
  49198. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49199. * This program are made available under the terms of the Apache License, Version 2.0
  49200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49201. /**
  49202. * @class ImageCollectionService
  49203. * @deprecatedclass SuperMap.ImageCollectionService
  49204. * @classdesc 影像集合服务类。
  49205. * @version 10.2.0
  49206. * @category iServer Image
  49207. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  49208. * @param {Object} options - 参数。
  49209. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  49210. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49211. * @param {Object} [options.headers] - 请求头。
  49212. * @extends {CommonServiceBase}
  49213. * @usage
  49214. */
  49215. class ImageCollectionService extends CommonServiceBase {
  49216. constructor(url, options) {
  49217. super(url, options);
  49218. this.options = options || {};
  49219. if (options) {
  49220. Util_Util.extend(this, options);
  49221. }
  49222. this.eventCount = 0;
  49223. this.CLASS_NAME = 'SuperMap.ImageCollectionService';
  49224. }
  49225. /**
  49226. * @function ImageCollectionService.prototype.destroy
  49227. * @override
  49228. */
  49229. destroy() {
  49230. super.destroy();
  49231. }
  49232. /**
  49233. * @function ImageCollectionService.prototype.getLegend
  49234. * @description 返回当前影像集合的图例信息。默认为服务发布所配置的风格,支持根据风格参数生成新的图例。
  49235. * @param {Object} queryParams query参数。
  49236. * @param {ImageRenderingRule} [queryParams.renderingRule] renderingRule 对象,用来指定影像的渲染风格,从而确定图例内容。影像的渲染风格包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。该参数未设置时,将使用发布服务时所配置的风格。
  49237. */
  49238. getLegend(queryParams, callback) {
  49239. var me = this;
  49240. var pathParams = {
  49241. collectionId: me.options.collectionId
  49242. };
  49243. var path = Util_Util.convertPath('/collections/{collectionId}/legend', pathParams);
  49244. var url = Util_Util.urlPathAppend(me.url, path);
  49245. this._processAsync({ url, method: 'GET', params: queryParams, callback });
  49246. }
  49247. /**
  49248. * @function ImageCollectionService.prototype.getStatistics
  49249. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  49250. */
  49251. getStatistics(callback) {
  49252. var me = this;
  49253. var pathParams = {
  49254. collectionId: me.options.collectionId
  49255. };
  49256. var path = Util_Util.convertPath('/collections/{collectionId}/statistics', pathParams);
  49257. var url = Util_Util.urlPathAppend(me.url, path);
  49258. this._processAsync({ url, method: 'GET', callback });
  49259. }
  49260. /**
  49261. * @function ImageCollectionService.prototype.getTileInfo
  49262. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  49263. */
  49264. getTileInfo(callback) {
  49265. var me = this;
  49266. var pathParams = {
  49267. collectionId: me.options.collectionId
  49268. };
  49269. var path = Util_Util.convertPath('/collections/{collectionId}/tileInfo', pathParams);
  49270. var url = Util_Util.urlPathAppend(me.url, path);
  49271. this._processAsync({ url, method: 'GET', callback });
  49272. }
  49273. /**
  49274. * @function ImageCollectionService.prototype.deleteItemByID
  49275. * @description 删除影像集合中指定 ID 的 Item,即从影像集合中删除指定的影像。
  49276. * @param {string} featureId Feature 的本地标识符。
  49277. */
  49278. deleteItemByID(featureId, callback) {
  49279. var me = this;
  49280. var pathParams = {
  49281. collectionId: me.options.collectionId,
  49282. featureId: featureId
  49283. };
  49284. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  49285. var url = Util_Util.urlPathAppend(me.url, path);
  49286. this._processAsync({ url, method: 'DELETE', callback });
  49287. }
  49288. /**
  49289. * @function ImageCollectionService.prototype.getItemByID
  49290. * @description 返回指定ID(`collectionId`)的影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  49291. * @param {string} featureId Feature 的本地标识符。
  49292. */
  49293. getItemByID(featureId, callback) {
  49294. var me = this;
  49295. var pathParams = {
  49296. collectionId: me.options.collectionId,
  49297. featureId: featureId
  49298. };
  49299. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  49300. var url = Util_Util.urlPathAppend(me.url, path);
  49301. this._processAsync({ url, method: 'GET', callback });
  49302. }
  49303. _processAsync({ url, method, callback, params}) {
  49304. let eventId = ++this.eventCount;
  49305. let eventListeners = {
  49306. scope: this,
  49307. processCompleted: function(result) {
  49308. if (eventId === result.result.eventId && callback) {
  49309. delete result.result.eventId;
  49310. callback(result);
  49311. this.events && this.events.un(eventListeners);
  49312. return false;
  49313. }
  49314. },
  49315. processFailed: function(result) {
  49316. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  49317. callback(result);
  49318. this.events && this.events.un(eventListeners);
  49319. return false;
  49320. }
  49321. }
  49322. }
  49323. this.events.on(eventListeners);
  49324. this.request({
  49325. method: method || 'GET',
  49326. url,
  49327. params,
  49328. scope: this,
  49329. success(result, options) {
  49330. result.eventId = eventId;
  49331. this.serviceProcessCompleted(result, options);
  49332. },
  49333. failure(result, options) {
  49334. if (result.error) {
  49335. result.error.eventId = eventId;
  49336. }
  49337. result.eventId = eventId;
  49338. this.serviceProcessFailed(result, options);
  49339. }
  49340. });
  49341. }
  49342. }
  49343. ;// CONCATENATED MODULE: ./src/common/iServer/ImageService.js
  49344. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49345. * This program are made available under the terms of the Apache License, Version 2.0
  49346. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49347. /**
  49348. * @class ImageService
  49349. * @deprecatedclass SuperMap.ImageService
  49350. * @classdesc 影像服务类。
  49351. * @version 10.2.0
  49352. * @category iServer Image
  49353. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  49354. * @param {Object} options - 可选参数。
  49355. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49356. * @param {Object} [options.headers] - 请求头。
  49357. * @extends {CommonServiceBase}
  49358. * @usage
  49359. */
  49360. class ImageService extends CommonServiceBase {
  49361. constructor(url, options) {
  49362. super(url, options);
  49363. this.options = options || {};
  49364. if (options) {
  49365. Util_Util.extend(this, options);
  49366. }
  49367. this.eventCount = 0;
  49368. this.CLASS_NAME = 'SuperMap.ImageService';
  49369. }
  49370. /**
  49371. * @function ImageService.prototype.destroy
  49372. * @override
  49373. */
  49374. destroy() {
  49375. super.destroy();
  49376. }
  49377. /**
  49378. * @function ImageService.prototype.getCollections
  49379. * @description 返回当前影像服务中的影像集合列表(Collections)。
  49380. */
  49381. getCollections(callback) {
  49382. var me = this;
  49383. var path = Util_Util.convertPath('/collections');
  49384. var url = Util_Util.urlPathAppend(me.url, path);
  49385. this._processAsync({ url, mehtod: 'GET', callback });
  49386. }
  49387. /**
  49388. * @function ImageService.prototype.getCollectionByID
  49389. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  49390. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  49391. */
  49392. getCollectionByID(collectionId, callback) {
  49393. var pathParams = {
  49394. collectionId: collectionId
  49395. };
  49396. var me = this;
  49397. var path = Util_Util.convertPath('/collections/{collectionId}', pathParams);
  49398. var url = Util_Util.urlPathAppend(me.url, path);
  49399. this._processAsync({ url, mehtod: 'GET', callback });
  49400. }
  49401. /**
  49402. * @function ImageSearchService.prototype.search
  49403. * @description 查询与过滤条件匹配的影像数据。
  49404. * @param {ImageSearchParameter} [imageSearchParameter] 查询参数。
  49405. */
  49406. search(imageSearchParameter, callback) {
  49407. var postBody = { ...(imageSearchParameter || {}) };
  49408. var me = this;
  49409. var path = Util_Util.convertPath('/search');
  49410. var url = Util_Util.urlPathAppend(me.url, path);
  49411. this._processAsync({ url, method: 'POST', data: postBody, callback });
  49412. }
  49413. _processAsync({ url, method, callback, data }) {
  49414. let eventId = ++this.eventCount;
  49415. let me = this;
  49416. let eventListeners = {
  49417. scope: this,
  49418. processCompleted: function (result) {
  49419. if (eventId === result.result.eventId && callback) {
  49420. delete result.result.eventId;
  49421. callback(result);
  49422. this.events && this.events.un(eventListeners);
  49423. return false;
  49424. }
  49425. },
  49426. processFailed: function (result) {
  49427. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  49428. callback(result);
  49429. this.events && this.events.un(eventListeners);
  49430. return false;
  49431. }
  49432. }
  49433. };
  49434. this.events.on(eventListeners);
  49435. this.request({
  49436. method: method || 'GET',
  49437. url,
  49438. data,
  49439. scope: this,
  49440. success(result, options) {
  49441. result.eventId = eventId;
  49442. me.serviceProcessCompleted(result, options);
  49443. },
  49444. failure(result, options) {
  49445. if (result.error) {
  49446. result.error.eventId = eventId;
  49447. }
  49448. result.eventId = eventId;
  49449. me.serviceProcessFailed(result, options);
  49450. }
  49451. });
  49452. }
  49453. }
  49454. ;// CONCATENATED MODULE: ./src/common/iServer/FieldsFilter.js
  49455. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49456. * This program are made available under the terms of the Apache License, Version 2.0
  49457. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49458. /**
  49459. * @class FieldsFilter
  49460. * @deprecatedclass SuperMap.FieldsFilter
  49461. * @category iServer Data Field
  49462. * @classdesc 指定返回的用于描述 Feature 的字段。
  49463. * @param {Object} options - 可选参数。
  49464. * @param {Array.<string>} [options.include] 对返回的字段内容进行过滤,需保留的字段列表。
  49465. * @param {Array.<string>} [options.exclude] 对返回的字段内容进行过滤,需排除的字段列表。
  49466. * @usage
  49467. */
  49468. class FieldsFilter {
  49469. constructor(options) {
  49470. /**
  49471. * @description 对返回的字段内容进行过滤,需保留的字段列表。
  49472. * @member {Array.<string>} FieldsFilter.prototype.include
  49473. */
  49474. this.include = undefined;
  49475. /**
  49476. * @description 对返回的字段内容进行过滤,需排除的字段列表。
  49477. * @member {Array.<string>} FieldsFilter.prototype.exclude
  49478. */
  49479. this.exclude = undefined;
  49480. this.CLASS_NAME = 'SuperMap.FieldsFilter';
  49481. Util_Util.extend(this, options);
  49482. }
  49483. /**
  49484. * @function FieldsFilter.prototype.destroy
  49485. * @description 释放资源,将引用资源的属性置空。
  49486. */
  49487. destroy() {
  49488. var me = this;
  49489. me.include = undefined;
  49490. me.exclude = undefined;
  49491. }
  49492. /**
  49493. * @function FieldsFilter.prototype.constructFromObject
  49494. * @description 目标对象新增该类的可选参数。
  49495. * @param {Object} data 要转换的数据。
  49496. * @param {FieldsFilter} obj 返回的模型。
  49497. * @return {FieldsFilter} 返回结果。
  49498. */
  49499. static constructFromObject(data, obj) {
  49500. if (data) {
  49501. obj = obj || new FieldsFilter();
  49502. if (data.hasOwnProperty('include')) {
  49503. obj.include = data.include
  49504. }
  49505. if (data.hasOwnProperty('exclude')) {
  49506. obj.exclude = data.exclude
  49507. }
  49508. }
  49509. return obj;
  49510. }
  49511. }
  49512. ;// CONCATENATED MODULE: ./src/common/iServer/Sortby.js
  49513. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49514. * This program are made available under the terms of the Apache License, Version 2.0
  49515. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49516. /**
  49517. * @class Sortby
  49518. * @deprecatedclass SuperMap.Sortby
  49519. * @classdesc 通过指定字段进行排序的方法类。
  49520. * @category BaseTypes Util
  49521. * @param {Object} options - 参数。
  49522. * @param {string} options.field 属性名称。
  49523. * @param {Sortby.Direction} options.direction 排序规则,默认升序。
  49524. * @usage
  49525. */
  49526. class Sortby {
  49527. constructor(options) {
  49528. /**
  49529. * @description 属性名称。
  49530. * @member {string} Sortby.prototype.field
  49531. */
  49532. this.field = undefined;
  49533. /**
  49534. * @description 排序规则。
  49535. * @member {Sortby.Direction} Sortby.prototype.direction
  49536. * @default Sortby.Direction.ASC
  49537. */
  49538. this.direction = Sortby.Direction.ASC;
  49539. this.CLASS_NAME = 'SuperMap.Sortby';
  49540. Util_Util.extend(this, options);
  49541. }
  49542. /**
  49543. * @function Sortby.prototype.destroy
  49544. * @description 释放资源,将引用资源的属性置空。
  49545. */
  49546. destroy() {
  49547. var me = this;
  49548. me.field = undefined;
  49549. me.direction = 'ASC';
  49550. }
  49551. /**
  49552. * @function Sortby.prototype.constructFromObject
  49553. * @description 目标对象新增该类的可选参数。
  49554. * @param {Object} data 要转换的数据。
  49555. * @param {Sortby} obj 返回的模型。
  49556. * @return {Sortby} 返回结果。
  49557. */
  49558. static constructFromObject(data, obj) {
  49559. if (data) {
  49560. obj = obj || new Sortby();
  49561. if (data.hasOwnProperty('field')) {
  49562. obj.field = data.field;
  49563. }
  49564. if (data.hasOwnProperty('direction')) {
  49565. obj.direction = data.direction;
  49566. }
  49567. }
  49568. return obj;
  49569. }
  49570. }
  49571. /**
  49572. * @enum Direction
  49573. * @description 排序的类型枚举。
  49574. * @memberOf Sortby
  49575. * @readonly
  49576. * @type {string}
  49577. */
  49578. Sortby.Direction = {
  49579. /** 升序。 */
  49580. ASC: 'ASC',
  49581. /** 降序。 */
  49582. DESC: 'DESC'
  49583. };
  49584. ;// CONCATENATED MODULE: ./src/common/iServer/ImageSearchParameter.js
  49585. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49586. * This program are made available under the terms of the Apache License, Version 2.0
  49587. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49588. /**
  49589. * @class ImageSearchParameter
  49590. * @deprecatedclass SuperMap.ImageSearchParameter
  49591. * @classdesc 影像服务查询参数类。
  49592. * @category iServer Image
  49593. * @param {Object} options - 可选参数。
  49594. * @param {Array.<number>} [options.bbox] 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来。该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84)。对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  49595. * @param {Array.<string>} [options.collections] 影像集合的ID数组,将在该指定的Collection中搜索Items。
  49596. * @param {Array.<string>} [options.ids] 只返回指定 Item 的 ID 数组中的Item。返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  49597. * @param {number} [options.limit] 返回的最大结果数,即响应文档包含的 Item 的数目。
  49598. * @param {FieldsFilter} [options.fields] 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  49599. * @param {Object} [options.query] 定义查询哪些属性,查询运算符将应用于这些属性。运算符包括:eq、neq、gt、lt、gte、lte、startsWith、endsWith、contains、in。其中in是Array.<string>类型,例如:{ "SmFileName": { "eq":"B49C001002.tif" }}
  49600. * @param {Array.<Sortby>} [options.sortby] 由包含属性名称和排序规则的对象构成的数组。
  49601. * @usage
  49602. */
  49603. class ImageSearchParameter {
  49604. constructor(options) {
  49605. /**
  49606. * @description 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84). 对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  49607. * @member {Array.<number>} ImageSearchParameter.prototype.bbox
  49608. */
  49609. this.bbox = undefined;
  49610. /**
  49611. * @description 影像集合的ID数组,将在该指定的Collection中搜索Items。
  49612. * @member {Array.<string>} ImageSearchParameter.prototype.collections
  49613. */
  49614. this.collections = undefined;
  49615. /**
  49616. * @description 返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  49617. * @member {Array.<string>} ImageSearchParameter.prototype.ids
  49618. */
  49619. this.ids = undefined;
  49620. /**
  49621. * @description 单页返回的最大结果数。最小值为1,最大值为10000。
  49622. * @member {number} ImageSearchParameter.prototype.limit
  49623. */
  49624. this.limit = undefined;
  49625. /**
  49626. * @description 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  49627. * @member {FieldsFilter} ImageSearchParameter.prototype.fields
  49628. */
  49629. this.fields = undefined;
  49630. /**
  49631. * @description 定义查询哪些属性,查询运算符将应用于这些属性。
  49632. * @member {Object} ImageSearchParameter.prototype.query
  49633. */
  49634. this.query = undefined;
  49635. /**
  49636. * @description 由包含属性名称和排序规则的对象构成的数组。
  49637. * @member {Array.<Sortby>} ImageSearchParameter.prototype.sortby
  49638. */
  49639. this.sortby = undefined;
  49640. this.CLASS_NAME = 'SuperMap.ImageSearchParameter';
  49641. Util_Util.extend(this, options);
  49642. }
  49643. /**
  49644. * @function ImageSearchParameter.prototype.destroy
  49645. * @description 释放资源,将引用资源的属性置空。
  49646. */
  49647. destroy() {
  49648. var me = this;
  49649. me.bbox = undefined;
  49650. me.collections = undefined;
  49651. me.ids = undefined;
  49652. me.limit = undefined;
  49653. me.fields = undefined;
  49654. me.query = undefined;
  49655. me.sortby = undefined;
  49656. }
  49657. /**
  49658. * @function ImageSearchParameter.prototype.constructFromObject
  49659. * @description 目标对象新增该类的可选参数。
  49660. * @param {Object} data 要转换的数据。
  49661. * @param {ImageSearchParameter} obj 返回的模型。
  49662. * @return {ImageSearchParameter} 返回结果。
  49663. */
  49664. static constructFromObject(data, obj) {
  49665. if (data) {
  49666. obj = obj || new ImageSearchParameter();
  49667. if (data.hasOwnProperty('bbox')) {
  49668. obj.bbox = data.bbox;
  49669. }
  49670. if (data.hasOwnProperty('collections')) {
  49671. obj.collections = data.collections;
  49672. }
  49673. if (data.hasOwnProperty('ids')) {
  49674. obj.ids = data.ids;
  49675. }
  49676. if (data.hasOwnProperty('limit')) {
  49677. obj.limit = data.limit;
  49678. }
  49679. if (data.hasOwnProperty('fields')) {
  49680. obj.fields = (FieldsFilter.constructFromObject && FieldsFilter.constructFromObject(data.fields, {})) || data.fields;
  49681. }
  49682. if (data.hasOwnProperty('query')) {
  49683. obj.query = data.query;
  49684. }
  49685. if (data.hasOwnProperty('sortby')) {
  49686. obj.sortby = data.sortby;
  49687. if (data.sortby) {
  49688. obj.sortby = data.sortby.map((item) => {
  49689. return (Sortby.constructFromObject && Sortby.constructFromObject(item, {})) || item;
  49690. });
  49691. }
  49692. }
  49693. }
  49694. return obj;
  49695. }
  49696. }
  49697. ;// CONCATENATED MODULE: ./src/common/iServer/ImageStretchOption.js
  49698. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49699. * This program are made available under the terms of the Apache License, Version 2.0
  49700. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49701. /**
  49702. * @class ImageStretchOption
  49703. * @deprecatedclass SuperMap.ImageStretchOption
  49704. * @classdesc 影像拉伸类。
  49705. * @category iServer Image
  49706. * @param {Object} options - 可选参数。
  49707. * @param {ImageStretchOption.StretchType} [options.stretchType] 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  49708. * @param {number} [options.stdevCoefficient] 标准差系数。
  49709. * @param {number} [options.gaussianCoefficient] 高斯系数。
  49710. * @param {boolean} [options.useMedianValue] 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  49711. * @param {number} [options.minPercent] 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  49712. * @param {number} [options.maxPercent] 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  49713. * @usage
  49714. */
  49715. class ImageStretchOption {
  49716. constructor(options) {
  49717. /**
  49718. * @description 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  49719. * @member {ImageStretchOption.StretchType} ImageStretchOption.prototype.stretchType
  49720. */
  49721. this.stretchType = undefined;
  49722. /**
  49723. * @description 标准差系数。
  49724. * @member {number} ImageStretchOption.prototype.stdevCoefficient
  49725. */
  49726. this.stdevCoefficient = undefined;
  49727. /**
  49728. * @description 高斯系数。
  49729. * @member {number} ImageStretchOption.prototype.gaussianCoefficient
  49730. */
  49731. this.gaussianCoefficient = undefined;
  49732. /**
  49733. * @description 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  49734. * @member {boolean} ImageStretchOption.prototype.useMedianValue
  49735. */
  49736. this.useMedianValue = undefined;
  49737. /**
  49738. * @description 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  49739. * @member {number} ImageStretchOption.prototype.minPercent
  49740. */
  49741. this.minPercent = undefined;
  49742. /**
  49743. * @description 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  49744. * @member {number} ImageStretchOption.prototype.maxPercent
  49745. */
  49746. this.maxPercent = undefined;
  49747. this.CLASS_NAME = 'SuperMap.ImageStretchOption';
  49748. Util_Util.extend(this, options);
  49749. }
  49750. /**
  49751. * @function ImageStretchOption.prototype.destroy
  49752. * @description 释放资源,将引用资源的属性置空。
  49753. */
  49754. destroy() {
  49755. var me = this;
  49756. me.stretchType = undefined;
  49757. me.stdevCoefficient = undefined;
  49758. me.gaussianCoefficient = undefined;
  49759. me.useMedianValue = undefined;
  49760. me.minPercent = undefined;
  49761. me.maxPercent = undefined;
  49762. }
  49763. /**
  49764. * @function ImageStretchOption.prototype.constructFromObject
  49765. * @description 目标对象新增该类的可选参数。
  49766. * @param {Object} data 要转换的数据。
  49767. * @param {ImageStretchOption} obj 返回的模型。
  49768. * @return {ImageStretchOption} 返回结果。
  49769. */
  49770. static constructFromObject(data, obj) {
  49771. if (data) {
  49772. obj = obj || new ImageStretchOption();
  49773. if (data.hasOwnProperty('stretchType')) {
  49774. obj.stretchType = data.stretchType;
  49775. }
  49776. if (data.hasOwnProperty('stdevCoefficient')) {
  49777. obj.stdevCoefficient = data.stdevCoefficient;
  49778. }
  49779. if (data.hasOwnProperty('gaussianCoefficient')) {
  49780. obj.gaussianCoefficient = data.gaussianCoefficient;
  49781. }
  49782. if (data.hasOwnProperty('useMedianValue')) {
  49783. obj.useMedianValue = data.useMedianValue;
  49784. }
  49785. if (data.hasOwnProperty('minPercent')) {
  49786. obj.minPercent = data.minPercent;
  49787. }
  49788. if (data.hasOwnProperty('maxPercent')) {
  49789. obj.maxPercent = data.maxPercent;
  49790. }
  49791. }
  49792. return obj;
  49793. }
  49794. }
  49795. /**
  49796. * @enum StretchType
  49797. * @description 影像拉伸类型枚举。
  49798. * @memberOf ImageStretchOption
  49799. * @readonly
  49800. * @type {string}
  49801. */
  49802. ImageStretchOption.StretchType = {
  49803. /** 无拉伸。 */
  49804. NONE: 'NONE',
  49805. /** 高斯拉伸。 */
  49806. GAUSSIAN: 'GAUSSIAN',
  49807. /** 百分比截断拉伸。 */
  49808. PERCENTCLIP: 'PERCENTCLIP',
  49809. /** 最值拉伸。 */
  49810. MINIMUMMAXIMUM: 'MINIMUMMAXIMUM',
  49811. /** 标准差拉伸。 */
  49812. STANDARDDEVIATION: 'STANDARDDEVIATION'
  49813. };
  49814. ;// CONCATENATED MODULE: ./src/common/iServer/ImageRenderingRule.js
  49815. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49816. * This program are made available under the terms of the Apache License, Version 2.0
  49817. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49818. /**
  49819. * @class ImageRenderingRule
  49820. * @deprecatedclass SuperMap.ImageRenderingRule
  49821. * @classdesc 定义请求的影像如何进行渲染或者处理,如:影像的拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。
  49822. * @category iServer Image
  49823. * @param {Object} options - 可选参数。
  49824. * @param {ImageRenderingRule.DisplayMode} [options.displayMode] 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  49825. * @param {string} [options.displayBands] 影像显示的波段或者波段组合。若影像的显示模式为STRETCHED,该属性指定一个波段的索引号(波段索引号从0开始计数);若影像的显示模式为COMPOSITE,该属性为组合的波段索引号,例如:属性值3,2,1表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  49826. * @param {ImageStretchOption} [options.stretchOption] 影像的拉伸参数。
  49827. * @param {ImageRenderingRule.InterpolationMode} [options.interpolationMode] 影像显示时使用的插值算法。
  49828. * @param {Array.<string>} [options.colorScheme] 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  49829. * @param {Array.<string>} [options.colorTable] 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"。
  49830. * @param {number} [options.brightness] 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  49831. * @param {number} [options.contrast] 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  49832. * @param {string} [options.noData] 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  49833. * @param {string} [options.noDataColor] 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  49834. * @param {boolean} [options.noDataTransparent] 无值是否透明显示,true表示透明显示无值;否则为false。
  49835. * @param {string} [options.backgroundValue] 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  49836. * @param {string} [options.backgroundColor] 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  49837. * @param {boolean} [options.backgroundTransparent] 背景值是否透明显示,true表示透明显示背景值;否则为false。
  49838. * @param {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} [options.gridFunctions] 栅格函数链。
  49839. * @usage
  49840. */
  49841. class ImageRenderingRule {
  49842. constructor(options) {
  49843. /**
  49844. * @description 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  49845. * @member {ImageRenderingRule.DisplayMode} ImageRenderingRule.prototype.displayMode
  49846. */
  49847. this.displayMode = undefined;
  49848. /**
  49849. * @description 影像显示的波段或者波段组合。该参数为一个数组,数组元素为波段索引号。若影像的显示模式为Stretched,该属性指定一个显示的波段;若影像的显示模式为Composite,该属性为组合的波段索引号,例如:属性值4,3,2表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  49850. * @member {string} ImageRenderingRule.prototype.displayBands
  49851. */
  49852. this.displayBands = undefined;
  49853. /**
  49854. * @description 影像的拉伸参数。
  49855. * @member {ImageStretchOption} ImageRenderingRule.prototype.stretchOption
  49856. */
  49857. this.stretchOption = undefined;
  49858. /**
  49859. * @description 影像显示时使用的插值算法。
  49860. * @member {ImageRenderingRule.InterpolationMode} ImageRenderingRule.prototype.interpolationMode
  49861. */
  49862. this.interpolationMode = undefined;
  49863. /**
  49864. * @description 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  49865. * @member {Array.<string>} ImageRenderingRule.prototype.colorScheme
  49866. */
  49867. this.colorScheme = undefined;
  49868. /**
  49869. * @description 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"
  49870. * @member {Array.<string>} ImageRenderingRule.prototype.colorTable
  49871. */
  49872. this.colorTable = undefined;
  49873. /**
  49874. * @description 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  49875. * @member {number} ImageRenderingRule.prototype.brightness
  49876. */
  49877. this.brightness = undefined;
  49878. /**
  49879. * @description 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  49880. * @member {number} ImageRenderingRule.prototype.contrast
  49881. */
  49882. this.contrast = undefined;
  49883. /**
  49884. * @description 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  49885. * @member {string} ImageRenderingRule.prototype.noData
  49886. */
  49887. this.noData = undefined;
  49888. /**
  49889. * @description 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  49890. * @member {string} ImageRenderingRule.prototype.noDataColor
  49891. */
  49892. this.noDataColor = undefined;
  49893. /**
  49894. * @description 无值是否透明显示,true表示透明显示无值;否则为false。
  49895. * @member {boolean} ImageRenderingRule.prototype.noDataTransparent
  49896. */
  49897. this.noDataTransparent = undefined;
  49898. /**
  49899. * @description 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  49900. * @member {string} ImageRenderingRule.prototype.backgroundValue
  49901. */
  49902. this.backgroundValue = undefined;
  49903. /**
  49904. * @description 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  49905. * @member {string} ImageRenderingRule.prototype.backgroundColor
  49906. */
  49907. this.backgroundColor = undefined;
  49908. /**
  49909. * @description 背景值是否透明显示,true表示透明显示背景值;否则为false。
  49910. * @member {boolean} ImageRenderingRule.prototype.backgroundTransparent
  49911. */
  49912. this.backgroundTransparent = undefined;
  49913. /**
  49914. * @description 栅格函数选项,通过应用栅格函数,可以对影像进行快速显示处理。
  49915. * @member {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} ImageRenderingRule.prototype.gridFunctions
  49916. */
  49917. this.gridFunctions = undefined;
  49918. this.CLASS_NAME = 'SuperMap.ImageRenderingRule';
  49919. Util_Util.extend(this, options);
  49920. }
  49921. /**
  49922. * @function ImageRenderingRule.prototype.destroy
  49923. * @description 释放资源,将引用资源的属性置空。
  49924. */
  49925. destroy() {
  49926. var me = this;
  49927. me.displayMode = undefined;
  49928. me.displayBands = undefined;
  49929. me.stretchOption = undefined;
  49930. me.interpolationMode = undefined;
  49931. me.colorScheme = undefined;
  49932. me.colorTable = undefined;
  49933. me.brightness = undefined;
  49934. me.contrast = undefined;
  49935. me.noData = undefined;
  49936. me.noDataColor = undefined;
  49937. me.noDataTransparent = undefined;
  49938. me.backgroundValue = undefined;
  49939. me.backgroundColor = undefined;
  49940. me.backgroundTransparent = undefined;
  49941. me.gridFuncOptions = undefined;
  49942. }
  49943. /**
  49944. * @function ImageRenderingRule.prototype.constructFromObject
  49945. * @description 目标对象新增该类的可选参数。
  49946. * @param {Object} data 要转换的数据。
  49947. * @param {ImageRenderingRule} obj 返回的模型。
  49948. * @return {ImageRenderingRule} 返回结果。
  49949. */
  49950. static constructFromObject(data, obj) {
  49951. if (data) {
  49952. obj = obj || new ImageRenderingRule();
  49953. if (data.hasOwnProperty('displayMode')) {
  49954. obj.displayMode = data.displayMode;
  49955. }
  49956. if (data.hasOwnProperty('displayBands')) {
  49957. obj.displayBands = data.displayBands;
  49958. }
  49959. if (data.hasOwnProperty('stretchOption')) {
  49960. obj.stretchOption =
  49961. (ImageStretchOption.constructFromObject && ImageStretchOption.constructFromObject(data.stretchOption, {})) ||
  49962. data.stretchOption;
  49963. }
  49964. if (data.hasOwnProperty('interpolationMode')) {
  49965. obj.interpolationMode = data.interpolationMode;
  49966. }
  49967. if (data.hasOwnProperty('colorScheme')) {
  49968. obj.colorScheme = data.colorScheme;
  49969. }
  49970. if (data.hasOwnProperty('colorTable')) {
  49971. obj.colorTable = data.colorTable;
  49972. }
  49973. if (data.hasOwnProperty('brightness')) {
  49974. obj.brightness = data.brightness;
  49975. }
  49976. if (data.hasOwnProperty('contrast')) {
  49977. obj.contrast = data.contrast;
  49978. }
  49979. if (data.hasOwnProperty('noData')) {
  49980. obj.noData = data.noData;
  49981. }
  49982. if (data.hasOwnProperty('noDataColor')) {
  49983. obj.noDataColor = data.noDataColor;
  49984. }
  49985. if (data.hasOwnProperty('backgroundValue')) {
  49986. obj.backgroundValue = data.backgroundValue;
  49987. }
  49988. if (data.hasOwnProperty('noDataTransparent')) {
  49989. obj.noDataTransparent = data.noDataTransparent;
  49990. }
  49991. if (data.hasOwnProperty('backgroundColor')) {
  49992. obj.backgroundColor = data.backgroundColor;
  49993. }
  49994. if (data.hasOwnProperty('backgroundTransparent')) {
  49995. obj.backgroundTransparent = data.backgroundTransparent;
  49996. }
  49997. if (data.hasOwnProperty('gridFunctions')) {
  49998. obj.gridFunctions = data.gridFunctions;
  49999. }
  50000. }
  50001. return obj;
  50002. }
  50003. }
  50004. /**
  50005. * @enum DisplayMode
  50006. * @description 影像显示模式。
  50007. * @memberOf ImageRenderingRule
  50008. * @readonly
  50009. * @type {string}
  50010. */
  50011. ImageRenderingRule.DisplayMode = {
  50012. COMPOSITE: 'COMPOSITE',
  50013. STRETCHED: 'Stretched'
  50014. };
  50015. /**
  50016. * @enum InterpolationMode
  50017. * @description 影像显示时使用的插值算法枚举。
  50018. * @memberOf ImageRenderingRule
  50019. * @readonly
  50020. * @type {string}
  50021. */
  50022. ImageRenderingRule.InterpolationMode = {
  50023. /** 最邻近插值模式。 */
  50024. NEARESTNEIGHBOR: 'NEARESTNEIGHBOR',
  50025. /** 高质量的双线性插值模式。 */
  50026. HIGHQUALITYBILINEAR: 'HIGHQUALITYBILINEAR',
  50027. /** 默认插值模式。 */
  50028. DEFAULT: 'DEFAULT'
  50029. };
  50030. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFHillShade.js
  50031. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50032. * This program are made available under the terms of the Apache License, Version 2.0
  50033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50034. /**
  50035. * @class ImageGFHillShade
  50036. * @deprecatedclass SuperMap.ImageGFHillShade
  50037. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。
  50038. * @category iServer Image
  50039. * @param {Object} options - 可选参数。
  50040. * @param {string} [options.girdFuncName='GFHillShade'] 栅格函数名称,参数值为:GFHillShade。
  50041. * @param {number} [options.Azimuth = 315] 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  50042. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  50043. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  50044. * @usage
  50045. */
  50046. class ImageGFHillShade {
  50047. constructor(options) {
  50048. /**
  50049. * @description 栅格函数名称,参数值为:GFHillShade。
  50050. * @member {string} ImageGFHillShade.prototype.girdFuncName
  50051. * @default 'GFHillShade'
  50052. */
  50053. this.girdFuncName = 'GFHillShade';
  50054. /**
  50055. * @description 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  50056. * @member {number} ImageGFHillShade.prototype.Azimuth
  50057. */
  50058. this.Azimuth = 315;
  50059. /**
  50060. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  50061. * @member {number} ImageGFHillShade.prototype.Altitude
  50062. */
  50063. this.Altitude = 45;
  50064. /**
  50065. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  50066. * @member {number} ImageGFHillShade.prototype.ZFactor
  50067. */
  50068. this.ZFactor = 1;
  50069. this.CLASS_NAME = 'SuperMap.ImageGFHillShade';
  50070. Util_Util.extend(this, options);
  50071. }
  50072. /**
  50073. * @function ImageGFHillShade.prototype.destroy
  50074. * @description 释放资源,将引用资源的属性置空。
  50075. */
  50076. destroy() {
  50077. var me = this;
  50078. me.girdFuncName = 'GFHillShade';
  50079. me.Azimuth = 315;
  50080. me.Altitude = 45;
  50081. me.ZFactor = 1;
  50082. }
  50083. /**
  50084. * @function ImageGFHillShade.prototype.constructFromObject
  50085. * @description 目标对象新增该类的可选参数。
  50086. * @param {Object} data 要转换的数据。
  50087. * @param {ImageGFHillShade} obj 返回的模型。
  50088. * @return {ImageGFHillShade} 返回结果。
  50089. */
  50090. static constructFromObject(data, obj) {
  50091. if (data) {
  50092. obj = obj || new ImageGFHillShade();
  50093. if (data.hasOwnProperty('girdFuncName')) {
  50094. obj.girdFuncName = data.girdFuncName
  50095. }
  50096. if (data.hasOwnProperty('Azimuth')) {
  50097. obj.Azimuth = data.Azimuth
  50098. }
  50099. if (data.hasOwnProperty('Altitude')) {
  50100. obj.Altitude = data.Altitude
  50101. }
  50102. if (data.hasOwnProperty('ZFactor')) {
  50103. obj.ZFactor = data.ZFactor
  50104. }
  50105. }
  50106. return obj;
  50107. }
  50108. }
  50109. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFAspect.js
  50110. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50111. * This program are made available under the terms of the Apache License, Version 2.0
  50112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50113. /**
  50114. * @class ImageGFAspect
  50115. * @deprecatedclass SuperMap.ImageGFAspect
  50116. * @classdesc 栅格函数对象:对DEM数据生成坡向渲图。
  50117. * @category iServer Image
  50118. * @param {Object} options -可选参数。
  50119. * @param {string} [options.girdFuncName='GFAspect'] 栅格函数名称,参数值为:GFAspect。
  50120. * @param {number} [options.Azimuth] 光源方位角,固定为360度。
  50121. * @usage
  50122. */
  50123. class ImageGFAspect {
  50124. constructor(options) {
  50125. /**
  50126. * @description 栅格函数名称,参数值为:GFAspect。
  50127. * @member {string} ImageGFAspect.prototype.girdFuncName
  50128. * @default 'GFAspect'
  50129. */
  50130. this.girdFuncName = 'GFAspect';
  50131. /**
  50132. * @description 光源方位角,固定为360度。
  50133. * @member {number} ImageGFAspect.prototype.Azimuth
  50134. */
  50135. this.Azimuth = undefined;
  50136. this.CLASS_NAME = 'SuperMap.ImageGFAspect';
  50137. Util_Util.extend(this, options);
  50138. }
  50139. /**
  50140. * @function ImageGFAspect.prototype.destroy
  50141. * @description 释放资源,将引用资源的属性置空。
  50142. */
  50143. destroy() {
  50144. var me = this;
  50145. me.girdFuncName = 'GFAspect';
  50146. me.Azimuth = undefined;
  50147. }
  50148. /**
  50149. * @function ImageGFAspect.prototype.constructFromObject
  50150. * @description 目标对象新增该类的可选参数。
  50151. * @param {Object} data 要转换的数据。
  50152. * @param {ImageGFAspect} obj 返回的模型。
  50153. * @return {ImageGFAspect} 返回结果。
  50154. */
  50155. static constructFromObject(data, obj) {
  50156. if (data) {
  50157. obj = obj || new ImageGFAspect();
  50158. if (data.hasOwnProperty('girdFuncName')) {
  50159. obj.girdFuncName = data.girdFuncName
  50160. }
  50161. if (data.hasOwnProperty('Azimuth')) {
  50162. obj.Azimuth = data.Azimuth
  50163. }
  50164. }
  50165. return obj;
  50166. }
  50167. }
  50168. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFOrtho.js
  50169. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50170. * This program are made available under the terms of the Apache License, Version 2.0
  50171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50172. /**
  50173. * @class ImageGFOrtho
  50174. * @deprecatedclass SuperMap.ImageGFOrtho
  50175. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。该栅格函数不需要输入参数,采用系统默认设置。
  50176. * @category iServer Image
  50177. * @param {Object} options - 可选参数。
  50178. * @param {string} [options.girdFuncName='GFOrtho'] 栅格函数名称,参数值为:GFOrtho。
  50179. * @usage
  50180. */
  50181. class ImageGFOrtho {
  50182. constructor(options) {
  50183. /**
  50184. * @description 栅格函数名称,参数值为:GFOrtho。
  50185. * @member {string} ImageGFOrtho.prototype.girdFuncName
  50186. * @default 'GFOrtho'
  50187. */
  50188. this.girdFuncName = 'GFOrtho';
  50189. this.CLASS_NAME = 'SuperMap.ImageGFOrtho';
  50190. Util_Util.extend(this, options);
  50191. }
  50192. /**
  50193. * @function ImageGFOrtho.prototype.destroy
  50194. * @description 释放资源,将引用资源的属性置空。
  50195. */
  50196. destroy() {
  50197. var me = this;
  50198. me.girdFuncName = 'GFOrtho';
  50199. }
  50200. /**
  50201. * @function ImageGFOrtho.prototype.constructFromObject
  50202. * @description 目标对象新增该类的可选参数。
  50203. * @param {Object} data 要转换的数据。
  50204. * @param {ImageGFOrtho} obj 返回的模型。
  50205. * @return {ImageGFOrtho} 返回结果。
  50206. */
  50207. static constructFromObject(data, obj) {
  50208. if (data) {
  50209. obj = obj || new ImageGFOrtho();
  50210. if (data.hasOwnProperty('girdFuncName')) {
  50211. obj.girdFuncName = data.girdFuncName
  50212. }
  50213. }
  50214. return obj;
  50215. }
  50216. }
  50217. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFSlope.js
  50218. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50219. * This program are made available under the terms of the Apache License, Version 2.0
  50220. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50221. /**
  50222. * @class ImageGFSlope
  50223. * @deprecatedclass SuperMap.ImageGFSlope
  50224. * @classdesc 栅格函数对象:对DEM数据生成坡度图。
  50225. * @category iServer Image
  50226. * @param {Object} options - 可选参数。
  50227. * @param {string} [options.girdFuncName='GFSlope'] 栅格函数名称,参数值为:GFSlope。
  50228. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  50229. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  50230. * @usage
  50231. */
  50232. class ImageGFSlope {
  50233. constructor(options) {
  50234. /**
  50235. * @description 栅格函数名称,参数值为:GFSlope。
  50236. * @member {string} ImageGFSlope.prototype.girdFuncName
  50237. * @default 'GFSlope'
  50238. */
  50239. this.girdFuncName = 'GFSlope';
  50240. /**
  50241. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  50242. * @member {number} ImageGFSlope.prototype.Altitude
  50243. */
  50244. this.Altitude = 45;
  50245. /**
  50246. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  50247. * @member {number} ImageGFSlope.prototype.ZFactor
  50248. */
  50249. this.ZFactor = 1;
  50250. this.CLASS_NAME = 'SuperMap.ImageGFSlope';
  50251. Util_Util.extend(this, options);
  50252. }
  50253. /**
  50254. * @function ImageGFSlope.prototype.destroy
  50255. * @description 释放资源,将引用资源的属性置空。
  50256. */
  50257. destroy() {
  50258. var me = this;
  50259. me.girdFuncName = 'GFSlope';
  50260. me.Altitude = 45;
  50261. me.ZFactor = 1;
  50262. }
  50263. /**
  50264. * @function ImageGFSlope.prototype.constructFromObject
  50265. * @description 目标对象新增该类的可选参数。
  50266. * @param {Object} data 要转换的数据。
  50267. * @param {ImageGFSlope} obj 返回的模型。
  50268. * @return {ImageGFSlope} 返回结果。
  50269. */
  50270. static constructFromObject(data, obj) {
  50271. if (data) {
  50272. obj = obj || new ImageGFSlope();
  50273. if (data.hasOwnProperty('girdFuncName')) {
  50274. obj.girdFuncName = data.girdFuncName
  50275. }
  50276. if (data.hasOwnProperty('Altitude')) {
  50277. obj.Altitude = data.Altitude
  50278. }
  50279. if (data.hasOwnProperty('ZFactor')) {
  50280. obj.ZFactor = data.ZFactor
  50281. }
  50282. }
  50283. return obj;
  50284. }
  50285. }
  50286. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphNodeParameter.js
  50287. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50288. * This program are made available under the terms of the Apache License, Version 2.0
  50289. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50290. /**
  50291. * @private
  50292. * @class KnowledgeGraphNodeParameter
  50293. * @deprecatedclass SuperMap.KnowledgeGraphNodeParameter
  50294. * @classdesc 知识图谱实体的参数设置。
  50295. * @category iServer KnowledgeGraph
  50296. * @version 11.1.0
  50297. * @param {Object} options - 参数。
  50298. * @param {string} options.id - 实体id。
  50299. * @param {Array.<string>} [options.labels] - 实体分类。
  50300. * @param {Object} [options.properties] - 属性。
  50301. * @usage
  50302. */
  50303. // {
  50304. // "id": 5348024557502471,
  50305. // "properties": {
  50306. // "server": "test1",
  50307. // "_labelfieldname": "FEATUREGUID",
  50308. // "_entityname": "院落",
  50309. // "_bindfindid": "院落@ST_YARDA@1",
  50310. // "FEATUREGUID": "{409E615B-A545-4E07-872D-B12EDA0B4A1A}",
  50311. // "_findid": 1,
  50312. // "ENTITYNAME": "公共管理与公共服务"
  50313. // },
  50314. // "labels": ["院落"]
  50315. // }
  50316. class KnowledgeGraphNodeParameter {
  50317. constructor(options) {
  50318. /**
  50319. * @member {string} KnowledgeGraphNodeParameter.prototype.id
  50320. * @description 实体ID。
  50321. */
  50322. this.id = null;
  50323. /**
  50324. * @member {Array.<string>} KnowledgeGraphNodeParameter.prototype.labels
  50325. * @description 实体分类。
  50326. */
  50327. this.labels = null;
  50328. /**
  50329. * @member {Object} KnowledgeGraphNodeParameter.prototype.properties
  50330. * @description 实体属性。
  50331. */
  50332. this.properties = null;
  50333. this.CLASS_NAME = 'SuperMap.KnowledgeGraphNodeParameter';
  50334. Util.extend(this, options);
  50335. }
  50336. destroy() {
  50337. var me = this;
  50338. me.id = null;
  50339. me.labels = null;
  50340. me.properties = null;
  50341. }
  50342. }
  50343. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphEdgeParameter.js
  50344. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50345. * This program are made available under the terms of the Apache License, Version 2.0
  50346. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50347. /**
  50348. * @private
  50349. * @class KnowledgeGraphEdgeParameter
  50350. * @deprecatedclass SuperMap.KnowledgeGraphEdgeParameter
  50351. * @classdesc 知识图谱关系的参数设置。
  50352. * @category iServer KnowledgeGraph
  50353. * @version 11.1.0
  50354. * @param {Object} options - 参数。
  50355. * @param {string} options.id - 边id。
  50356. * @param {string} options.start - 开始实体id。
  50357. * @param {string} options.end - 结束实体id。
  50358. * @param {string} [options.type] - 标签,关系。
  50359. * @param {Object} [options.properties] - 属性。
  50360. * @usage
  50361. */
  50362. class KnowledgeGraphEdgeParameter {
  50363. constructor(options) {
  50364. /**
  50365. * @member {string} KnowledgeGraphEdgeParameter.prototype.id
  50366. * @description 边id。
  50367. */
  50368. this.id = null;
  50369. /**
  50370. * @member {string} KnowledgeGraphEdgeParameter.prototype.start
  50371. * @description 开始实体id。
  50372. */
  50373. this.start = null;
  50374. /**
  50375. * @member {string} KnowledgeGraphEdgeParameter.prototype.end
  50376. * @description 结束实体id。
  50377. */
  50378. this.end = null;
  50379. /**
  50380. * @member {string} KnowledgeGraphEdgeParameter.prototype.type
  50381. * @description 标签,关系。
  50382. */
  50383. this.type = null;
  50384. /**
  50385. * @member {Object} KnowledgeGraphEdgeParameter.prototype.properties
  50386. * @description 实体属性。
  50387. */
  50388. this.properties = null;
  50389. this.CLASS_NAME = 'SuperMap.KnowledgeGraphEdgeParameter';
  50390. Util.extend(this, options);
  50391. }
  50392. destroy() {
  50393. var me = this;
  50394. me.id = null;
  50395. me.start = null;
  50396. me.end = null;
  50397. me.type = null;
  50398. me.properties = null;
  50399. }
  50400. }
  50401. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphService.js
  50402. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50403. * This program are made available under the terms of the Apache License, Version 2.0
  50404. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50405. /**
  50406. * @class KnowledgeGraphService
  50407. * @category iServer KnowledgeGraph
  50408. * @classdesc 知识图谱服务类
  50409. * @version 11.1.0
  50410. * @extends {ProcessingServiceBase}
  50411. * @param {string} url - 服务地址。
  50412. * @param {Object} options - 可选参数。
  50413. * @param {string} [options.proxy] - 服务代理地址。
  50414. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  50415. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50416. * @param {Object} [options.headers] - 请求头。
  50417. * @usage
  50418. */
  50419. class KnowledgeGraphService extends CommonServiceBase {
  50420. constructor(url, options) {
  50421. super(url, options);
  50422. this.options = options || {};
  50423. this.eventCount = 0;
  50424. this.CLASS_NAME = 'SuperMap.KnowledgeGraphService';
  50425. }
  50426. /**
  50427. * @function KnowledgeGraphService.prototype.destroy
  50428. * @override
  50429. */
  50430. destroy() {
  50431. super.destroy();
  50432. }
  50433. /**
  50434. * @function KnowledgeGraphService.prototype.query
  50435. * @description 通过查询语句查询知识图谱数据。
  50436. * @param {string} params - 查询条件。
  50437. * @param {RequestCallback} callback 回调函数。
  50438. */
  50439. query(params, callback) {
  50440. const paramKey = 'cypherQuery';
  50441. const url = Util_Util.urlAppend(this.url + '/query.json', `${paramKey}=${params}`);
  50442. this.processAsync({ url, method: 'GET', callback });
  50443. }
  50444. // /**
  50445. // * @function KnowledgeGraphService.prototype.queryById
  50446. // * @description 根据实体id查询关联节点。
  50447. // * @param {string} id - 实体id。
  50448. // * @param {RequestCallback} callback 回调函数。
  50449. // */
  50450. // queryById(id, callback) {
  50451. // const paramKey = 'cypherQuery';
  50452. // const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=match p=(n)-[]-(m) where id(n)=${id} return p;`);
  50453. // this.processAsync({ url, method: 'GET', callback });
  50454. // }
  50455. // /**
  50456. // * @function KnowledgeGraphService.prototype.getMetaData
  50457. // * @description 获取元信息(展示所有实体类型和关系类型。)
  50458. // * @param {RequestCallback} callback 回调函数。
  50459. // */
  50460. // getMetaData(callback) {
  50461. // const url = this.url + 'management/metadata.json';
  50462. // this.processAsync({ url, method: 'GET', callback });
  50463. // }
  50464. /**
  50465. * @function KnowledgeGraphService.prototype.getGraphMaps
  50466. * @description 获取图谱列表
  50467. * @param {RequestCallback} callback 回调函数。
  50468. */
  50469. getGraphMaps(callback) {
  50470. const url = this.url + '/graphmaps.json';
  50471. this.processAsync({ url, method: 'GET', callback });
  50472. }
  50473. /**
  50474. * @function KnowledgeGraphService.prototype.getGraphMap
  50475. * @description 获取图谱图序列化数据
  50476. * @param {string} graphMapName 图谱名称
  50477. * @param {RequestCallback} callback 回调函数
  50478. */
  50479. getGraphMap(graphMapName, callback) {
  50480. const url = this.url + `/graphmaps/${graphMapName}.json`;
  50481. this.processAsync({ url, method: 'GET', callback });
  50482. }
  50483. /**
  50484. * @function KnowledgeGraphService.prototype.getGraphMapData
  50485. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  50486. * @param {string} graphMapName - 图谱名称
  50487. * @returns {Promise} Promise 对象。
  50488. */
  50489. async getGraphMapData(graphMapName) {
  50490. let data = [];
  50491. const graphMap = await this._getGraphMapData(graphMapName);
  50492. if (!graphMap) {
  50493. return;
  50494. }
  50495. const query = (graphMap.dataContent.queries && graphMap.dataContent.queries.query) || [];
  50496. let queries = [];
  50497. if (typeof query === 'string') {
  50498. queries = [query];
  50499. } else {
  50500. queries = query;
  50501. }
  50502. const expandQueries = this._getGraphMapExpandQuery(graphMap);
  50503. if (expandQueries.length) {
  50504. queries.push(...expandQueries);
  50505. }
  50506. for (let j = 0; j < queries.length; j++) {
  50507. const cypherQuery = queries[j];
  50508. const res = await this._queryDataBySql(cypherQuery);
  50509. data = data.concat([], res);
  50510. }
  50511. return { data, graphMap };
  50512. }
  50513. /**
  50514. * @private
  50515. * @function KnowledgeGraphService.prototype._getGraphMapExpandQuery
  50516. * @description 获取graphMap图谱展开节点的query条件
  50517. * @param {Object} graphMap -将iServer GraphMap图谱服务的数据
  50518. * @param {Array.<string>} 查询条件
  50519. */
  50520. _getGraphMapExpandQuery(graphMap) {
  50521. const queries = [];
  50522. const expandIds = (graphMap.dataContent.expand && JSON.parse(graphMap.dataContent.expand)) || [];
  50523. expandIds.forEach((id) => {
  50524. queries.push(`match p=(n)-[]-(m) where id(n)=${id} return p;`);
  50525. });
  50526. return queries;
  50527. }
  50528. // /**
  50529. // * @private
  50530. // * @function KnowledgeGraphService.prototype.getEntities
  50531. // * @description 获取实体。
  50532. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  50533. // * @param {number} [params.count] - 返回个数
  50534. // * @param {RequestCallback} callback 回调函数
  50535. // */
  50536. // getEntities(params, callback) {
  50537. // const url = Util.urlAppend(this.url + '/entities.json', params);
  50538. // this.processAsync({ url, params, method: 'GET', callback });
  50539. // }
  50540. // /**
  50541. // * @private
  50542. // * @function KnowledgeGraphService.prototype.getEdges
  50543. // * @description 获取实体。
  50544. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  50545. // * @param {number} [params.count] - 返回个数
  50546. // * @param {RequestCallback} callback 回调函数
  50547. // */
  50548. // getEdges(params, callback) {
  50549. // const url = Util.urlAppend(this.url + '/edges.json', params);
  50550. // this.processAsync({ url, params, method: 'GET', callback });
  50551. // }
  50552. // /**
  50553. // * @private
  50554. // * @function KnowledgeGraphService.prototype.getEntities
  50555. // * @description 获取实体。
  50556. // * @param {number} id - 查询条件。{type:'院落', count:1}
  50557. // * @param {RequestCallback} callback 回调函数
  50558. // */
  50559. // deleteEntitiy(id, callback) {
  50560. // const url = Util.urlAppend(this.url + '/entities.json', `id=${id}`);
  50561. // this.processAsync({ url, method: 'DELETE', callback });
  50562. // }
  50563. // /**
  50564. // * @private
  50565. // * @function KnowledgeGraphService.prototype.addNode
  50566. // * @description 获取实体。
  50567. // * @param {Object} params - 查询条件
  50568. // * @param {number} [params.count] - 返回个数
  50569. // * @param {RequestCallback} callback 回调函数
  50570. // */
  50571. // addNode(params, callback) {
  50572. // if (!(params instanceof KnowledgeGraphNodeParameter)) {
  50573. // return;
  50574. // }
  50575. // const url = Util.urlAppend(this.url + '/entities.json', params);
  50576. // this.processAsync({ url, params, method: 'PUT', callback });
  50577. // }
  50578. // /**
  50579. // * @private
  50580. // * @function KnowledgeGraphService.prototype.addEdge
  50581. // * @description 获取实体。
  50582. // * @param {Object} params - 查询条件
  50583. // * @param {number} [params.count] - 返回个数
  50584. // * @param {RequestCallback} callback 回调函数
  50585. // */
  50586. // addEdge(params, callback) {
  50587. // if (!(params instanceof KnowledgeGraphEdgeParameter)) {
  50588. // return;
  50589. // }
  50590. // const url = Util.urlAppend(this.url + '/edges.json', params);
  50591. // this.processAsync({ url, params, method: 'PUT', callback });
  50592. // }
  50593. /**
  50594. * @function KnowledgeGraphService.prototype.processAsync
  50595. * @description 负责将客户端的动态分段服务参数传递到服务端。
  50596. * @param {string} url - 服务地址
  50597. * @param {Object} params - 参数
  50598. */
  50599. processAsync({ url, params, method, callback }) {
  50600. let eventId = ++this.eventCount;
  50601. let eventListeners = {
  50602. scope: this,
  50603. processCompleted: function (result) {
  50604. if (eventId === result.result.eventId && callback) {
  50605. delete result.result.eventId;
  50606. callback(result);
  50607. this.events && this.events.un(eventListeners);
  50608. return false;
  50609. }
  50610. },
  50611. processFailed: function (result) {
  50612. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  50613. delete result.eventId;
  50614. callback(result);
  50615. this.events && this.events.un(eventListeners);
  50616. return false;
  50617. }
  50618. }
  50619. };
  50620. this.events.on(eventListeners);
  50621. const requestParams = {
  50622. method,
  50623. url,
  50624. scope: this,
  50625. success(result, options) {
  50626. result.eventId = eventId;
  50627. this.serviceProcessCompleted(result, options);
  50628. },
  50629. failure(result, options) {
  50630. result.eventId = eventId;
  50631. this.serviceProcessFailed(result, options);
  50632. }
  50633. };
  50634. if (params) {
  50635. requestParams.params = params;
  50636. }
  50637. this.request(requestParams);
  50638. }
  50639. /**
  50640. * @private
  50641. * @function _getGraphMapData
  50642. * @description 获取图谱信息
  50643. * @param {string} graphMapName - 图谱名称
  50644. * @returns {Promise} Promise 对象
  50645. */
  50646. _getGraphMapData(graphMapName) {
  50647. return new Promise((resolve, reject) => {
  50648. this.getGraphMap(graphMapName, (res) => {
  50649. if (res.type === 'processFailed') {
  50650. reject(res.error);
  50651. } else {
  50652. if (res.result.data === '') {
  50653. reject('无数据');
  50654. } else {
  50655. resolve(res.result.graphMap);
  50656. }
  50657. }
  50658. });
  50659. });
  50660. }
  50661. /**
  50662. * @private
  50663. * @function _queryDataBySql
  50664. * @description 查询实体和关系数据。
  50665. * @param {string} cypherQuery - 查询语句
  50666. * @returns {Promise} Promise 对象。
  50667. */
  50668. _queryDataBySql(cypherQuery) {
  50669. return new Promise((resolve, reject) => {
  50670. this.query(cypherQuery, (res) => {
  50671. if (res.type === 'processFailed') {
  50672. reject(res.error);
  50673. } else {
  50674. resolve(res.result);
  50675. }
  50676. });
  50677. });
  50678. }
  50679. }
  50680. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  50681. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50682. * This program are made available under the terms of the Apache License, Version 2.0
  50683. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50684. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  50685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50686. * This program are made available under the terms of the Apache License, Version 2.0
  50687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50688. /**
  50689. * @enum ServiceStatus
  50690. * @category BaseTypes Constant
  50691. * @description 服务发布状态。
  50692. * @usage
  50693. * ```
  50694. * // 浏览器
  50695. * <script type="text/javascript" src="{cdn}"></script>
  50696. * <script>
  50697. * const result = {namespace}.ServiceStatus.DOES_NOT_INVOLVE;
  50698. *
  50699. * </script>
  50700. * // ES6 Import
  50701. * import { ServiceStatus } from '{npm}';
  50702. *
  50703. * const result = ServiceStatus.DOES_NOT_INVOLVE;
  50704. * ```
  50705. */
  50706. var ServiceStatus = {
  50707. /** 不涉及,不可发布。 */
  50708. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  50709. /** 发布失败。 */
  50710. PUBLISH_FAILED: "PUBLISH_FAILED",
  50711. /** 已发布。 */
  50712. PUBLISHED: "PUBLISHED",
  50713. /** 正在发布。 */
  50714. PUBLISHING: "PUBLISHING",
  50715. /** 未发布。 */
  50716. UNPUBLISHED: "UNPUBLISHED",
  50717. /** 取消服务失败。 */
  50718. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  50719. };
  50720. /**
  50721. * @enum DataItemOrderBy
  50722. * @category BaseTypes Constant
  50723. * @description 数据排序字段。
  50724. * @usage
  50725. * ```
  50726. * // 浏览器
  50727. * <script type="text/javascript" src="{cdn}"></script>
  50728. * <script>
  50729. * const result = {namespace}.DataItemOrderBy.FILENAME;
  50730. *
  50731. * </script>
  50732. * // ES6 Import
  50733. * import { DataItemOrderBy } from '{npm}';
  50734. *
  50735. * const result = DataItemOrderBy.FILENAME;
  50736. * ```
  50737. */
  50738. var DataItemOrderBy = {
  50739. /** 文件名。 */
  50740. FILENAME: "FILENAME",
  50741. /** ID。 */
  50742. ID: "ID",
  50743. /** 最后修改时间。 */
  50744. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  50745. /** 作者昵称。 */
  50746. NICKNAME: "NICKNAME",
  50747. /** SERVICESTATUS。 */
  50748. SERVICESTATUS: "SERVICESTATUS",
  50749. /** 大小。 */
  50750. SIZE: "SIZE",
  50751. /** 状态。 */
  50752. STATUS: "STATUS",
  50753. /** 类型。 */
  50754. TYPE: "TYPE",
  50755. /** 更新时间。 */
  50756. UPDATETIME: "UPDATETIME",
  50757. /** 作者名。 */
  50758. USERNAME: "USERNAME"
  50759. };
  50760. /**
  50761. * @enum FilterField {number}
  50762. * @category BaseTypes Constant
  50763. * @description 关键字查询时的过滤字段。
  50764. * @usage
  50765. * ```
  50766. * // 浏览器
  50767. * <script type="text/javascript" src="{cdn}"></script>
  50768. * <script>
  50769. * const result = {namespace}.FilterField.LINKPAGE;
  50770. *
  50771. * </script>
  50772. * // ES6 Import
  50773. * import { FilterField } from '{npm}';
  50774. *
  50775. * const result = FilterField.LINKPAGE;
  50776. * ```
  50777. */
  50778. var FilterField = {
  50779. /** 服务地址。 */
  50780. LINKPAGE: "LINKPAGE",
  50781. /** 服务中包含的地图的名称。 */
  50782. MAPTITLE: "MAPTITLE",
  50783. /** 服务创建者昵称。 */
  50784. NICKNAME: "NICKNAME",
  50785. /** 服务名称。 */
  50786. RESTITLE: "RESTITLE",
  50787. /** 服务创建者用户名。 */
  50788. USERNAME: "USERNAME"
  50789. };
  50790. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  50791. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50792. * This program are made available under the terms of the Apache License, Version 2.0
  50793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50794. /**
  50795. * @class OnlineServiceBase
  50796. * @deprecatedclass SuperMap.OnlineServiceBase
  50797. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  50798. * @category iPortal/Online Core
  50799. * @param {Object} options - 可选参数。
  50800. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50801. * @param {Object} [options.headers] - 请求头。
  50802. * @usage
  50803. */
  50804. class OnlineServiceBase {
  50805. constructor(options) {
  50806. options = options || {};
  50807. Util_Util.extend(this, options);
  50808. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  50809. }
  50810. /**
  50811. * @function OnlineServiceBase.prototype.request
  50812. * @description 请求 online 服务
  50813. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  50814. * @param {string} url - 服务地址。
  50815. * @param {Object} param - URL 查询参数。
  50816. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  50817. * @returns {Promise} 包含请求结果的 Promise 对象。
  50818. */
  50819. request(method, url, param, requestOptions = {}) {
  50820. url = SecurityManager.appendCredential(url);
  50821. requestOptions['crossOrigin'] = this.options.crossOrigin;
  50822. requestOptions['headers'] = this.options.headers;
  50823. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  50824. return response.json();
  50825. });
  50826. }
  50827. }
  50828. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  50829. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50830. * This program are made available under the terms of the Apache License, Version 2.0
  50831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50832. /**
  50833. * @class OnlineData
  50834. * @deprecatedclass SuperMap.OnlineData
  50835. * @classdesc Online myData 服务。
  50836. * @category iPortal/Online Resources Data
  50837. * @param {string} serviceRootUrl - 服务地址。
  50838. * @param {Object} options - 可选参数。
  50839. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50840. * @param {Object} [options.headers] - 请求头。
  50841. * @usage
  50842. * @extends OnlineServiceBase
  50843. */
  50844. class OnlineData extends OnlineServiceBase {
  50845. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  50846. constructor(serviceRootUrl, options) {
  50847. super(serviceRootUrl);
  50848. options = options || {};
  50849. //MD5
  50850. this.MD5 = null;
  50851. //文件类型。
  50852. this.type = null;
  50853. //数据上传者名称。
  50854. this.userName = null;
  50855. //文件名称。
  50856. this.fileName = null;
  50857. //文件大小,单位为 B 。
  50858. this.size = null;
  50859. //服务发布状态。
  50860. this.serviceStatus = null;
  50861. //服务 id 。
  50862. this.serviceId = null;
  50863. //数据项 id 。
  50864. this.id = null;
  50865. //最后修改时间。
  50866. this.lastModfiedTime = null;
  50867. //文件状态。
  50868. this.status = null;
  50869. //数据文件存储 id 。
  50870. this.storageId = null;
  50871. //数据的发布信息。
  50872. this.publishInfo = null;
  50873. //数据的权限信息。
  50874. this.authorizeSetting = null;
  50875. //用户的昵称。
  50876. this.nickname = null;
  50877. //数据的标签。
  50878. this.tags = [];
  50879. //数据的描述信息。
  50880. this.description = null;
  50881. //数据发布的服务信息集合。
  50882. this.dataItemServices = null;
  50883. //数据坐标类型。
  50884. this.coordType = null;
  50885. //数据审核信息
  50886. this.dataCheckResult = null;
  50887. //数据元数据信息
  50888. this.dataMetaInfo = null;
  50889. //数据的缩略图路径。
  50890. this.thumbnail = null;
  50891. Util_Util.extend(this, options);
  50892. if (this.id) {
  50893. this.serviceUrl = serviceRootUrl + "/" + this.id;
  50894. }
  50895. this.CLASS_NAME = "SuperMap.OnlineData";
  50896. }
  50897. /**
  50898. * @function OnlineData.prototype.load
  50899. * @description 通过 URL 请求获取该服务完整信息。
  50900. * @returns {Promise} 不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  50901. */
  50902. load() {
  50903. if (!this.serviceUrl) {
  50904. return;
  50905. }
  50906. var me = this;
  50907. return me.request("GET", this.serviceUrl).then(function (result) {
  50908. Util_Util.extend(me, result);
  50909. });
  50910. }
  50911. /**
  50912. * @function OnlineData.prototype.getPublishedServices
  50913. * @description 获取数据发布的所有服务。
  50914. * @returns {Object} 数据发布的所有服务。
  50915. */
  50916. getPublishedServices() {
  50917. return this.dataItemServices;
  50918. }
  50919. /**
  50920. * @function OnlineData.prototype.getAuthorizeSetting
  50921. * @description 获取数据的权限信息。
  50922. * @returns {Object} 权限信息。
  50923. */
  50924. getAuthorizeSetting() {
  50925. return this.authorizeSetting;
  50926. }
  50927. }
  50928. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  50929. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50930. * This program are made available under the terms of the Apache License, Version 2.0
  50931. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50932. /**
  50933. * @class Online
  50934. * @deprecatedclass SuperMap.Online
  50935. * @classdesc 对接 SuperMap Online 所有基础服务。
  50936. * @category iPortal/Online Resources
  50937. * @modulecategory Services
  50938. * @example
  50939. * var online=new Online();
  50940. * var services = online.queryDatas(param);
  50941. * service.then(function(services){
  50942. * var service= services[0];
  50943. * service.updateDataInfo();
  50944. * })
  50945. * @usage
  50946. */
  50947. class Online {
  50948. //TODO 目前并没有对接Online的所有操作,需要补充完整
  50949. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  50950. constructor() {
  50951. this.rootUrl = "https://www.supermapol.com";
  50952. this.webUrl = this.rootUrl + "/web";
  50953. var mContentUrl = this.webUrl + "/mycontent";
  50954. this.mDatasUrl = mContentUrl + "/datas";
  50955. this.CLASS_NAME = "SuperMap.Online";
  50956. }
  50957. /**
  50958. * @function Online.prototype.load
  50959. * @description 加载 online,验证 online 是否可用。
  50960. * @returns {Promise} 包含网络请求结果的 Promise 对象。
  50961. */
  50962. load() {
  50963. return FetchRequest.get(this.rootUrl).then(function (response) {
  50964. return response;
  50965. });
  50966. }
  50967. /**
  50968. * @function Online.prototype.login
  50969. * @description 登录Online
  50970. */
  50971. login() {
  50972. SecurityManager.loginOnline(this.rootUrl, true);
  50973. }
  50974. /**
  50975. * @function Online.prototype.queryDatas
  50976. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  50977. * @param {OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  50978. * @returns {Promise} 包含所有数据服务信息的 Promise 对象。
  50979. */
  50980. queryDatas(parameter) {
  50981. var me = this, url = me.mDatasUrl;
  50982. if (parameter) {
  50983. parameter = parameter.toJSON();
  50984. }
  50985. return FetchRequest.get(url, parameter).then(function (json) {
  50986. if (!json || !json.content || json.content.length < 1) {
  50987. return;
  50988. }
  50989. var services = [], contents = json.content, len = contents.length;
  50990. for (var i = 0; i < len; i++) {
  50991. var content = contents[i];
  50992. var service = new OnlineData(me.mDatasUrl, content);
  50993. services.push(service);
  50994. }
  50995. return services;
  50996. });
  50997. }
  50998. }
  50999. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  51000. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51001. * This program are made available under the terms of the Apache License, Version 2.0
  51002. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51003. /**
  51004. * @class OnlineQueryDatasParameter
  51005. * @deprecatedclass SuperMap.OnlineQueryDatasParameter
  51006. * @classdesc myDatas 服务资源查询参数。
  51007. * @category iPortal/Online Resources Data
  51008. * @param {Object} options - 参数。
  51009. * @usage
  51010. */
  51011. class OnlineQueryDatasParameter {
  51012. constructor(options) {
  51013. options = options || {};
  51014. /**
  51015. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.userNames
  51016. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  51017. */
  51018. this.userNames = null;
  51019. /**
  51020. * @member {Array.<Object>} OnlineQueryDatasParameter.prototype.types
  51021. * @description 数据类型。
  51022. */
  51023. this.types = null;
  51024. /**
  51025. * @member {string} OnlineQueryDatasParameter.prototype.fileName
  51026. * @description 文件名称。
  51027. */
  51028. this.fileName = null;
  51029. /**
  51030. * @member {string} OnlineQueryDatasParameter.prototype.serviceStatuses
  51031. * @description 服务发布状态。
  51032. */
  51033. this.serviceStatuses = null;
  51034. /**
  51035. * @member {string} OnlineQueryDatasParameter.prototype.serviceId
  51036. * @description 服务 ID。
  51037. */
  51038. this.serviceId = null;
  51039. /**
  51040. * @member {Array.<number>} OnlineQueryDatasParameter.prototype.ids
  51041. * @description 由数据项 ID 组成的整型数组。
  51042. */
  51043. this.ids = null;
  51044. /**
  51045. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.keywords
  51046. * @description 关键字。
  51047. */
  51048. this.keywords = null;
  51049. /**
  51050. * @member {string} OnlineQueryDatasParameter.prototype.orderBy
  51051. * @description 排序字段。
  51052. */
  51053. this.orderBy = null;
  51054. /**
  51055. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.tags
  51056. * @description 数据的标签。
  51057. */
  51058. this.tags = null;
  51059. /**
  51060. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.filterFields
  51061. * @description 用于关键字查询时的过滤字段。
  51062. */
  51063. this.filterFields = null;
  51064. Util_Util.extend(this, options)
  51065. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  51066. }
  51067. /**
  51068. * @function OnlineQueryDatasParameter.prototype.toJSON
  51069. * @description 返回对应的 JSON 对象。
  51070. * @returns {Object} 对应的 JSON 对象。
  51071. */
  51072. toJSON() {
  51073. var me = this;
  51074. var jsonObj = {
  51075. "types": me.types,
  51076. "fileName": me.fileName,
  51077. "serviceStatuses": me.serviceStatuses,
  51078. "serviceId": me.serviceId,
  51079. "ids": me.ids,
  51080. "keywords": me.keywords,
  51081. "orderBy": me.orderBy,
  51082. "tags": me.tags,
  51083. "filterFields": me.filterFields
  51084. };
  51085. for (var key in jsonObj) {
  51086. if (jsonObj[key] == null) {
  51087. delete jsonObj[key]
  51088. }
  51089. }
  51090. return jsonObj;
  51091. }
  51092. }
  51093. ;// CONCATENATED MODULE: ./src/common/online/index.js
  51094. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51095. * This program are made available under the terms of the Apache License, Version 2.0
  51096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51097. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  51098. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51099. * This program are made available under the terms of the Apache License, Version 2.0
  51100. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51101. /**
  51102. * @class KeyServiceParameter
  51103. * @deprecatedclass SuperMap.KeyServiceParameter
  51104. * @classdesc key申请参数
  51105. * @category Security
  51106. * @param {Object} options - 参数。
  51107. * @param {string} options.name - 申请服务名称。
  51108. * @param {number} options.serviceIds - 服务 ID。
  51109. * @param {ClientType} [options.clientType=ClientType.SERVER] - 服务端类型。
  51110. * @param {number} options.limitation - 有效期
  51111. * @usage
  51112. */
  51113. class KeyServiceParameter {
  51114. constructor(options) {
  51115. this.name = null;
  51116. this.serviceIds = null;
  51117. this.clientType = ClientType.SERVER;
  51118. this.limitation = null;
  51119. Util_Util.extend(this, options);
  51120. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  51121. }
  51122. /**
  51123. * @function KeyServiceParameter.prototype.toJSON
  51124. * @description 转换成 JSON 对象
  51125. * @returns {Object} 参数的 JSON 对象
  51126. */
  51127. toJSON() {
  51128. return {
  51129. name: this.name,
  51130. serviceIds: this.serviceIds,
  51131. clientType: this.clientType,
  51132. limitation: this.limitation
  51133. }
  51134. }
  51135. }
  51136. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  51137. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51138. * This program are made available under the terms of the Apache License, Version 2.0
  51139. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51140. /**
  51141. * @class ServerInfo
  51142. * @deprecatedclass SuperMap.ServerInfo
  51143. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等。
  51144. * @category Security
  51145. * @param {string} type - 服务器类型。
  51146. * @param {Object} options - 参数。
  51147. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver。
  51148. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  51149. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  51150. * @usage
  51151. */
  51152. class ServerInfo {
  51153. constructor(type, options) {
  51154. /**
  51155. * @member {ServerType} ServerInfo.prototype.type
  51156. * @description 服务器类型。
  51157. */
  51158. this.type = type;
  51159. /**
  51160. * @member {string} ServerInfo.prototype.server
  51161. * @description 服务器地址。
  51162. */
  51163. this.server = null;
  51164. /**
  51165. * @member {string} [ServerInfo.prototype.tokenServiceUrl]
  51166. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  51167. */
  51168. this.tokenServiceUrl = null;
  51169. /**
  51170. * @member {string} [ServerInfo.prototype.keyServiceUrl]
  51171. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  51172. */
  51173. this.keyServiceUrl = null;
  51174. Util_Util.extend(this, options);
  51175. this.CLASS_NAME = "SuperMap.ServerInfo";
  51176. this.type = this.type || ServerType.ISERVER;
  51177. if (!this.server) {
  51178. console.error('server url require is not undefined')
  51179. }
  51180. // var patten = /http:\/\/([^\/]+)/i;
  51181. //this.server = this.server.match(patten)[0];
  51182. var tokenServiceSuffix = "/services/security/tokens";
  51183. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  51184. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  51185. }
  51186. if (!this.tokenServiceUrl) {
  51187. this.tokenServiceUrl = Util_Util.urlPathAppend(this.server, tokenServiceSuffix);
  51188. }
  51189. if (!this.keyServiceUrl) {
  51190. if (this.type === ServerType.IPORTAL) {
  51191. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  51192. } else if (this.type === ServerType.ONLINE) {
  51193. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys");
  51194. }
  51195. }
  51196. }
  51197. }
  51198. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  51199. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51200. * This program are made available under the terms of the Apache License, Version 2.0
  51201. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51202. /**
  51203. * @class TokenServiceParameter
  51204. * @deprecatedclass SuperMap.TokenServiceParameter
  51205. * @classdesc token 申请参数。
  51206. * @category Security
  51207. * @param {Object} options - 参数。
  51208. * @param {string} options.username - 用户名。
  51209. * @param {string} options.password - 密码。
  51210. * @param {ClientType} [options.clientType='ClientType.NONE'] - token 申请的客户端标识类型。
  51211. * @param {string} [options.ip] - clientType=IP 时,此为必选参数。
  51212. * @param {string} [options.referer] -clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  51213. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  51214. * @usage
  51215. *
  51216. */
  51217. class TokenServiceParameter {
  51218. constructor(options) {
  51219. /**
  51220. * @member {string} TokenServiceParameter.prototype.userName
  51221. * @description 用户名。
  51222. */
  51223. this.userName = null;
  51224. /**
  51225. * @member {string} TokenServiceParameter.prototype.password
  51226. * @description 密码。
  51227. */
  51228. this.password = null;
  51229. /**
  51230. * @member {ClientType} TokenServiceParameter.prototype.clientType
  51231. * @description token 申请的客户端标识类型。
  51232. */
  51233. this.clientType = ClientType.NONE;
  51234. /**
  51235. * @member {string} [TokenServiceParameter.prototype.ip]
  51236. * @description clientType=IP 时,此为必选参数。
  51237. */
  51238. this.ip = null;
  51239. /**
  51240. * @member {string} [TokenServiceParameter.prototype.referer]
  51241. * @description clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  51242. */
  51243. this.referer = null;
  51244. /**
  51245. * @member {number} TokenServiceParameter.prototype.expiration
  51246. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  51247. */
  51248. this.expiration = 60;
  51249. Util_Util.extend(this, options);
  51250. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  51251. }
  51252. /**
  51253. * @function TokenServiceParameter.prototype.toJSON
  51254. * @description 将所有信息转成 JSON 字符串。
  51255. * @returns {string} 参数的 JSON 字符串。
  51256. */
  51257. toJSON() {
  51258. return {
  51259. userName: this.userName,
  51260. password: this.password,
  51261. clientType: this.clientType,
  51262. ip: this.ip,
  51263. referer: this.referer,
  51264. expiration: this.expiration
  51265. }
  51266. }
  51267. }
  51268. ;// CONCATENATED MODULE: ./src/common/security/index.js
  51269. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51270. * This program are made available under the terms of the Apache License, Version 2.0
  51271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51272. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  51273. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  51274. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  51275. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  51276. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51277. * This program are made available under the terms of the Apache License, Version 2.0
  51278. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51279. /**
  51280. * @class ElasticSearch
  51281. * @deprecatedclass SuperMap.ElasticSearch
  51282. * @classdesc ElasticSearch服务类。
  51283. * @category ElasticSearch
  51284. * @modulecategory Services
  51285. * @param {string} url - ElasticSearch服务地址。
  51286. * @param {Object} options - 参数。
  51287. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  51288. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  51289. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  51290. * @param {Object} [options.geoFence] - 地理围栏。
  51291. * @description
  51292. * <h3 style="font-size: 20px;margin-top: 20px;margin-bottom: 10px;">11.1.0</h3>
  51293. * 该功能依赖<a href="https://github.com/elastic/elasticsearch">@elastic/elasticsearch</a>, webpack5或其他不包含Node.js Polyfills的打包工具,需要加入相关配置,以webpack为例:<br/>
  51294. <p style="margin-top:10px;">首先安装相关Polyfills</p><pre><code>npm i stream-http https-browserify stream-browserify tty-browserify browserify-zlib os-browserify buffer url assert process -D</code></pre>
  51295. 然后配置webpack<pre><code>module.exports: {
  51296. resolve: {
  51297. alias: {
  51298. process: 'process/browser',
  51299. },
  51300. mainFields: ['browser', 'main'],
  51301. fallback: {
  51302. fs: false,
  51303. http: require.resolve('stream-http'),
  51304. https: require.resolve('https-browserify'),
  51305. os: require.resolve('os-browserify/browser'),
  51306. stream: require.resolve('stream-browserify'),
  51307. tty: require.resolve('tty-browserify'),
  51308. zlib: require.resolve('browserify-zlib')
  51309. }
  51310. }
  51311. plugins: [
  51312. new webpack.ProvidePlugin({
  51313. process: 'process/browser',
  51314. Buffer: ['buffer', 'Buffer']
  51315. }),
  51316. ]
  51317. }</code></pre>
  51318. * @usage
  51319. */
  51320. class ElasticSearch {
  51321. constructor(url, options) {
  51322. options = options || {};
  51323. /**
  51324. * @member {string} ElasticSearch.prototype.url
  51325. * @description ElasticSearch服务地址。
  51326. */
  51327. this.url = url;
  51328. /**
  51329. * @member {Object} ElasticSearch.prototype.client
  51330. * @description client ES客户端。
  51331. */
  51332. try {
  51333. // 老版本
  51334. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  51335. host: this.url
  51336. });
  51337. } catch (e) {
  51338. // 新版本
  51339. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  51340. node: {
  51341. url: new URL(this.url)
  51342. }
  51343. });
  51344. }
  51345. /**
  51346. * @deprecated
  51347. * @member {function} [ElasticSearch.prototype.change]
  51348. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  51349. */
  51350. this.change = null;
  51351. /**
  51352. * @member {boolean} [ElasticSearch.prototype.openGeoFence=false]
  51353. * @description 是否开启地理围栏验证,默认为不开启。
  51354. */
  51355. this.openGeoFence = false;
  51356. /**
  51357. * @member {function} [ElasticSearch.prototype.outOfGeoFence]
  51358. * @description 数据超出地理围栏后执行的函数。
  51359. */
  51360. this.outOfGeoFence = null;
  51361. /**
  51362. * @member {Object} [ElasticSearch.prototype.geoFence]
  51363. * @description 地理围栏。
  51364. * @example {
  51365. * radius: 1000,//单位是m
  51366. * center: [104.40, 30.43],
  51367. * unit: 'meter|degree'
  51368. * }
  51369. */
  51370. this.geoFence = null;
  51371. /*
  51372. * Constant: EVENT_TYPES
  51373. * {Array.<String>}
  51374. * 此类支持的事件类型。
  51375. *
  51376. */
  51377. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  51378. /**
  51379. * @member {Events} ElasticSearch.prototype.events
  51380. * @description 事件。
  51381. */
  51382. this.events = new Events(this, null, this.EVENT_TYPES);
  51383. /**
  51384. * @member {Object} ElasticSearch.prototype.eventListeners
  51385. * @description 监听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  51386. * 相当于调用 Events.on(eventListeners)。
  51387. */
  51388. this.eventListeners = null;
  51389. Util_Util.extend(this, options);
  51390. if (this.eventListeners instanceof Object) {
  51391. this.events.on(this.eventListeners);
  51392. }
  51393. }
  51394. /**
  51395. * @function ElasticSearch.prototype.setGeoFence
  51396. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  51397. * @param {Geometry} geoFence - 地理围栏。
  51398. */
  51399. setGeoFence(geoFence) {
  51400. this.geoFence = geoFence;
  51401. }
  51402. /**
  51403. * @function ElasticSearch.prototype.bulk
  51404. * @description 批量操作API,允许执行多个索引/删除操作。
  51405. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  51406. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  51407. * @param {Object} params - 参数。
  51408. * @param {function} callback - 回调函数。
  51409. */
  51410. bulk(params, callback) {
  51411. return this.client.bulk(params, this._handleCallback(callback));
  51412. }
  51413. /**
  51414. * @function ElasticSearch.prototype.clearScroll
  51415. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  51416. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  51417. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  51418. * @param {Object} params - 参数。
  51419. * @param {function} callback - 回调函数。
  51420. */
  51421. clearScroll(params, callback) {
  51422. return this.client.clearScroll(params, this._handleCallback(callback));
  51423. }
  51424. /**
  51425. * @function ElasticSearch.prototype.count
  51426. * @description 获取集群、索引、类型或查询的文档个数。
  51427. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  51428. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  51429. * @param {Object} params - 参数。
  51430. * @param {function} callback - 回调函数。
  51431. */
  51432. count(params, callback) {
  51433. return this.client.count(params, this._handleCallback(callback));
  51434. }
  51435. /**
  51436. * @function ElasticSearch.prototype.create
  51437. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且ID已经存在的文档将发生错误。</br>
  51438. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  51439. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  51440. * @param {Object} params - 参数。
  51441. * @param {function} callback - 回调函数。
  51442. */
  51443. create(params, callback) {
  51444. return this.client.create(params, this._handleCallback(callback));
  51445. }
  51446. /**
  51447. * @function ElasticSearch.prototype.delete
  51448. * @description 根据其ID从特定索引中删除键入的JSON文档。
  51449. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  51450. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  51451. * @param {Object} params - 参数。
  51452. * @param {function} callback - 回调函数。
  51453. */
  51454. delete(params, callback) {
  51455. return this.client.delete(params, this._handleCallback(callback));
  51456. }
  51457. /**
  51458. * @function ElasticSearch.prototype.deleteByQuery
  51459. * @description 根据其ID从特定索引中删除键入的JSON文档。
  51460. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  51461. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  51462. * @param {Object} params - 参数。
  51463. * @param {function} callback - 回调函数。
  51464. */
  51465. deleteByQuery(params, callback) {
  51466. return this.client.deleteByQuery(params, this._handleCallback(callback));
  51467. }
  51468. /**
  51469. * @function ElasticSearch.prototype.deleteScript
  51470. * @description 根据其ID删除脚本。</br>
  51471. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  51472. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  51473. * @param {Object} params - 参数。
  51474. * @param {function} callback - 回调函数。
  51475. */
  51476. deleteScript(params, callback) {
  51477. return this.client.deleteScript(params, this._handleCallback(callback));
  51478. }
  51479. /**
  51480. * @function ElasticSearch.prototype.deleteTemplate
  51481. * @description 根据其ID删除模板。</br>
  51482. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  51483. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  51484. * @param {Object} params - 参数。
  51485. * @param {function} callback - 回调函数。
  51486. */
  51487. deleteTemplate(params, callback) {
  51488. return this.client.deleteTemplate(params, this._handleCallback(callback));
  51489. }
  51490. /**
  51491. * @function ElasticSearch.prototype.exists
  51492. * @description 检查给定文档是否存在。</br>
  51493. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  51494. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  51495. * @param {Object} params - 参数。
  51496. * @param {function} callback - 回调函数。
  51497. */
  51498. exists(params, callback) {
  51499. return this.client.exists(params, this._handleCallback(callback));
  51500. }
  51501. /**
  51502. * @function ElasticSearch.prototype.existsSource
  51503. * @description 检查资源是否存在。</br>
  51504. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  51505. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  51506. * @param {Object} params - 参数。
  51507. * @param {function} callback - 回调函数。
  51508. */
  51509. existsSource(params, callback) {
  51510. return this.client.existsSource(params, this._handleCallback(callback));
  51511. }
  51512. /**
  51513. * @function ElasticSearch.prototype.explain
  51514. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  51515. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  51516. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  51517. * @param {Object} params - 参数。
  51518. * @param {function} callback - 回调函数。
  51519. */
  51520. explain(params, callback) {
  51521. return this.client.explain(params, this._handleCallback(callback));
  51522. }
  51523. /**
  51524. * @function ElasticSearch.prototype.fieldCaps
  51525. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  51526. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  51527. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  51528. * @param {Object} params - 参数。
  51529. * @param {function} callback - 回调函数。
  51530. */
  51531. fieldCaps(params, callback) {
  51532. return this.client.fieldCaps(params, this._handleCallback(callback));
  51533. }
  51534. /**
  51535. * @function ElasticSearch.prototype.get
  51536. * @description 从索引获取一个基于其ID的类型的JSON文档。</br>
  51537. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  51538. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  51539. * @param {Object} params - 参数。
  51540. * @param {function} callback - 回调函数。
  51541. */
  51542. get(params, callback) {
  51543. return this.client.get(params, this._handleCallback(callback));
  51544. }
  51545. /**
  51546. * @function ElasticSearch.prototype.getScript
  51547. * @description 获取脚本。</br>
  51548. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  51549. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  51550. * @param {Object} params - 参数。
  51551. * @param {function} callback - 回调函数。
  51552. */
  51553. getScript(params, callback) {
  51554. return this.client.getScript(params, this._handleCallback(callback));
  51555. }
  51556. /**
  51557. * @function ElasticSearch.prototype.getSource
  51558. * @description 通过索引,类型和ID获取文档的源。</br>
  51559. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  51560. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  51561. * @param {Object} params - 参数。
  51562. * @param {function} callback - 回调函数。
  51563. */
  51564. getSource(params, callback) {
  51565. return this.client.getSource(params, this._handleCallback(callback));
  51566. }
  51567. /**
  51568. * @function ElasticSearch.prototype.getTemplate
  51569. * @description 获取模板。</br>
  51570. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  51571. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  51572. * @param {Object} params - 参数。
  51573. * @param {function} callback - 回调函数。
  51574. */
  51575. getTemplate(params, callback) {
  51576. return this.client.getTemplate(params, this._handleCallback(callback));
  51577. }
  51578. /**
  51579. * @function ElasticSearch.prototype.index
  51580. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  51581. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  51582. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  51583. * @param {Object} params - 参数。
  51584. * @param {function} callback - 回调函数。
  51585. */
  51586. index(params, callback) {
  51587. return this.client.index(params, this._handleCallback(callback));
  51588. }
  51589. /**
  51590. * @function ElasticSearch.prototype.info
  51591. * @description 从当前集群获取基本信息。</br>
  51592. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  51593. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  51594. * @param {Object} params - 参数。
  51595. * @param {function} callback - 回调函数。
  51596. */
  51597. info(params, callback) {
  51598. return this.client.info(params, this._handleCallback(callback));
  51599. }
  51600. /**
  51601. * @function ElasticSearch.prototype.mget
  51602. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  51603. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  51604. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  51605. * @param {Object} params - 参数。
  51606. * @param {function} callback - 回调函数。
  51607. */
  51608. mget(params, callback) {
  51609. return this.client.mget(params, this._handleCallback(callback));
  51610. }
  51611. /**
  51612. * @function ElasticSearch.prototype.msearch
  51613. * @description 在同一请求中执行多个搜索请求。</br>
  51614. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  51615. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  51616. * @param {Object} params - 参数。
  51617. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  51618. * 回调参数:error,response,结果存储在response.responses中。
  51619. */
  51620. msearch(params, callback) {
  51621. let me = this;
  51622. return me.client.msearch(params)
  51623. .then(function (resp) {
  51624. resp = resp.body || resp;
  51625. me._update(resp.responses, callback);
  51626. return resp;
  51627. }, function (err) {
  51628. callback(err);
  51629. me.events.triggerEvent('error', {error: err});
  51630. return err;
  51631. });
  51632. }
  51633. /**
  51634. * @function ElasticSearch.prototype.msearchTemplate
  51635. * @description 在同一请求中执行多个搜索模板请求。</br>
  51636. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  51637. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  51638. * @param {Object} params - 参数。
  51639. * @param {function} callback - 回调函数。
  51640. */
  51641. msearchTemplate(params, callback) {
  51642. return this.client.msearchTemplate(params, this._handleCallback(callback));
  51643. }
  51644. /**
  51645. * @function ElasticSearch.prototype.mtermvectors
  51646. * @description 多termvectors API允许一次获得多个termvectors。</br>
  51647. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  51648. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  51649. * @param {Object} params - 参数。
  51650. * @param {function} callback - 回调函数。
  51651. */
  51652. mtermvectors(params, callback) {
  51653. return this.client.mtermvectors(params, this._handleCallback(callback));
  51654. }
  51655. /**
  51656. * @function ElasticSearch.prototype.ping
  51657. * @description 测试连接。</br>
  51658. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  51659. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  51660. * @param {Object} params - 参数。
  51661. * @param {function} callback - 回调函数。
  51662. */
  51663. ping(params, callback) {
  51664. return this.client.ping(params, this._handleCallback(callback));
  51665. }
  51666. /**
  51667. * @function ElasticSearch.prototype.putScript
  51668. * @description 添加脚本。</br>
  51669. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  51670. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  51671. * @param {Object} params - 参数。
  51672. * @param {function} callback - 回调函数。
  51673. */
  51674. putScript(params, callback) {
  51675. return this.client.putScript(params, this._handleCallback(callback));
  51676. }
  51677. /**
  51678. * @function ElasticSearch.prototype.putTemplate
  51679. * @description 添加模板。</br>
  51680. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  51681. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  51682. * @param {Object} params - 参数。
  51683. * @param {function} callback - 回调函数。
  51684. */
  51685. putTemplate(params, callback) {
  51686. return this.client.putTemplate(params, this._handleCallback(callback));
  51687. }
  51688. /**
  51689. * @function ElasticSearch.prototype.reindex
  51690. * @description 重新索引。</br>
  51691. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  51692. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  51693. * @param {Object} params - 参数。
  51694. * @param {function} callback - 回调函数。
  51695. */
  51696. reindex(params, callback) {
  51697. return this.client.reindex(params, this._handleCallback(callback));
  51698. }
  51699. /**
  51700. * @function ElasticSearch.prototype.reindexRessrottle
  51701. * @description 重新索引。</br>
  51702. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  51703. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  51704. * @param {Object} params - 参数。
  51705. * @param {function} callback - 回调函数。
  51706. */
  51707. reindexRessrottle(params, callback) {
  51708. return this.client.reindexRessrottle(params, this._handleCallback(callback));
  51709. }
  51710. /**
  51711. * @function ElasticSearch.prototype.renderSearchTemplate
  51712. * @description 搜索模板。</br>
  51713. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  51714. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  51715. * @param {Object} params - 参数。
  51716. * @param {function} callback - 回调函数。
  51717. */
  51718. renderSearchTemplate(params, callback) {
  51719. return this.client.renderSearchTemplate(params, this._handleCallback(callback));
  51720. }
  51721. /**
  51722. * @function ElasticSearch.prototype.scroll
  51723. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  51724. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  51725. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  51726. * @param {Object} params - 参数。
  51727. * @param {function} callback - 回调函数。
  51728. */
  51729. scroll(params, callback) {
  51730. return this.client.scroll(params, this._handleCallback(callback));
  51731. }
  51732. /**
  51733. * @function ElasticSearch.prototype.search
  51734. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  51735. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  51736. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  51737. * @param {Object} params - 参数。
  51738. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  51739. * 回调参数:error,response,结果存储在response.responses中。
  51740. */
  51741. search(params, callback) {
  51742. let me = this;
  51743. return me.client.search(params)
  51744. .then(function (resp) {
  51745. resp = resp.body || resp;
  51746. me._update(resp, callback);
  51747. return resp;
  51748. }, function (err) {
  51749. callback && callback(err);
  51750. me.events.triggerEvent('error', {error: err});
  51751. return err;
  51752. });
  51753. }
  51754. /**
  51755. * @function ElasticSearch.prototype.searchShards
  51756. * @description 返回要执行搜索请求的索引和分片。
  51757. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  51758. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  51759. * @param {Object} params - 参数。
  51760. * @param {function} callback - 回调函数。
  51761. */
  51762. searchShards(params, callback) {
  51763. return this.client.searchShards(params, this._handleCallback(callback));
  51764. }
  51765. /**
  51766. * @function ElasticSearch.prototype.searchTemplate
  51767. * @description 搜索模板。
  51768. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  51769. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  51770. * @param {Object} params - 参数。
  51771. * @param {function} callback - 回调函数。
  51772. */
  51773. searchTemplate(params, callback) {
  51774. return this.client.searchTemplate(params, this._handleCallback(callback));
  51775. }
  51776. /**
  51777. * @function ElasticSearch.prototype.suggest
  51778. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  51779. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  51780. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  51781. * @param {Object} params - 参数。
  51782. * @param {function} callback - 回调函数。
  51783. */
  51784. suggest(params, callback) {
  51785. return this.client.suggest(params, this._handleCallback(callback));
  51786. }
  51787. /**
  51788. * @function ElasticSearch.prototype.termvectors
  51789. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  51790. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  51791. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  51792. * @param {Object} params - 参数。
  51793. * @param {function} callback - 回调函数。
  51794. */
  51795. termvectors(params, callback) {
  51796. return this.client.termvectors(params, this._handleCallback(callback));
  51797. }
  51798. /**
  51799. * @function ElasticSearch.prototype.update
  51800. * @description 更新文档的部分。
  51801. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  51802. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  51803. * @param {Object} params - 参数。
  51804. * @param {function} callback - 回调函数。
  51805. */
  51806. update(params, callback) {
  51807. return this.client.update(params, this._handleCallback(callback));
  51808. }
  51809. /**
  51810. * @function ElasticSearch.prototype.updateByQuery
  51811. * @description 通过查询API来更新文档。
  51812. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  51813. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  51814. * @param {Object} params - 参数。
  51815. * @param {function} callback - 回调函数。
  51816. */
  51817. updateByQuery(params, callback) {
  51818. return this.client.updateByQuery(params, this._handleCallback(callback));
  51819. }
  51820. /**
  51821. * @function ElasticSearch.prototype._handleCallback
  51822. * @description 处理ElasticSearch 16.x和5.x的callback兼容。 5.x的回调参数多包了一层body
  51823. * @param {function} callback - 回调函数。
  51824. * @private
  51825. */
  51826. _handleCallback(callback) {
  51827. return function () {
  51828. let args = Array.from(arguments);
  51829. const error = args.shift();
  51830. let resp = args.shift();
  51831. const body = resp && resp.body;
  51832. if (body) {
  51833. const { statusCode, headers } = resp;
  51834. args = [statusCode, headers];
  51835. resp = body;
  51836. }
  51837. callback.call(this, error, resp, ...args);
  51838. };
  51839. }
  51840. _update(data, callback) {
  51841. let me = this;
  51842. if (!data) {
  51843. return;
  51844. }
  51845. me.data = data;
  51846. if (me.openGeoFence && me.geoFence) {
  51847. me._validateDatas(data);
  51848. }
  51849. me.events.triggerEvent('change', {data: me.data});
  51850. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  51851. if (me.change) {
  51852. me.change && me.change(data);
  51853. } else {
  51854. //加responses是为了保持跟原来es自身的数据结构一致
  51855. callback && callback(undefined, {responses: data});
  51856. }
  51857. }
  51858. _validateDatas(datas) {
  51859. if (!datas) {
  51860. return;
  51861. }
  51862. if (!(datas instanceof Array)) {
  51863. datas = [datas];
  51864. }
  51865. var i, len = datas.length;
  51866. for (i = 0; i < len; i++) {
  51867. this._validateData(datas[i]);
  51868. }
  51869. }
  51870. _validateData(data) {
  51871. let me = this;
  51872. data.hits.hits.map(function (source) {
  51873. let content = source._source;
  51874. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  51875. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  51876. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  51877. let contentX = content.x * meterUnit;
  51878. let contentY = content.y * meterUnit;
  51879. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  51880. let radius = me.geoFence.radius;
  51881. if (distance > radius) {
  51882. me.outOfGeoFence && me.outOfGeoFence(data);
  51883. me.events.triggerEvent('outOfGeoFence', {data: data});
  51884. }
  51885. return source;
  51886. });
  51887. }
  51888. _distance(x1, y1, x2, y2) {
  51889. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  51890. }
  51891. _getMeterPerMapUnit(mapUnit) {
  51892. let earchRadiusInMeters = 6378137;
  51893. let meterPerMapUnit;
  51894. if (mapUnit === 'meter') {
  51895. meterPerMapUnit = 1;
  51896. } else if (mapUnit === 'degree') {
  51897. // 每度表示多少米。
  51898. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  51899. }
  51900. return meterPerMapUnit;
  51901. }
  51902. }
  51903. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  51904. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51905. * This program are made available under the terms of the Apache License, Version 2.0
  51906. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51907. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  51908. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51909. * This program are made available under the terms of the Apache License, Version 2.0
  51910. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51911. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  51912. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51913. * This program are made available under the terms of the Apache License, Version 2.0
  51914. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51915. /**
  51916. * @private
  51917. * @class LevelRenderer.Tool.Util
  51918. * @category Visualization Theme
  51919. * LevelRenderer 基础工具类
  51920. *
  51921. */
  51922. class levelRenderer_Util_Util {
  51923. constructor() {
  51924. /**
  51925. * @member {Object} LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  51926. * @description 用于处理merge时无法遍历Date等对象的问题
  51927. */
  51928. this.BUILTIN_OBJECT = {
  51929. '[object Function]': 1,
  51930. '[object RegExp]': 1,
  51931. '[object Date]': 1,
  51932. '[object Error]': 1,
  51933. '[object CanvasGradient]': 1
  51934. };
  51935. /**
  51936. * @member {Object} LevelRenderer.Tool.Util.prototype._ctx
  51937. */
  51938. this._ctx = null;
  51939. /**
  51940. * Property: _canvas
  51941. * {Object}
  51942. */
  51943. this._canvas = null;
  51944. /**
  51945. * Property: _pixelCtx
  51946. * {Object}
  51947. */
  51948. this._pixelCtx = null;
  51949. /**
  51950. * Property: _width
  51951. * {Object}
  51952. */
  51953. this._width = null;
  51954. /**
  51955. * Property: _height
  51956. * {Object}
  51957. */
  51958. this._height = null;
  51959. /**
  51960. * Property: _offsetX
  51961. * {Object}
  51962. */
  51963. this._offsetX = 0;
  51964. /**
  51965. * Property: _offsetY
  51966. * {Object}
  51967. */
  51968. this._offsetY = 0;
  51969. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  51970. }
  51971. /**
  51972. * @function LevelRenderer.Tool.Util.prototype.clone
  51973. * @description 对一个object进行深度拷贝。
  51974. *
  51975. * @param {Object} source - 需要进行拷贝的对象。
  51976. * @return {Object} 拷贝后的新对象。
  51977. */
  51978. clone(source) {
  51979. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  51980. if (typeof source == 'object' && source !== null) {
  51981. var result = source;
  51982. if (source instanceof Array) {
  51983. result = [];
  51984. for (var i = 0, len = source.length; i < len; i++) {
  51985. result[i] = this.clone(source[i]);
  51986. }
  51987. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  51988. result = {};
  51989. for (var key in source) {
  51990. if (source.hasOwnProperty(key)) {
  51991. result[key] = this.clone(source[key]);
  51992. }
  51993. }
  51994. }
  51995. return result;
  51996. }
  51997. return source;
  51998. }
  51999. /**
  52000. * @function LevelRenderer.Tool.Util.prototype.mergeItem
  52001. * @description 合并源对象的单个属性到目标对象。
  52002. *
  52003. * @param {Object} target - 目标对象。
  52004. * @param {Object} source - 源对象。
  52005. * @param {string} key - 键。
  52006. * @param {boolean} overwrite - 是否覆盖。
  52007. * @return {Object} 目标对象
  52008. */
  52009. mergeItem(target, source, key, overwrite) {
  52010. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  52011. if (source.hasOwnProperty(key)) {
  52012. if (typeof target[key] == 'object'
  52013. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  52014. ) {
  52015. // 如果需要递归覆盖,就递归调用merge
  52016. this.merge(
  52017. target[key],
  52018. source[key],
  52019. overwrite
  52020. );
  52021. } else if (overwrite || !(key in target)) {
  52022. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  52023. target[key] = source[key];
  52024. }
  52025. }
  52026. }
  52027. /**
  52028. * @function LevelRenderer.Tool.Util.prototype.merge
  52029. * @description 合并源对象的属性到目标对象。
  52030. *
  52031. * @param {Object} target - 目标对象。
  52032. * @param {Object} source - 源对象。
  52033. * @param {boolean} overwrite - 是否覆盖。
  52034. * @return {Object} 目标对象。
  52035. */
  52036. merge(target, source, overwrite) {
  52037. for (var i in source) {
  52038. this.mergeItem(target, source, i, overwrite);
  52039. }
  52040. return target;
  52041. }
  52042. /**
  52043. * @function LevelRenderer.Tool.Util.prototype.getContext
  52044. * @description 获取 Canvas 上下文。
  52045. * @return {Object} 上下文。
  52046. */
  52047. getContext() {
  52048. if (!this._ctx) {
  52049. this._ctx = document.createElement('canvas').getContext('2d');
  52050. }
  52051. return this._ctx;
  52052. }
  52053. /**
  52054. * @function LevelRenderer.Tool.Util.prototype.getPixelContext
  52055. * @description 获取像素拾取专用的上下文。
  52056. * @return {Object} 像素拾取专用的上下文。
  52057. */
  52058. getPixelContext() {
  52059. if (!this._pixelCtx) {
  52060. this._canvas = document.createElement('canvas');
  52061. this._width = this._canvas.width;
  52062. this._height = this._canvas.height;
  52063. this._pixelCtx = this._canvas.getContext('2d');
  52064. }
  52065. return this._pixelCtx;
  52066. }
  52067. /**
  52068. * @function LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  52069. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  52070. *
  52071. * @param {number} x - 横坐标。
  52072. * @param {number} y - 纵坐标。
  52073. *
  52074. */
  52075. adjustCanvasSize(x, y) {
  52076. var _canvas = this._canvas;
  52077. var _pixelCtx = this._pixelCtx;
  52078. var _width = this._width;
  52079. var _height = this._height;
  52080. var _offsetX = this._offsetX;
  52081. var _offsetY = this._offsetY;
  52082. // 每次加的长度
  52083. var _v = 100;
  52084. var _flag;
  52085. if (x + _offsetX > _width) {
  52086. _width = x + _offsetX + _v;
  52087. _canvas.width = _width;
  52088. _flag = true;
  52089. }
  52090. if (y + _offsetY > _height) {
  52091. _height = y + _offsetY + _v;
  52092. _canvas.height = _height;
  52093. _flag = true;
  52094. }
  52095. if (x < -_offsetX) {
  52096. _offsetX = Math.ceil(-x / _v) * _v;
  52097. _width += _offsetX;
  52098. _canvas.width = _width;
  52099. _flag = true;
  52100. }
  52101. if (y < -_offsetY) {
  52102. _offsetY = Math.ceil(-y / _v) * _v;
  52103. _height += _offsetY;
  52104. _canvas.height = _height;
  52105. _flag = true;
  52106. }
  52107. if (_flag) {
  52108. _pixelCtx.translate(_offsetX, _offsetY);
  52109. }
  52110. }
  52111. /**
  52112. * @function LevelRenderer.Tool.Util.prototype.getPixelOffset
  52113. * @description 获取像素canvas的偏移量。
  52114. * @return {Object} 偏移量。
  52115. */
  52116. getPixelOffset() {
  52117. return {
  52118. x: this._offsetX,
  52119. y: this._offsetY
  52120. };
  52121. }
  52122. /**
  52123. * @function LevelRenderer.Tool.Util.prototype.indexOf
  52124. * @description 查询数组中元素的index
  52125. * @return {Object} 偏移量。
  52126. */
  52127. indexOf(array, value) {
  52128. if (array.indexOf) {
  52129. return array.indexOf(value);
  52130. }
  52131. for (var i = 0, len = array.length; i < len; i++) {
  52132. if (array[i] === value) {
  52133. return i;
  52134. }
  52135. }
  52136. return -1;
  52137. }
  52138. /**
  52139. * @function LevelRenderer.Tool.Util.prototype.inherits
  52140. * @description 构造类继承关系
  52141. *
  52142. * @param {function} clazz - 源类。
  52143. * @param {function} baseClazz - 基类。
  52144. * @return {Object} 偏移量。
  52145. */
  52146. inherits(clazz, baseClazz) {
  52147. var clazzPrototype = clazz.prototype;
  52148. function F() {
  52149. }
  52150. F.prototype = baseClazz.prototype;
  52151. clazz.prototype = new F();
  52152. for (var prop in clazzPrototype) {
  52153. clazz.prototype[prop] = clazzPrototype[prop];
  52154. }
  52155. clazz.constructor = clazz;
  52156. }
  52157. }
  52158. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  52159. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52160. * This program are made available under the terms of the Apache License, Version 2.0
  52161. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52162. /**
  52163. * @class LevelRenderer.Tool.Color
  52164. * @category Visualization Theme
  52165. * @classdesc LevelRenderer 工具-颜色辅助类
  52166. * @private
  52167. */
  52168. class Color {
  52169. constructor() {
  52170. /**
  52171. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Color.prototype.util
  52172. * @description LevelRenderer 基础工具对象。
  52173. */
  52174. this.util = new levelRenderer_Util_Util();
  52175. /**
  52176. * @member {Object} LevelRenderer.Tool.Color.prototype._ctx
  52177. * @description _ctx。
  52178. */
  52179. this._ctx = null;
  52180. /**
  52181. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype.palette
  52182. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  52183. */
  52184. this.palette = [
  52185. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  52186. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  52187. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  52188. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  52189. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  52190. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  52191. ];
  52192. /**
  52193. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype._palette
  52194. * @description 复位色板,用于复位 palette
  52195. */
  52196. this._palette = this.palette;
  52197. /**
  52198. * @member {string} LevelRenderer.Tool.Color.prototype.highlightColor
  52199. * @description 高亮色
  52200. */
  52201. this.highlightColor = 'rgba(0,0,255,1)';
  52202. /**
  52203. * @member {string} LevelRenderer.Tool.Color.prototype._highlightColor
  52204. * @description 复位高亮色
  52205. */
  52206. this._highlightColor = this.highlightColor;
  52207. /**
  52208. * @member {string} LevelRenderer.Tool.Color.prototype.colorRegExp
  52209. * @description 颜色格式,正则表达式。
  52210. */
  52211. this.colorRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i;
  52212. /**
  52213. * @member {string} LevelRenderer.Tool.Color.prototype._nameColors
  52214. * @description 颜色名。
  52215. */
  52216. this._nameColors = {
  52217. aliceblue: '#f0f8ff',
  52218. antiquewhite: '#faebd7',
  52219. aqua: '#0ff',
  52220. aquamarine: '#7fffd4',
  52221. azure: '#f0ffff',
  52222. beige: '#f5f5dc',
  52223. bisque: '#ffe4c4',
  52224. black: '#000',
  52225. blanchedalmond: '#ffebcd',
  52226. blue: '#00f',
  52227. blueviolet: '#8a2be2',
  52228. brown: '#a52a2a',
  52229. burlywood: '#deb887',
  52230. cadetblue: '#5f9ea0',
  52231. chartreuse: '#7fff00',
  52232. chocolate: '#d2691e',
  52233. coral: '#ff7f50',
  52234. cornflowerblue: '#6495ed',
  52235. cornsilk: '#fff8dc',
  52236. crimson: '#dc143c',
  52237. cyan: '#0ff',
  52238. darkblue: '#00008b',
  52239. darkcyan: '#008b8b',
  52240. darkgoldenrod: '#b8860b',
  52241. darkgray: '#a9a9a9',
  52242. darkgrey: '#a9a9a9',
  52243. darkgreen: '#006400',
  52244. darkkhaki: '#bdb76b',
  52245. darkmagenta: '#8b008b',
  52246. darkolivegreen: '#556b2f',
  52247. darkorange: '#ff8c00',
  52248. darkorchid: '#9932cc',
  52249. darkred: '#8b0000',
  52250. darksalmon: '#e9967a',
  52251. darkseagreen: '#8fbc8f',
  52252. darkslateblue: '#483d8b',
  52253. darkslategray: '#2f4f4f',
  52254. darkslategrey: '#2f4f4f',
  52255. darkturquoise: '#00ced1',
  52256. darkviolet: '#9400d3',
  52257. deeppink: '#ff1493',
  52258. deepskyblue: '#00bfff',
  52259. dimgray: '#696969',
  52260. dimgrey: '#696969',
  52261. dodgerblue: '#1e90ff',
  52262. firebrick: '#b22222',
  52263. floralwhite: '#fffaf0',
  52264. forestgreen: '#228b22',
  52265. fuchsia: '#f0f',
  52266. gainsboro: '#dcdcdc',
  52267. ghostwhite: '#f8f8ff',
  52268. gold: '#ffd700',
  52269. goldenrod: '#daa520',
  52270. gray: '#808080',
  52271. grey: '#808080',
  52272. green: '#008000',
  52273. greenyellow: '#adff2f',
  52274. honeydew: '#f0fff0',
  52275. hotpink: '#ff69b4',
  52276. indianred: '#cd5c5c',
  52277. indigo: '#4b0082',
  52278. ivory: '#fffff0',
  52279. khaki: '#f0e68c',
  52280. lavender: '#e6e6fa',
  52281. lavenderblush: '#fff0f5',
  52282. lawngreen: '#7cfc00',
  52283. lemonchiffon: '#fffacd',
  52284. lightblue: '#add8e6',
  52285. lightcoral: '#f08080',
  52286. lightcyan: '#e0ffff',
  52287. lightgoldenrodyellow: '#fafad2',
  52288. lightgray: '#d3d3d3',
  52289. lightgrey: '#d3d3d3',
  52290. lightgreen: '#90ee90',
  52291. lightpink: '#ffb6c1',
  52292. lightsalmon: '#ffa07a',
  52293. lightseagreen: '#20b2aa',
  52294. lightskyblue: '#87cefa',
  52295. lightslategray: '#789',
  52296. lightslategrey: '#789',
  52297. lightsteelblue: '#b0c4de',
  52298. lightyellow: '#ffffe0',
  52299. lime: '#0f0',
  52300. limegreen: '#32cd32',
  52301. linen: '#faf0e6',
  52302. magenta: '#f0f',
  52303. maroon: '#800000',
  52304. mediumaquamarine: '#66cdaa',
  52305. mediumblue: '#0000cd',
  52306. mediumorchid: '#ba55d3',
  52307. mediumpurple: '#9370d8',
  52308. mediumseagreen: '#3cb371',
  52309. mediumslateblue: '#7b68ee',
  52310. mediumspringgreen: '#00fa9a',
  52311. mediumturquoise: '#48d1cc',
  52312. mediumvioletred: '#c71585',
  52313. midnightblue: '#191970',
  52314. mintcream: '#f5fffa',
  52315. mistyrose: '#ffe4e1',
  52316. moccasin: '#ffe4b5',
  52317. navajowhite: '#ffdead',
  52318. navy: '#000080',
  52319. oldlace: '#fdf5e6',
  52320. olive: '#808000',
  52321. olivedrab: '#6b8e23',
  52322. orange: '#ffa500',
  52323. orangered: '#ff4500',
  52324. orchid: '#da70d6',
  52325. palegoldenrod: '#eee8aa',
  52326. palegreen: '#98fb98',
  52327. paleturquoise: '#afeeee',
  52328. palevioletred: '#d87093',
  52329. papayawhip: '#ffefd5',
  52330. peachpuff: '#ffdab9',
  52331. peru: '#cd853f',
  52332. pink: '#ffc0cb',
  52333. plum: '#dda0dd',
  52334. powderblue: '#b0e0e6',
  52335. purple: '#800080',
  52336. red: '#f00',
  52337. rosybrown: '#bc8f8f',
  52338. royalblue: '#4169e1',
  52339. saddlebrown: '#8b4513',
  52340. salmon: '#fa8072',
  52341. sandybrown: '#f4a460',
  52342. seagreen: '#2e8b57',
  52343. seashell: '#fff5ee',
  52344. sienna: '#a0522d',
  52345. silver: '#c0c0c0',
  52346. skyblue: '#87ceeb',
  52347. slateblue: '#6a5acd',
  52348. slategray: '#708090',
  52349. slategrey: '#708090',
  52350. snow: '#fffafa',
  52351. springgreen: '#00ff7f',
  52352. steelblue: '#4682b4',
  52353. tan: '#d2b48c',
  52354. teal: '#008080',
  52355. thistle: '#d8bfd8',
  52356. tomato: '#ff6347',
  52357. turquoise: '#40e0d0',
  52358. violet: '#ee82ee',
  52359. wheat: '#f5deb3',
  52360. white: '#fff',
  52361. whitesmoke: '#f5f5f5',
  52362. yellow: '#ff0',
  52363. yellowgreen: '#9acd32'
  52364. };
  52365. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  52366. }
  52367. /**
  52368. * @function LevelRenderer.Tool.Color.prototype.customPalette
  52369. * @description 自定义调色板。
  52370. * @param {Array.<string>} userPalete - 颜色板。
  52371. */
  52372. customPalette(userPalete) {
  52373. this.palette = userPalete;
  52374. }
  52375. /**
  52376. * @function LevelRenderer.Tool.Color.prototype.resetPalette
  52377. * @description 复位默认色板。
  52378. */
  52379. resetPalette() {
  52380. this.palette = this._palette;
  52381. }
  52382. /**
  52383. * @function LevelRenderer.Tool.Color.prototype.getColor
  52384. * @description 获取色板颜色。
  52385. * @param {number} idx - 色板位置。
  52386. * @param {Array.<string>} userPalete - 色板。
  52387. * @returns {string} 颜色值。
  52388. */
  52389. getColor(idx, userPalete) {
  52390. idx = idx | 0;
  52391. userPalete = userPalete || this.palette;
  52392. return userPalete[idx % userPalete.length];
  52393. }
  52394. /**
  52395. * @function LevelRenderer.Tool.Color.prototype.customHighlight
  52396. * @description 自定义默认高亮颜色。
  52397. * @param {string} userHighlightColor - 自定义高亮色。
  52398. */
  52399. customHighlight(userHighlightColor) {
  52400. this.highlightColor = userHighlightColor;
  52401. }
  52402. /**
  52403. * @function LevelRenderer.Tool.Color.prototype.resetHighlight
  52404. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  52405. */
  52406. resetHighlight() {
  52407. this.highlightColor = this._highlightColor;
  52408. }
  52409. /**
  52410. * @function LevelRenderer.Tool.Color.prototype.getHighlightColor
  52411. * @description 获取默认高亮颜色
  52412. * @returns {string} 颜色值。
  52413. */
  52414. getHighlightColor() {
  52415. return this.highlightColor;
  52416. }
  52417. /**
  52418. * @function LevelRenderer.Tool.Color.prototype.getRadialGradient
  52419. * @description 径向渐变。
  52420. * @param {number} x0 - 渐变起点横坐标。
  52421. * @param {number} y0 - 渐变起点纵坐标。
  52422. * @param {number} r0 - 半径
  52423. * @param {number} x1 - 渐变终点横坐标。
  52424. * @param {number} y1 - 渐变终点纵坐标。
  52425. * @param {number} r1 - 半径
  52426. * @param {Array} colorList - 颜色列表。
  52427. * @returns {CanvasGradient} Cavans 渐变颜色。
  52428. */
  52429. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  52430. var util = this.util;
  52431. if (!this._ctx) {
  52432. this._ctx = util.getContext();
  52433. }
  52434. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  52435. for (var i = 0, l = colorList.length; i < l; i++) {
  52436. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  52437. }
  52438. gradient.__nonRecursion = true;
  52439. return gradient;
  52440. }
  52441. /**
  52442. * @function LevelRenderer.Tool.Color.prototype.getLinearGradient
  52443. * @description 线性渐变。
  52444. * @param {number} x0 - 渐变起点横坐标。
  52445. * @param {number} y0 - 渐变起点纵坐标。
  52446. * @param {number} x1 - 渐变终点横坐标。
  52447. * @param {number} y1 - 渐变终点纵坐标。
  52448. * @param {Array} colorList - 颜色列表。
  52449. * @returns {CanvasGradient} Cavans 渐变颜色。
  52450. */
  52451. getLinearGradient(x0, y0, x1, y1, colorList) {
  52452. var util = this.util;
  52453. if (!this._ctx) {
  52454. this._ctx = util.getContext();
  52455. }
  52456. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  52457. for (var i = 0, l = colorList.length; i < l; i++) {
  52458. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  52459. }
  52460. gradient.__nonRecursion = true;
  52461. return gradient;
  52462. }
  52463. /**
  52464. * @function LevelRenderer.Tool.Color.prototype.getStepColors
  52465. * @description 获取两种颜色之间渐变颜色数组。
  52466. * @param {Object} start - 起始颜色对象。
  52467. * @param {Object} end - 结束颜色对象。
  52468. * @param {number} step - 渐变级数。
  52469. * @returns {Array} 颜色数组。
  52470. */
  52471. getStepColors(start, end, step) {
  52472. start = this.toRGBA(start);
  52473. end = this.toRGBA(end);
  52474. start = this.getData(start);
  52475. end = this.getData(end);
  52476. var colors = [];
  52477. var stepR = (end[0] - start[0]) / step;
  52478. var stepG = (end[1] - start[1]) / step;
  52479. var stepB = (end[2] - start[2]) / step;
  52480. var stepA = (end[3] - start[3]) / step;
  52481. // 生成颜色集合
  52482. // fix by linfeng 颜色堆积
  52483. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  52484. colors[i] = this.toColor([
  52485. this.adjust(Math.floor(r), [0, 255]),
  52486. this.adjust(Math.floor(g), [0, 255]),
  52487. this.adjust(Math.floor(b), [0, 255]),
  52488. a.toFixed(4) - 0
  52489. ], 'rgba');
  52490. r += stepR;
  52491. g += stepG;
  52492. b += stepB;
  52493. a += stepA;
  52494. }
  52495. r = end[0];
  52496. g = end[1];
  52497. b = end[2];
  52498. a = end[3];
  52499. colors[i] = this.toColor([r, g, b, a], 'rgba');
  52500. return colors;
  52501. }
  52502. /**
  52503. * @function LevelRenderer.Tool.Color.prototype.getGradientColors
  52504. * @description 获取指定级数的渐变颜色数组。
  52505. * @param {Array.<string>} colors - 颜色数组。
  52506. * @param {number} [step=20] - 渐变级数。
  52507. * @returns {Array.<string>} 颜色数组。
  52508. */
  52509. getGradientColors(colors, step) {
  52510. var ret = [];
  52511. var len = colors.length;
  52512. if (step === undefined) {
  52513. step = 20;
  52514. }
  52515. if (len === 1) {
  52516. ret = this.getStepColors(colors[0], colors[0], step);
  52517. } else if (len > 1) {
  52518. for (var i = 0, n = len - 1; i < n; i++) {
  52519. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  52520. if (i < n - 1) {
  52521. steps.pop();
  52522. }
  52523. ret = ret.concat(steps);
  52524. }
  52525. }
  52526. return ret;
  52527. }
  52528. /**
  52529. * @function LevelRenderer.Tool.Color.prototype.toColor
  52530. * @description 颜色值数组转为指定格式颜色。
  52531. * @param {Array} data - 颜色值数组。
  52532. * @param {string} format - 格式,默认'rgb'
  52533. * @returns {string} 颜色。
  52534. */
  52535. toColor(data, format) {
  52536. format = format || 'rgb';
  52537. if (data && (data.length === 3 || data.length === 4)) {
  52538. data = this.map(data,
  52539. function (c) {
  52540. return c > 1 ? Math.ceil(c) : c;
  52541. }
  52542. );
  52543. if (format.indexOf('hex') > -1) {
  52544. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  52545. } else if (format.indexOf('hs') > -1) {
  52546. var sx = this.map(data.slice(1, 3),
  52547. function (c) {
  52548. return c + '%';
  52549. }
  52550. );
  52551. data[1] = sx[0];
  52552. data[2] = sx[1];
  52553. }
  52554. if (format.indexOf('a') > -1) {
  52555. if (data.length === 3) {
  52556. data.push(1);
  52557. }
  52558. data[3] = this.adjust(data[3], [0, 1]);
  52559. return format + '(' + data.slice(0, 4).join(',') + ')';
  52560. }
  52561. return format + '(' + data.slice(0, 3).join(',') + ')';
  52562. }
  52563. }
  52564. /**
  52565. * @function LevelRenderer.Tool.Color.prototype.toArray
  52566. * @description 颜色字符串转换为rgba数组。
  52567. * @param {string} color - 颜色。
  52568. * @returns {Array.<number>} 颜色值数组。
  52569. */
  52570. toArray(color) {
  52571. color = this.trim(color);
  52572. if (color.indexOf('rgba') < 0) {
  52573. color = this.toRGBA(color);
  52574. }
  52575. var data = [];
  52576. var i = 0;
  52577. color.replace(/[\d.]+/g, function (n) {
  52578. if (i < 3) {
  52579. n = n | 0;
  52580. } else {
  52581. // Alpha
  52582. n = +n;
  52583. }
  52584. data[i++] = n;
  52585. });
  52586. return data;
  52587. }
  52588. /**
  52589. * @function LevelRenderer.Tool.Color.prototype.convert
  52590. * @description 颜色格式转化。
  52591. * @param {Array} data - 颜色值数组。
  52592. * @param {string} format - 格式,默认'rgb'
  52593. * @returns {string} 颜色。
  52594. */
  52595. convert(color, format) {
  52596. if (!this.isCalculableColor(color)) {
  52597. return color;
  52598. }
  52599. var data = this.getData(color);
  52600. var alpha = data[3];
  52601. if (typeof alpha === 'undefined') {
  52602. alpha = 1;
  52603. }
  52604. if (color.indexOf('hsb') > -1) {
  52605. data = this._HSV_2_RGB(data);
  52606. } else if (color.indexOf('hsl') > -1) {
  52607. data = this._HSL_2_RGB(data);
  52608. }
  52609. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  52610. data = this._RGB_2_HSB(data);
  52611. } else if (format.indexOf('hsl') > -1) {
  52612. data = this._RGB_2_HSL(data);
  52613. }
  52614. data[3] = alpha;
  52615. return this.toColor(data, format);
  52616. }
  52617. /**
  52618. * @function LevelRenderer.Tool.Color.prototype.toRGBA
  52619. * @description 转换为rgba格式的颜色。
  52620. * @param {string} color - 颜色。
  52621. * @returns {string} 颜色。
  52622. */
  52623. toRGBA(color) {
  52624. return this.convert(color, 'rgba');
  52625. }
  52626. /**
  52627. * @function LevelRenderer.Tool.Color.prototype.toRGB
  52628. * @description 转换为rgb数字格式的颜色。
  52629. * @param {string} color - 颜色。
  52630. * @returns {string} 颜色。
  52631. */
  52632. toRGB(color) {
  52633. return this.convert(color, 'rgb');
  52634. }
  52635. /**
  52636. * @function LevelRenderer.Tool.Color.prototype.toHex
  52637. * @description 转换为16进制颜色。
  52638. * @param {string} color - 颜色。
  52639. * @returns {string} 16进制颜色,#rrggbb格式
  52640. */
  52641. toHex(color) {
  52642. return this.convert(color, 'hex');
  52643. }
  52644. /**
  52645. * @function LevelRenderer.Tool.Color.prototype.toHSVA
  52646. * @description 转换为HSV颜色。
  52647. * @param {string} color - 颜色。
  52648. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  52649. */
  52650. toHSVA(color) {
  52651. return this.convert(color, 'hsva');
  52652. }
  52653. /**
  52654. * @function LevelRenderer.Tool.Color.prototype.toHSV
  52655. * @description 转换为HSV颜色。
  52656. * @param {string} color - 颜色。
  52657. * @returns {string} HSV颜色,hsv(h,s,v)
  52658. */
  52659. toHSV(color) {
  52660. return this.convert(color, 'hsv');
  52661. }
  52662. /**
  52663. * @function LevelRenderer.Tool.Color.prototype.toHSBA
  52664. * @description 转换为HSBA颜色。
  52665. * @param {string} color - 颜色。
  52666. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  52667. */
  52668. toHSBA(color) {
  52669. return this.convert(color, 'hsba');
  52670. }
  52671. /**
  52672. * @function LevelRenderer.Tool.Color.prototype.toHSB
  52673. * @description 转换为HSB颜色。
  52674. * @param {string} color - 颜色。
  52675. * @returns {string} HSB颜色,hsb(h,s,b)
  52676. */
  52677. toHSB(color) {
  52678. return this.convert(color, 'hsb');
  52679. }
  52680. /**
  52681. * @function LevelRenderer.Tool.Color.prototype.toHSLA
  52682. * @description 转换为HSLA颜色。
  52683. * @param {string} color - 颜色。
  52684. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  52685. */
  52686. toHSLA(color) {
  52687. return this.convert(color, 'hsla');
  52688. }
  52689. /**
  52690. * @function LevelRenderer.Tool.Color.prototype.toHSL
  52691. * @description 转换为HSL颜色。
  52692. * @param {string} color - 颜色。
  52693. * @returns {string} HSL颜色,hsl(h,s,l)
  52694. */
  52695. toHSL(color) {
  52696. return this.convert(color, 'hsl');
  52697. }
  52698. /**
  52699. * @function LevelRenderer.Tool.Color.prototype.toName
  52700. * @description 转换颜色名。
  52701. * @param {string} color - 颜色。
  52702. * @returns {string} 颜色名
  52703. */
  52704. toName(color) {
  52705. for (var key in this._nameColors) {
  52706. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  52707. return key;
  52708. }
  52709. }
  52710. return null;
  52711. }
  52712. /**
  52713. * @function LevelRenderer.Tool.Color.prototype.trim
  52714. * @description 移除颜色中多余空格。
  52715. * @param {string} color - 颜色。
  52716. * @returns {string} 无空格颜色
  52717. */
  52718. trim(color) {
  52719. return String(color).replace(/\s+/g, '');
  52720. }
  52721. /**
  52722. * @function LevelRenderer.Tool.Color.prototype.normalize
  52723. * @description 颜色规范化。
  52724. * @param {string} color - 颜色。
  52725. * @returns {string} 规范化后的颜色
  52726. */
  52727. normalize(color) {
  52728. // 颜色名
  52729. if (this._nameColors[color]) {
  52730. color = this._nameColors[color];
  52731. }
  52732. // 去掉空格
  52733. color = this.trim(color);
  52734. // hsv与hsb等价
  52735. color = color.replace(/hsv/i, 'hsb');
  52736. // rgb转为rrggbb
  52737. if (/^#[\da-f]{3}$/i.test(color)) {
  52738. color = parseInt(color.slice(1), 16);
  52739. var r = (color & 0xf00) << 8;
  52740. var g = (color & 0xf0) << 4;
  52741. var b = color & 0xf;
  52742. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  52743. }
  52744. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  52745. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  52746. return color;
  52747. }
  52748. /**
  52749. * @function LevelRenderer.Tool.Color.prototype.lift
  52750. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  52751. * @param {string} color - 颜色。
  52752. * @param {number} level - 升降程度,取值区间[-1,1]。
  52753. * @returns {string} 加深或减淡后颜色值
  52754. */
  52755. lift(color, level) {
  52756. if (!this.isCalculableColor(color)) {
  52757. return color;
  52758. }
  52759. var direct = level > 0 ? 1 : -1;
  52760. if (typeof level === 'undefined') {
  52761. level = 0;
  52762. }
  52763. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  52764. color = this.toRGB(color);
  52765. var data = this.getData(color);
  52766. for (var i = 0; i < 3; i++) {
  52767. if (direct === 1) {
  52768. data[i] = data[i] * (1 - level) | 0;
  52769. } else {
  52770. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  52771. }
  52772. }
  52773. return 'rgb(' + data.join(',') + ')';
  52774. }
  52775. /**
  52776. * @function LevelRenderer.Tool.Color.prototype.reverse
  52777. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  52778. * @param {string} color - 颜色。
  52779. * @returns {string} 翻转颜色
  52780. */
  52781. reverse(color) {
  52782. if (!this.isCalculableColor(color)) {
  52783. return color;
  52784. }
  52785. var data = this.getData(this.toRGBA(color));
  52786. data = this.map(data,
  52787. function (c) {
  52788. return 255 - c;
  52789. }
  52790. );
  52791. return this.toColor(data, 'rgb');
  52792. }
  52793. /**
  52794. * @function LevelRenderer.Tool.Color.prototype.mix
  52795. * @description 简单两种颜色混合
  52796. * @param {string} color1 - 第一种颜色。
  52797. * @param {string} color2 - 第二种颜色。
  52798. * @param {number} weight - 混合权重[0-1]。
  52799. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  52800. */
  52801. mix(color1, color2, weight) {
  52802. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  52803. return color1;
  52804. }
  52805. if (typeof weight === 'undefined') {
  52806. weight = 0.5;
  52807. }
  52808. weight = 1 - this.adjust(weight, [0, 1]);
  52809. var w = weight * 2 - 1;
  52810. var data1 = this.getData(this.toRGBA(color1));
  52811. var data2 = this.getData(this.toRGBA(color2));
  52812. var d = data1[3] - data2[3];
  52813. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  52814. var weight2 = 1 - weight1;
  52815. var data = [];
  52816. for (var i = 0; i < 3; i++) {
  52817. data[i] = data1[i] * weight1 + data2[i] * weight2;
  52818. }
  52819. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  52820. alpha = Math.max(0, Math.min(1, alpha));
  52821. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  52822. return this.toColor(data, 'rgb');
  52823. }
  52824. data[3] = alpha;
  52825. return this.toColor(data, 'rgba');
  52826. }
  52827. /**
  52828. * @function LevelRenderer.Tool.Color.prototype.random
  52829. * @description 随机颜色
  52830. * @returns {string} 颜色值,#rrggbb格式
  52831. */
  52832. random() {
  52833. return '#' + Math.random().toString(16).slice(2, 8);
  52834. }
  52835. /**
  52836. * @function LevelRenderer.Tool.Color.prototype.getData
  52837. * @description 获取颜色值数组,返回值范围。
  52838. * RGB 范围[0-255]
  52839. * HSL/HSV/HSB 范围[0-1]
  52840. * A透明度范围[0-1]
  52841. * 支持格式:
  52842. * #rgb
  52843. * #rrggbb
  52844. * rgb(r,g,b)
  52845. * rgb(r%,g%,b%)
  52846. * rgba(r,g,b,a)
  52847. * hsb(h,s,b) // hsv与hsb等价
  52848. * hsb(h%,s%,b%)
  52849. * hsba(h,s,b,a)
  52850. * hsl(h,s,l)
  52851. * hsl(h%,s%,l%)
  52852. * hsla(h,s,l,a)
  52853. * @param {string} color - 颜色。
  52854. * @returns {Array.<number>} 颜色值数组或null
  52855. */
  52856. getData(color) {
  52857. color = this.normalize(color);
  52858. var r = color.match(this.colorRegExp);
  52859. if (r === null) {
  52860. throw new Error('The color format error'); // 颜色格式错误
  52861. }
  52862. var d;
  52863. var a;
  52864. var data = [];
  52865. var rgb;
  52866. if (r[2]) {
  52867. // #rrggbb
  52868. d = r[2].replace('#', '').split('');
  52869. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  52870. data = this.map(rgb,
  52871. function (c) {
  52872. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  52873. }
  52874. );
  52875. } else if (r[4]) {
  52876. // rgb rgba
  52877. var rgba = (r[4]).split(',');
  52878. a = rgba[3];
  52879. rgb = rgba.slice(0, 3);
  52880. data = this.map(
  52881. rgb,
  52882. function (c) {
  52883. c = Math.floor(
  52884. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  52885. );
  52886. return Color.prototype.adjust.call(this, c, [0, 255]);
  52887. }
  52888. );
  52889. if (typeof a !== 'undefined') {
  52890. data.push(this.adjust(parseFloat(a), [0, 1]));
  52891. }
  52892. } else if (r[5] || r[6]) {
  52893. // hsb hsba hsl hsla
  52894. var hsxa = (r[5] || r[6]).split(',');
  52895. var h = parseInt(hsxa[0], 0) / 360;
  52896. var s = hsxa[1];
  52897. var x = hsxa[2];
  52898. a = hsxa[3];
  52899. data = this.map([s, x],
  52900. function (c) {
  52901. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  52902. }
  52903. );
  52904. data.unshift(h);
  52905. if (typeof a !== 'undefined') {
  52906. data.push(this.adjust(parseFloat(a), [0, 1]));
  52907. }
  52908. }
  52909. return data;
  52910. }
  52911. /**
  52912. * @function LevelRenderer.Tool.Color.prototype.alpha
  52913. * @description 设置颜色透明度
  52914. * @param {string} color - 颜色。
  52915. * @param {number} a - 透明度,区间[0,1]。
  52916. * @returns {string} rgba颜色值
  52917. */
  52918. alpha(color, a) {
  52919. if (!this.isCalculableColor(color)) {
  52920. return color;
  52921. }
  52922. if (a === null) {
  52923. a = 1;
  52924. }
  52925. var data = this.getData(this.toRGBA(color));
  52926. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  52927. return this.toColor(data, 'rgba');
  52928. }
  52929. /**
  52930. * @function LevelRenderer.Tool.Color.prototype.map
  52931. * @description 数组映射
  52932. * @param {Array} array - 数组。
  52933. * @param {function} fun - 函数。
  52934. * @returns {string} 数组映射结果
  52935. */
  52936. map(array, fun) {
  52937. if (typeof fun !== 'function') {
  52938. throw new TypeError();
  52939. }
  52940. var len = array ? array.length : 0;
  52941. for (var i = 0; i < len; i++) {
  52942. array[i] = fun(array[i]);
  52943. }
  52944. return array;
  52945. }
  52946. /**
  52947. * @function LevelRenderer.Tool.Color.prototype.adjust
  52948. * @description 调整值区间
  52949. * @param {Array.<number>} value - 数组。
  52950. * @param {Array.<number>} region - 区间。
  52951. * @returns {number} 调整后的值
  52952. */
  52953. adjust(value, region) {
  52954. // < to <= & > to >=
  52955. // modify by linzhifeng 2014-05-25 because -0 == 0
  52956. if (value <= region[0]) {
  52957. value = region[0];
  52958. } else if (value >= region[1]) {
  52959. value = region[1];
  52960. }
  52961. return value;
  52962. }
  52963. /**
  52964. * @function LevelRenderer.Tool.Color.prototype.isCalculableColor
  52965. * @description 判断是否是可计算的颜色
  52966. * @param {string} color - 颜色。
  52967. * @returns {boolean} 是否是可计算的颜色
  52968. */
  52969. isCalculableColor(color) {
  52970. return color instanceof Array || typeof color === 'string';
  52971. }
  52972. /**
  52973. * @function LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  52974. */
  52975. _HSV_2_RGB(data) {
  52976. var H = data[0];
  52977. var S = data[1];
  52978. var V = data[2];
  52979. // HSV from 0 to 1
  52980. var R;
  52981. var G;
  52982. var B;
  52983. if (S === 0) {
  52984. R = V * 255;
  52985. G = V * 255;
  52986. B = V * 255;
  52987. } else {
  52988. var h = H * 6;
  52989. if (h === 6) {
  52990. h = 0;
  52991. }
  52992. var i = h | 0;
  52993. var v1 = V * (1 - S);
  52994. var v2 = V * (1 - S * (h - i));
  52995. var v3 = V * (1 - S * (1 - (h - i)));
  52996. var r = 0;
  52997. var g = 0;
  52998. var b = 0;
  52999. if (i === 0) {
  53000. r = V;
  53001. g = v3;
  53002. b = v1;
  53003. } else if (i === 1) {
  53004. r = v2;
  53005. g = V;
  53006. b = v1;
  53007. } else if (i === 2) {
  53008. r = v1;
  53009. g = V;
  53010. b = v3;
  53011. } else if (i === 3) {
  53012. r = v1;
  53013. g = v2;
  53014. b = V;
  53015. } else if (i === 4) {
  53016. r = v3;
  53017. g = v1;
  53018. b = V;
  53019. } else {
  53020. r = V;
  53021. g = v1;
  53022. b = v2;
  53023. }
  53024. // RGB results from 0 to 255
  53025. R = r * 255;
  53026. G = g * 255;
  53027. B = b * 255;
  53028. }
  53029. return [R, G, B];
  53030. }
  53031. /**
  53032. * @function LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  53033. */
  53034. _HSL_2_RGB(data) {
  53035. var H = data[0];
  53036. var S = data[1];
  53037. var L = data[2];
  53038. // HSL from 0 to 1
  53039. var R;
  53040. var G;
  53041. var B;
  53042. if (S === 0) {
  53043. R = L * 255;
  53044. G = L * 255;
  53045. B = L * 255;
  53046. } else {
  53047. var v2;
  53048. if (L < 0.5) {
  53049. v2 = L * (1 + S);
  53050. } else {
  53051. v2 = (L + S) - (S * L);
  53052. }
  53053. var v1 = 2 * L - v2;
  53054. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  53055. G = 255 * this._HUE_2_RGB(v1, v2, H);
  53056. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  53057. }
  53058. return [R, G, B];
  53059. }
  53060. /**
  53061. * @function LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  53062. */
  53063. _HUE_2_RGB(v1, v2, vH) {
  53064. if (vH < 0) {
  53065. vH += 1;
  53066. }
  53067. if (vH > 1) {
  53068. vH -= 1;
  53069. }
  53070. if ((6 * vH) < 1) {
  53071. return (v1 + (v2 - v1) * 6 * vH);
  53072. }
  53073. if ((2 * vH) < 1) {
  53074. return (v2);
  53075. }
  53076. if ((3 * vH) < 2) {
  53077. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  53078. }
  53079. return v1;
  53080. }
  53081. /**
  53082. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  53083. */
  53084. _RGB_2_HSB(data) {
  53085. // RGB from 0 to 255
  53086. var R = (data[0] / 255);
  53087. var G = (data[1] / 255);
  53088. var B = (data[2] / 255);
  53089. var vMin = Math.min(R, G, B); // Min. value of RGB
  53090. var vMax = Math.max(R, G, B); // Max. value of RGB
  53091. var delta = vMax - vMin; // Delta RGB value
  53092. var V = vMax;
  53093. var H;
  53094. var S;
  53095. // HSV results from 0 to 1
  53096. if (delta === 0) {
  53097. H = 0;
  53098. S = 0;
  53099. } else {
  53100. S = delta / vMax;
  53101. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  53102. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  53103. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  53104. if (R === vMax) {
  53105. H = deltaB - deltaG;
  53106. } else if (G === vMax) {
  53107. H = (1 / 3) + deltaR - deltaB;
  53108. } else if (B === vMax) {
  53109. H = (2 / 3) + deltaG - deltaR;
  53110. }
  53111. if (H < 0) {
  53112. H += 1;
  53113. }
  53114. if (H > 1) {
  53115. H -= 1;
  53116. }
  53117. }
  53118. H = H * 360;
  53119. S = S * 100;
  53120. V = V * 100;
  53121. return [H, S, V];
  53122. }
  53123. /**
  53124. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  53125. */
  53126. _RGB_2_HSL(data) {
  53127. // RGB from 0 to 255
  53128. var R = (data[0] / 255);
  53129. var G = (data[1] / 255);
  53130. var B = (data[2] / 255);
  53131. var vMin = Math.min(R, G, B); // Min. value of RGB
  53132. var vMax = Math.max(R, G, B); // Max. value of RGB
  53133. var delta = vMax - vMin; // Delta RGB value
  53134. var L = (vMax + vMin) / 2;
  53135. var H;
  53136. var S;
  53137. // HSL results from 0 to 1
  53138. if (delta === 0) {
  53139. H = 0;
  53140. S = 0;
  53141. } else {
  53142. if (L < 0.5) {
  53143. S = delta / (vMax + vMin);
  53144. } else {
  53145. S = delta / (2 - vMax - vMin);
  53146. }
  53147. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  53148. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  53149. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  53150. if (R === vMax) {
  53151. H = deltaB - deltaG;
  53152. } else if (G === vMax) {
  53153. H = (1 / 3) + deltaR - deltaB;
  53154. } else if (B === vMax) {
  53155. H = (2 / 3) + deltaG - deltaR;
  53156. }
  53157. if (H < 0) {
  53158. H += 1;
  53159. }
  53160. if (H > 1) {
  53161. H -= 1;
  53162. }
  53163. }
  53164. H = H * 360;
  53165. S = S * 100;
  53166. L = L * 100;
  53167. return [H, S, L];
  53168. }
  53169. }
  53170. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  53171. var ColorRender = new Color();
  53172. // let "http://www.qzu.zj.cn": "#bd10e0"
  53173. // "www.qzct.net": "#7ed321" = new LevelRenderer.Tool.Color();
  53174. /**
  53175. * @name ColorsPickerUtil
  53176. * @namespace
  53177. * @category BaseTypes Util
  53178. * @classdesc 色带选择器工具类。用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色。
  53179. * @usage
  53180. * ```
  53181. * // 浏览器
  53182. * <script type="text/javascript" src="{cdn}"></script>
  53183. * <script>
  53184. * const result = {namespace}.ColorsPickerUtil.createCanvas();
  53185. *
  53186. * // 弃用的写法
  53187. * const result = SuperMap.ColorsPickerUtil.createCanvas();
  53188. *
  53189. * </script>
  53190. *
  53191. * // ES6 Import
  53192. * import { ColorsPickerUtil } from '{npm}';
  53193. *
  53194. * const result = ColorsPickerUtil.createCanvas();
  53195. * ```
  53196. */
  53197. class ColorsPickerUtil {
  53198. /**
  53199. * @function ColorsPickerUtil.createCanvas
  53200. * @description 创建DOM canvas。
  53201. * @param {number} height - canvas 高度。
  53202. * @param {number} width - canvas 宽度。
  53203. */
  53204. static createCanvas (height, width){
  53205. var canvas = document.createElement("canvas");
  53206. canvas.height = height;
  53207. canvas.width = width;
  53208. return canvas.getContext("2d");
  53209. }
  53210. /**
  53211. * @function ColorsPickerUtil.getLinearGradient
  53212. * @description 线性渐变。
  53213. * @param {number} x0 - 渐变起点 x 坐标。
  53214. * @param {number} y0 - 渐变起点 y 坐标。
  53215. * @param {number} x1 - 渐变终点 x 坐标。
  53216. * @param {number} y1 - 渐变终点 y 坐标。
  53217. * @param {Array} colorList 颜色列表。
  53218. * @returns {CanvasGradient} Cavans 渐变颜色。
  53219. */
  53220. static getLinearGradient (x0, y0, x1, y1, colorList){
  53221. if (!this._ctx) {
  53222. this._ctx = this.getContext();
  53223. }
  53224. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  53225. var leng = colorList.length;
  53226. var add = 1/(leng -1);
  53227. var offset = 0;
  53228. for (var i = 0; i < leng; i++) {
  53229. gradient.addColorStop(offset, colorList[i]);
  53230. offset += add;
  53231. }
  53232. gradient.__nonRecursion = true;
  53233. return gradient;
  53234. }
  53235. /**
  53236. * @function ColorsPickerUtil.getContext
  53237. * @description 获取 Cavans 上下文。
  53238. * @returns {Object} Cavans 上下文。
  53239. */
  53240. static getContext () {
  53241. if (!this._ctx) {
  53242. this._ctx = document.createElement('canvas').getContext('2d');
  53243. }
  53244. return this._ctx;
  53245. }
  53246. /**
  53247. * @function ColorsPickerUtil.getStepColors
  53248. * @description 获取两种颜色之间渐变颜色数组。
  53249. * @param {string} start - 起始颜色。
  53250. * @param {string} end - 结束颜色。
  53251. * @param {number} step - 渐变级数。
  53252. * @returns {Array} 颜色数组。
  53253. */
  53254. static getStepColors (start, end, step){
  53255. start = ColorRender.toRGBA(start);
  53256. end = ColorRender.toRGBA(end);
  53257. start = ColorRender.getData(start);
  53258. end = ColorRender.getData(end);
  53259. var colors = [];
  53260. var stepR = (end[0] - start[0]) / step;
  53261. var stepG = (end[1] - start[1]) / step;
  53262. var stepB = (end[2] - start[2]) / step;
  53263. var stepA = (end[3] - start[3]) / step;
  53264. // 生成颜色集合
  53265. // fix by linfeng 颜色堆积
  53266. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  53267. colors[i] = ColorRender.toColor([
  53268. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  53269. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  53270. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  53271. a.toFixed(4) - 0
  53272. ],'hex');
  53273. r += stepR;
  53274. g += stepG;
  53275. b += stepB;
  53276. a += stepA;
  53277. }
  53278. r = end[0];
  53279. g = end[1];
  53280. b = end[2];
  53281. a = end[3];
  53282. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  53283. return colors;
  53284. }
  53285. /**
  53286. * @function ColorsPickerUtil.getGradientColors
  53287. * @description 获取指定级数的渐变颜色数组。
  53288. * @param {Array.<string>} colors - 颜色组。
  53289. * @param {number} total - 颜色总数。
  53290. * @param {string} themeType - 专题类型。
  53291. * @returns {Array.<string>} 颜色数组。
  53292. */
  53293. static getGradientColors (colors, total, themeType){
  53294. var ret = [], step;
  53295. var i, n, len = colors.length;
  53296. if (total === undefined) {
  53297. return;
  53298. }
  53299. if(len >= total){
  53300. if(themeType === 'RANGE'){
  53301. for(i = 0; i<total; i++){
  53302. ret.push(colors[i]);
  53303. }
  53304. }else {
  53305. //1/2前后取色
  53306. for(i = 0; i<total; i++){
  53307. let ii = Math.floor(i/2);
  53308. if(i%2 === 0){
  53309. ret.push(colors[ii]);
  53310. }else {
  53311. let index = colors.length -1 - ii;
  53312. ret.push(colors[index]);
  53313. }
  53314. }
  53315. }
  53316. } else {
  53317. step = Math.ceil(total/(len-1));
  53318. for (i = 0, n = len - 1; i < n; i++) {
  53319. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  53320. if (i < n - 1) {
  53321. steps.pop();
  53322. }
  53323. ret = ret.concat(steps);
  53324. }
  53325. //删除多余元素
  53326. var nouse = ret.length - total;
  53327. for(var j = 0, index = 0; j< nouse; j++){
  53328. ret.splice(index+2,1);
  53329. }
  53330. }
  53331. return ret;
  53332. }
  53333. }
  53334. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  53335. /**
  53336. * @name ArrayStatistic
  53337. * @namespace
  53338. * @category BaseTypes Util
  53339. * @classdesc 处理数组。
  53340. * @usage
  53341. * ```
  53342. * // 浏览器
  53343. * <script type="text/javascript" src="{cdn}"></script>
  53344. * <script>
  53345. * const result = {namespace}.ArrayStatistic.newInstance();
  53346. *
  53347. * // 弃用的写法
  53348. * const result = SuperMap.ArrayStatistic.newInstance();
  53349. *
  53350. * </script>
  53351. *
  53352. * // ES6 Import
  53353. * import { ArrayStatistic } from '{npm}';
  53354. *
  53355. * const result = ArrayStatistic.newInstance();
  53356. * ```
  53357. */
  53358. class ArrayStatistic {
  53359. // geostatsInstance: null,
  53360. /**
  53361. * @function ArrayStatistic.newInstance
  53362. * @description 初始化插件实例。
  53363. */
  53364. static newInstance() {
  53365. // if(!this.geostatsInstance) {
  53366. // // this.geostatsInstance = new geostats();
  53367. // // }
  53368. // window.dataList = [];
  53369. if(!this.geostatsInstance) {
  53370. this.geostatsInstance = new window.geostats();
  53371. }
  53372. return this.geostatsInstance;
  53373. }
  53374. /**
  53375. * @function ArrayStatistic.getInstance
  53376. * @description 设置需要被处理的数组。
  53377. * @param {Array} array - 数组。
  53378. */
  53379. static getInstance(array) {
  53380. let instance = this.newInstance();
  53381. instance.setSerie(array);
  53382. return instance;
  53383. }
  53384. /**
  53385. * @function ArrayStatistic.getArrayStatistic
  53386. * @description 获取数组统计的值。
  53387. * @param {Array.<number>} array - 需要统计的数组。
  53388. * @param {string} type - 统计方法。
  53389. */
  53390. static getArrayStatistic(array, type){
  53391. if(!array.length) {
  53392. return 0;
  53393. }
  53394. if(type === "Sum" || type === "求和"){
  53395. return this.getSum(array);
  53396. } else if(type === "Maximum" || type === "最大值"){
  53397. return this.getMax(array);
  53398. } else if(type === "Minimum" || type === "最小值"){
  53399. return this.getMin(array);
  53400. } else if(type === "Average" || type === "平均值"){
  53401. return this.getMean(array);
  53402. } else if(type === "Median" || type === "中位数"){
  53403. return this.getMedian(array);
  53404. } else if(type === "times" || type === "计数"){
  53405. return this.getTimes(array);
  53406. }
  53407. }
  53408. /**
  53409. * @function ArrayStatistic.getArraySegments
  53410. * @description 获取数组分段后的数值。
  53411. * @param {Array.<number>} array - 需要分段的数组。
  53412. * @param {string} type - 分段方法。
  53413. * @param {number} segNum - 分段个数。
  53414. */
  53415. static getArraySegments(array, type, segNum) {
  53416. if(type === "offset") {
  53417. return this.getEqInterval(array, segNum);
  53418. } else if(type === "jenks") {
  53419. return this.getJenks(array, segNum);
  53420. } else if(type === "square") {
  53421. // 数据都必须 >= 0
  53422. let minValue = this.getMin(array);
  53423. if(minValue >= 0){
  53424. return this.getSqrtInterval(array, segNum);
  53425. }else {
  53426. //console.log('数据都必须 >= 0');
  53427. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  53428. return false;
  53429. }
  53430. } else if(type === "logarithm") {
  53431. // 数据都必须 > 0
  53432. let minValue = this.getMin(array);
  53433. if(minValue > 0){
  53434. return this.getGeometricProgression(array, segNum);
  53435. }else {
  53436. //console.log('数据都必须 > 0');
  53437. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  53438. return false;
  53439. }
  53440. }
  53441. }
  53442. /**
  53443. * @function ArrayStatistic.getSum
  53444. * @description 求和。
  53445. * @param {Array.<number>} array 需要求和的参数。
  53446. * @returns {number} 返回求和结果。
  53447. */
  53448. static getSum(array){
  53449. return this.getInstance(array).sum();
  53450. }
  53451. /**
  53452. * @function ArrayStatistic.getMax
  53453. * @description 最大值。
  53454. * @param {Array.<number>} array 需要求最大值的参数。
  53455. * @returns {number} 返回最大值。
  53456. */
  53457. static getMax(array){
  53458. return this.getInstance(array).max();
  53459. }
  53460. /**
  53461. * @function ArrayStatistic.getMin
  53462. * @description 最小值。
  53463. * @param {Array.<number>} array 需要求最小值的参数。
  53464. * @returns {number} 返回最小值。
  53465. */
  53466. static getMin(array){
  53467. return this.getInstance(array).min();
  53468. }
  53469. /**
  53470. * @function ArrayStatistic.getMean
  53471. * @description 求平均数。
  53472. * @param {Array.<number>} array 需要求平均数的参数。
  53473. * @returns {number} 返回平均数。
  53474. */
  53475. static getMean(array){
  53476. return this.getInstance(array).mean();
  53477. }
  53478. /**
  53479. * @function ArrayStatistic.getMedian
  53480. * @description 求中位数。
  53481. * @param {Array.<number>} array 需要求中位数的参数。
  53482. * @returns {number} 返回中位数。
  53483. */
  53484. static getMedian(array) {
  53485. return this.getInstance(array).median();
  53486. }
  53487. /**
  53488. * @function ArrayStatistic.getTimes
  53489. * @description 计数。
  53490. * @param {Array.<number>} array 需要计数的参数。
  53491. * @returns {number} 返回计数结果。
  53492. */
  53493. static getTimes(array) {
  53494. return array.length;
  53495. }
  53496. /**
  53497. * @function ArrayStatistic.getEqInterval
  53498. * @description 等距分段法。
  53499. * @param {Array} array 需要进行等距分段的数组。
  53500. * @param {number} segNum 分段个数。
  53501. */
  53502. static getEqInterval(array, segNum) {
  53503. return this.getInstance(array).getClassEqInterval(segNum);
  53504. }
  53505. /**
  53506. * @function ArrayStatistic.getJenks
  53507. * @description 自然断裂法。
  53508. * @param {Array} array 需要进行自然断裂的参数。
  53509. * @param {number} segNum 分段个数。
  53510. */
  53511. static getJenks(array, segNum) {
  53512. return this.getInstance(array).getClassJenks(segNum);
  53513. }
  53514. /**
  53515. * @function ArrayStatistic.getSqrtInterval
  53516. * @description 平方根分段法。
  53517. * @param {Array} array 需要进行平方根分段的参数。
  53518. * @param {number} segNum 分段个数。
  53519. */
  53520. static getSqrtInterval(array, segNum) {
  53521. array = array.map(function(value) {
  53522. return Math.sqrt(value);
  53523. });
  53524. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  53525. return (
  53526. breaks.map(function(value) {
  53527. return value * value;
  53528. })
  53529. )
  53530. }
  53531. /**
  53532. * @function ArrayStatistic.getGeometricProgression
  53533. * @description 对数分段法。
  53534. * @param {Array} array 需要进行对数分段的参数。
  53535. * @param {number} segNum 分段个数。
  53536. */
  53537. static getGeometricProgression(array, segNum) {
  53538. return this.getInstance(array).getClassGeometricProgression(segNum);
  53539. }
  53540. }
  53541. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  53542. /**
  53543. * @function getMeterPerMapUnit
  53544. * @description 单位换算,把米|度|千米|英寸|英尺换成米。
  53545. * @category BaseTypes Util
  53546. * @param {string} mapUnit 地图单位。
  53547. * @returns {number} 返回地图的距离单位。
  53548. * @usage
  53549. * ```
  53550. * // 浏览器
  53551. * <script type="text/javascript" src="{cdn}"></script>
  53552. * <script>
  53553. * const result = {namespace}.getMeterPerMapUnit(mapUnit);
  53554. *
  53555. * </script>
  53556. *
  53557. * // ES6 Import
  53558. * import { getMeterPerMapUnit } from '{npm}';
  53559. *
  53560. * const result = getMeterPerMapUnit(mapUnit);
  53561. * ```
  53562. */
  53563. var getMeterPerMapUnit = function(mapUnit) {
  53564. var earchRadiusInMeters = 6378137;
  53565. var meterPerMapUnit;
  53566. if (mapUnit === Unit.METER) {
  53567. meterPerMapUnit = 1;
  53568. } else if (mapUnit === Unit.DEGREE) {
  53569. // 每度表示多少米。
  53570. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  53571. } else if (mapUnit === Unit.KILOMETER) {
  53572. meterPerMapUnit = 1.0e-3;
  53573. } else if (mapUnit === Unit.INCH) {
  53574. meterPerMapUnit = 1 / 2.5399999918e-2;
  53575. } else if (mapUnit === Unit.FOOT) {
  53576. meterPerMapUnit = 0.3048;
  53577. } else {
  53578. return meterPerMapUnit;
  53579. }
  53580. return meterPerMapUnit;
  53581. };
  53582. /**
  53583. * @function getWrapNum
  53584. * @description 获取该坐标系的经纬度范围的经度或纬度。
  53585. * @category BaseTypes Util
  53586. * @param {number} x 经度或纬度。
  53587. * @param {boolean} includeMax 是否获取经度或纬度的最大值。
  53588. * @param {boolean} includeMin 是否获取经度或纬度的最小值。
  53589. * @param {number} range 坐标系的经纬度范围。
  53590. * @returns {number} 返回经度或纬度的值。
  53591. * @usage
  53592. * ```
  53593. * // 浏览器
  53594. * <script type="text/javascript" src="{cdn}"></script>
  53595. * <script>
  53596. * const result = {namespace}.getWrapNum(x, includeMax, includeMin, range);
  53597. *
  53598. * </script>
  53599. *
  53600. * // ES6 Import
  53601. * import { getWrapNum } from '{npm}';
  53602. *
  53603. * const result = getWrapNum(x, includeMax, includeMin, range);
  53604. * ```
  53605. */
  53606. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  53607. var max = range[1],
  53608. min = range[0],
  53609. d = max - min;
  53610. if (x === max && includeMax) {
  53611. return x;
  53612. }
  53613. if (x === min && includeMin) {
  53614. return x;
  53615. }
  53616. var tmp = (((x - min) % d) + d) % d;
  53617. if (tmp === 0 && includeMax) {
  53618. return max;
  53619. }
  53620. return ((((x - min) % d) + d) % d) + min;
  53621. }
  53622. /**
  53623. * @function conversionDegree
  53624. * @description 转换经纬度。
  53625. * @category BaseTypes Util
  53626. * @param {number} degrees 经度或纬度。
  53627. * @returns {string} 返回度分秒。
  53628. * @usage
  53629. * ```
  53630. * // 浏览器
  53631. * <script type="text/javascript" src="{cdn}"></script>
  53632. * <script>
  53633. * const result = {namespace}.conversionDegree(degrees);
  53634. *
  53635. * </script>
  53636. *
  53637. * // ES6 Import
  53638. * import { conversionDegree } from '{npm}';
  53639. *
  53640. * const result = conversionDegree(degrees);
  53641. * ```
  53642. */
  53643. function conversionDegree(degrees) {
  53644. const degree = parseInt(degrees);
  53645. let fraction = parseInt((degrees - degree) * 60);
  53646. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  53647. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  53648. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  53649. return `${degree}°${fraction}'${second}`;
  53650. }
  53651. /**
  53652. * @function scalesToResolutions
  53653. * @description 通过比例尺数组计算分辨率数组,没有传入比例尺数组时通过地图范围与地图最大级别进行计算。
  53654. * @version 11.0.1
  53655. * @param {Array} scales - 比例尺数组。
  53656. * @param {Object} bounds - 地图范围。
  53657. * @param {number} dpi - 屏幕分辨率。
  53658. * @param {string} mapUnit - 地图单位。
  53659. * @param {number} [level=22] - 地图最大级别。
  53660. * @returns {number} 分辨率。
  53661. * @usage
  53662. * ```
  53663. * // 浏览器
  53664. * <script type="text/javascript" src="{cdn}"></script>
  53665. * <script>
  53666. * const result = {namespace}.scalesToResolutions(scales, bounds, dpi, mapUnit);
  53667. *
  53668. * </script>
  53669. *
  53670. * // ES6 Import
  53671. * import { scalesToResolutions } from '{npm}';
  53672. *
  53673. * const result = scalesToResolutions(scales, bounds, dpi, mapUnit);
  53674. * ```
  53675. */
  53676. function scalesToResolutions(scales, bounds, dpi, mapUnit, level = 22) {
  53677. var resolutions = [];
  53678. if (scales && scales.length > 0) {
  53679. for (let i = 0; i < scales.length; i++) {
  53680. resolutions.push(scaleToResolution(scales[i], dpi, mapUnit));
  53681. }
  53682. } else {
  53683. const maxReolution = Math.abs(bounds.left - bounds.right) / 256;
  53684. for (let i = 0; i < level; i++) {
  53685. resolutions.push(maxReolution / Math.pow(2, i));
  53686. }
  53687. }
  53688. return resolutions.sort(function (a, b) {
  53689. return b - a;
  53690. });
  53691. }
  53692. /**
  53693. * @function getZoomByResolution
  53694. * @description 通过分辨率获取地图级别。
  53695. * @version 11.0.1
  53696. * @param {number} resolution - 分辨率。
  53697. * @param {Array} resolutions - 分辨率数组。
  53698. * @returns {number} 地图级别。
  53699. * @usage
  53700. * ```
  53701. * // 浏览器
  53702. * <script type="text/javascript" src="{cdn}"></script>
  53703. * <script>
  53704. * const result = {namespace}.getZoomByResolution(resolution, resolutions);
  53705. *
  53706. * </script>
  53707. *
  53708. * // ES6 Import
  53709. * import { getZoomByResolution } from '{npm}';
  53710. *
  53711. * const result = getZoomByResolution(resolution, resolutions);
  53712. * ```
  53713. */
  53714. function getZoomByResolution(resolution, resolutions) {
  53715. let zoom = 0;
  53716. let minDistance;
  53717. for (let i = 0; i < resolutions.length; i++) {
  53718. if (i === 0) {
  53719. minDistance = Math.abs(resolution - resolutions[i]);
  53720. }
  53721. if (minDistance > Math.abs(resolution - resolutions[i])) {
  53722. minDistance = Math.abs(resolution - resolutions[i]);
  53723. zoom = i;
  53724. }
  53725. }
  53726. return zoom;
  53727. }
  53728. /**
  53729. * @function scaleToResolution
  53730. * @description 通过比例尺计算分辨率。
  53731. * @version 11.0.1
  53732. * @param {number} scale - 比例尺。
  53733. * @param {number} dpi - 屏幕分辨率。
  53734. * @param {string} mapUnit - 地图单位。
  53735. * @returns {number} 分辨率。
  53736. * @usage
  53737. * ```
  53738. * // 浏览器
  53739. * <script type="text/javascript" src="{cdn}"></script>
  53740. * <script>
  53741. * const result = {namespace}.scaleToResolution(scale, dpi, mapUnit);
  53742. *
  53743. * </script>
  53744. *
  53745. * // ES6 Import
  53746. * import { scaleToResolution } from '{npm}';
  53747. *
  53748. * const result = scaleToResolution(scale, dpi, mapUnit);
  53749. * ```
  53750. */
  53751. function scaleToResolution(scale, dpi, mapUnit) {
  53752. const inchPerMeter = 1 / 0.0254;
  53753. const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
  53754. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  53755. return resolution;
  53756. }
  53757. /**
  53758. * 范围是否相交
  53759. * @param {Array} extent1 范围1
  53760. * @param {Array} extent2 范围2
  53761. * @return {boolean} 范围是否相交。
  53762. */
  53763. function intersects(extent1, extent2) {
  53764. return (
  53765. extent1[0] <= extent2[2] &&
  53766. extent1[2] >= extent2[0] &&
  53767. extent1[1] <= extent2[3] &&
  53768. extent1[3] >= extent2[1]
  53769. );
  53770. }
  53771. /**
  53772. * 获取两个范围的交集
  53773. * @param {Array} extent1 Extent 1
  53774. * @param {Array} extent2 Extent 2
  53775. * @return {Array} 相交范围数组.
  53776. * @api
  53777. */
  53778. function getIntersection(extent1, extent2) {
  53779. const intersection = [];
  53780. if (intersects(extent1, extent2)) {
  53781. if (extent1[0] > extent2[0]) {
  53782. intersection[0] = extent1[0];
  53783. } else {
  53784. intersection[0] = extent2[0];
  53785. }
  53786. if (extent1[1] > extent2[1]) {
  53787. intersection[1] = extent1[1];
  53788. } else {
  53789. intersection[1] = extent2[1];
  53790. }
  53791. if (extent1[2] < extent2[2]) {
  53792. intersection[2] = extent1[2];
  53793. } else {
  53794. intersection[2] = extent2[2];
  53795. }
  53796. if (extent1[3] < extent2[3]) {
  53797. intersection[3] = extent1[3];
  53798. } else {
  53799. intersection[3] = extent2[3];
  53800. }
  53801. }
  53802. return intersection;
  53803. }
  53804. ;// CONCATENATED MODULE: ./src/common/util/index.js
  53805. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53806. * This program are made available under the terms of the Apache License, Version 2.0
  53807. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53808. function toSuperMapGeometry(geoJSON) {
  53809. if (geoJSON && geoJSON.type) {
  53810. var format = new GeoJSONFormat();
  53811. var result = format.read(geoJSON, "FeatureCollection");
  53812. return result[0].geometry;
  53813. }
  53814. }
  53815. function toSuperMapPolygon(lnglatBounds) {
  53816. const west = lnglatBounds.getWest();
  53817. const east = lnglatBounds.getEast();
  53818. const sourth = lnglatBounds.getSouth();
  53819. const north = lnglatBounds.getNorth();
  53820. return new Polygon([
  53821. new LinearRing([
  53822. new GeometryPoint(west, sourth),
  53823. new GeometryPoint(east, sourth),
  53824. new GeometryPoint(east, north),
  53825. new GeometryPoint(west, north)
  53826. ])
  53827. ]);
  53828. }
  53829. /**
  53830. * @function Util.extend
  53831. * @description 对象拷贝赋值。
  53832. * @param {Object} dest - 目标对象。
  53833. * @param {Object} arguments - 待拷贝的对象。
  53834. * @returns {Object} 赋值后的目标对象。
  53835. */
  53836. function extend(dest) {
  53837. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  53838. var arg = Object.getOwnPropertyNames(arguments)[index];
  53839. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  53840. continue;
  53841. }
  53842. var obj = arguments[arg];
  53843. if (obj) {
  53844. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  53845. var key = Object.getOwnPropertyNames(obj)[j];
  53846. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  53847. continue;
  53848. }
  53849. dest[key] = obj[key];
  53850. }
  53851. }
  53852. }
  53853. return dest;
  53854. }
  53855. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  53856. var lodash_topairs = __webpack_require__(52);
  53857. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  53858. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  53859. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53860. * This program are made available under the terms of the Apache License, Version 2.0
  53861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53862. /**
  53863. * @class CartoCSS
  53864. * @deprecatedclass SuperMap.CartoCSS
  53865. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  53866. * @category BaseTypes Style
  53867. * @param {string} cartoStr - 样式表字符串。
  53868. * @example
  53869. * var cartocss = "@provinceLineColor:#ddd;
  53870. * #China_Provinces_L___China400{
  53871. * line-dasharray:10,10;
  53872. * line-color:@provinceLineColor;
  53873. * line-width:1;
  53874. * }";
  53875. * new CartoCSS(cartocss);
  53876. * @usage
  53877. */
  53878. /*eslint no-useless-escape: "off"*/
  53879. class CartoCSS {
  53880. constructor(cartoStr) {
  53881. this.env = null;
  53882. /**
  53883. * @member CartoCSS.prototype.parser
  53884. * @description 解析器。
  53885. */
  53886. this.parser = null;
  53887. /**
  53888. * @member CartoCSS.prototype.ruleSet
  53889. * @description CartoCSS 规则对象。
  53890. */
  53891. this.ruleSet = null;
  53892. /**
  53893. * @member CartoCSS.prototype.cartoStr
  53894. * @description CartoCSS 样式表字符串。
  53895. */
  53896. this.cartoStr = "";
  53897. /**
  53898. * @member CartoCSS.prototype.shaders
  53899. * @description Carto 着色器集。
  53900. */
  53901. this.shaders = null;
  53902. if (typeof cartoStr === "string") {
  53903. this.cartoStr = cartoStr;
  53904. this.env = {
  53905. frames: [],
  53906. errors: [],
  53907. error: function (obj) {
  53908. this.errors.push(obj);
  53909. }
  53910. };
  53911. this.parser = this.getParser(this.env);
  53912. this.parse(cartoStr);
  53913. this.shaders = this.toShaders();
  53914. }
  53915. }
  53916. /**
  53917. * @function CartoCSS.prototype.getParser
  53918. * @description 获取 CartoCSS 解析器。
  53919. */
  53920. getParser(env) {
  53921. var input, // LeSS input string
  53922. i, // current index in `input`
  53923. j, // current chunk
  53924. temp, // temporarily holds a chunk's state, for backtracking
  53925. memo, // temporarily holds `i`, when backtracking
  53926. furthest, // furthest index the parser has gone to
  53927. chunks, // chunkified input
  53928. current, // index of current chunk, in `input`
  53929. parser;
  53930. var that = this;
  53931. // This function is called after all files
  53932. // have been imported through `@import`.
  53933. var finish = function () {//NOSONAR
  53934. //所有文件导入完成之后调用
  53935. };
  53936. function save() {
  53937. temp = chunks[j];
  53938. memo = i;
  53939. current = i;
  53940. }
  53941. function restore() {
  53942. chunks[j] = temp;
  53943. i = memo;
  53944. current = i;
  53945. }
  53946. function sync() {
  53947. if (i > current) {
  53948. chunks[j] = chunks[j].slice(i - current);
  53949. current = i;
  53950. }
  53951. }
  53952. //
  53953. // Parse from a token, regexp or string, and move forward if match
  53954. //
  53955. function _match(tok) {
  53956. var match, length, c, endIndex;
  53957. // Non-terminal
  53958. if (tok instanceof Function) {
  53959. return tok.call(parser.parsers);
  53960. // Terminal
  53961. // Either match a single character in the input,
  53962. // or match a regexp in the current chunk (chunk[j]).
  53963. } else if (typeof(tok) === 'string') {
  53964. match = input.charAt(i) === tok ? tok : null;
  53965. length = 1;
  53966. sync();
  53967. } else {
  53968. sync();
  53969. match = tok.exec(chunks[j]);
  53970. if (match) {
  53971. length = match[0].length;
  53972. } else {
  53973. return null;
  53974. }
  53975. }
  53976. // The match is confirmed, add the match length to `i`,
  53977. // and consume any extra white-space characters (' ' || '\n')
  53978. // which come after that. The reason for this is that LeSS's
  53979. // grammar is mostly white-space insensitive.
  53980. if (match) {
  53981. var mem = i += length;
  53982. endIndex = i + chunks[j].length - length;
  53983. while (i < endIndex) {
  53984. c = input.charCodeAt(i);
  53985. if (!(c === 32 || c === 10 || c === 9)) {
  53986. break;
  53987. }
  53988. i++;
  53989. }
  53990. chunks[j] = chunks[j].slice(length + (i - mem));
  53991. current = i;
  53992. if (chunks[j].length === 0 && j < chunks.length - 1) {
  53993. j++;
  53994. }
  53995. if (typeof(match) === 'string') {
  53996. return match;
  53997. } else {
  53998. return match.length === 1 ? match[0] : match;
  53999. }
  54000. }
  54001. }
  54002. // Same as _match(), but don't change the state of the parser,
  54003. // just return the match.
  54004. function peek(tok) {
  54005. if (typeof(tok) === 'string') {
  54006. return input.charAt(i) === tok;
  54007. } else {
  54008. return !!tok.test(chunks[j]);
  54009. }
  54010. }
  54011. // Make an error object from a passed set of properties.
  54012. // Accepted properties:
  54013. // - `message`: Text of the error message.
  54014. // - `filename`: Filename where the error occurred.
  54015. // - `index`: Char. index where the error occurred.
  54016. function makeError(err) {
  54017. var einput;
  54018. var defautls = {
  54019. index: furthest,
  54020. filename: env.filename,
  54021. message: 'Parse error.',
  54022. line: 0,
  54023. column: -1
  54024. };
  54025. for (var prop in defautls) {
  54026. if (err[prop] === 0) {
  54027. err[prop] = defautls[prop];
  54028. }
  54029. }
  54030. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  54031. einput = that.env.inputs[err.filename];
  54032. } else {
  54033. einput = input;
  54034. }
  54035. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  54036. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  54037. err.column++;
  54038. }
  54039. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  54040. }
  54041. this.env = env = env || {};
  54042. this.env.filename = this.env.filename || null;
  54043. this.env.inputs = this.env.inputs || {};
  54044. // The Parser
  54045. parser = {
  54046. // Parse an input string into an abstract syntax tree.
  54047. // Throws an error on parse errors.
  54048. parse: function (str) {
  54049. var root, error = null;
  54050. i = j = current = furthest = 0;
  54051. chunks = [];
  54052. input = str.replace(/\r\n/g, '\n');
  54053. if (env.filename) {
  54054. that.env.inputs[env.filename] = input;
  54055. }
  54056. // Split the input into chunks.
  54057. chunks = (function (chunks) {
  54058. var j = 0,
  54059. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  54060. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  54061. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  54062. level = 0,
  54063. match,
  54064. chunk = chunks[0],
  54065. inParam;
  54066. for (var i = 0, c, cc; i < input.length;) {
  54067. skip.lastIndex = i;
  54068. if (match = skip.exec(input)) {
  54069. if (match.index === i) {
  54070. i += match[0].length;
  54071. chunk.push(match[0]);
  54072. }
  54073. }
  54074. c = input.charAt(i);
  54075. comment.lastIndex = string.lastIndex = i;
  54076. if (match = string.exec(input)) {
  54077. if (match.index === i) {
  54078. i += match[0].length;
  54079. chunk.push(match[0]);
  54080. continue;
  54081. }
  54082. }
  54083. if (!inParam && c === '/') {
  54084. cc = input.charAt(i + 1);
  54085. if (cc === '/' || cc === '*') {
  54086. if (match = comment.exec(input)) {
  54087. if (match.index === i) {
  54088. i += match[0].length;
  54089. chunk.push(match[0]);
  54090. continue;
  54091. }
  54092. }
  54093. }
  54094. }
  54095. switch (c) {
  54096. case '{'://NOSONAR
  54097. if (!inParam) {
  54098. level++;
  54099. chunk.push(c);
  54100. break;
  54101. }
  54102. case '}'://NOSONAR
  54103. if (!inParam) {
  54104. level--;
  54105. chunk.push(c);
  54106. chunks[++j] = chunk = [];
  54107. break;
  54108. }
  54109. case '('://NOSONAR
  54110. if (!inParam) {
  54111. inParam = true;
  54112. chunk.push(c);
  54113. break;
  54114. }
  54115. case ')'://NOSONAR
  54116. if (inParam) {
  54117. inParam = false;
  54118. chunk.push(c);
  54119. break;
  54120. }
  54121. default:
  54122. chunk.push(c);
  54123. break;
  54124. }
  54125. i++;
  54126. }
  54127. if (level !== 0) {
  54128. error = {
  54129. index: i - 1,
  54130. type: 'Parse',
  54131. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  54132. };
  54133. }
  54134. return chunks.map(function (c) {
  54135. return c.join('');
  54136. });
  54137. })([[]]);
  54138. if (error) {
  54139. throw makeError(error);
  54140. }
  54141. // Sort rules by specificity: this function expects selectors to be
  54142. // split already.
  54143. //
  54144. // Written to be used as a .sort(Function);
  54145. // argument.
  54146. //
  54147. // [1, 0, 0, 467] > [0, 0, 1, 520]
  54148. var specificitySort = function (a, b) {
  54149. var as = a.specificity;
  54150. var bs = b.specificity;
  54151. if (as[0] != bs[0]) {return bs[0] - as[0];}
  54152. if (as[1] != bs[1]) {return bs[1] - as[1];}
  54153. if (as[2] != bs[2]) {return bs[2] - as[2];}
  54154. return bs[3] - as[3];
  54155. };
  54156. // Start with the primary rule.
  54157. // The whole syntax tree is held under a Ruleset node,
  54158. // with the `root` property set to true, so no `{}` are
  54159. // output.
  54160. root = new CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  54161. root.root = true;
  54162. // Get an array of Ruleset objects, flattened
  54163. // and sorted according to specificitySort
  54164. root.toList = (function () {
  54165. return function (env) {
  54166. env.error = function (e) {
  54167. if (!env.errors) {env.errors = new Error('');}
  54168. if (env.errors.message) {
  54169. env.errors.message += '\n' + makeError(e).message;
  54170. } else {
  54171. env.errors.message = makeError(e).message;
  54172. }
  54173. };
  54174. env.frames = env.frames || [];
  54175. // call populates Invalid-caused errors
  54176. var definitions = this.flatten([], [], env);
  54177. definitions.sort(specificitySort);
  54178. return definitions;
  54179. };
  54180. })();
  54181. return root;
  54182. },
  54183. // Here in, the parsing rules/functions
  54184. //
  54185. // The basic structure of the syntax tree generated is as follows:
  54186. //
  54187. // Ruleset -> Rule -> Value -> Expression -> Entity
  54188. //
  54189. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  54190. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  54191. // first, before parsing, that's when we use `peek()`.
  54192. parsers: {
  54193. // The `primary` rule is the *entry* and *exit* point of the parser.
  54194. // The rules here can appear at any level of the parse tree.
  54195. //
  54196. // The recursive nature of the grammar is an interplay between the `block`
  54197. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  54198. // as represented by this simplified grammar:
  54199. //
  54200. // primary → (ruleset | rule)+
  54201. // ruleset → selector+ block
  54202. // block → '{' primary '}'
  54203. //
  54204. // Only at one point is the primary rule not called from the
  54205. // block rule: at the root level.
  54206. primary: function () {
  54207. var node, root = [];
  54208. while ((node = _match(this.rule) || _match(this.ruleset) ||
  54209. _match(this.comment)) ||
  54210. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  54211. if (node) {root.push(node);}
  54212. }
  54213. return root;
  54214. },
  54215. invalid: function () {
  54216. var chunk = _match(/^[^;\n]*[;\n]/);
  54217. // To fail gracefully, match everything until a semicolon or linebreak.
  54218. if (chunk) {
  54219. return new CartoCSS.Tree.Invalid(chunk, memo);
  54220. }
  54221. },
  54222. // We create a Comment node for CSS comments `/* */`,
  54223. // but keep the LeSS comments `//` silent, by just skipping
  54224. // over them.
  54225. comment: function () {
  54226. var comment;
  54227. if (input.charAt(i) !== '/') {return;}
  54228. if (input.charAt(i + 1) === '/') {
  54229. return new CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  54230. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  54231. return new CartoCSS.Tree.Comment(comment);
  54232. }
  54233. },
  54234. // Entities are tokens which can be found inside an Expression
  54235. entities: {
  54236. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  54237. quoted: function () {
  54238. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  54239. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  54240. if (str) {
  54241. return new CartoCSS.Tree.Quoted(str[1] || str[2]);
  54242. }
  54243. },
  54244. // A reference to a Mapnik field, like [NAME]
  54245. // Behind the scenes, this has the same representation, but Carto
  54246. // needs to be careful to warn when unsupported operations are used.
  54247. field: function () {
  54248. var l = '[', r = ']';
  54249. if (!_match(l)) {return;}
  54250. var field_name = _match(/(^[^\]]+)/);
  54251. if (!_match(r)) {return;}
  54252. if (field_name) {return new CartoCSS.Tree.Field(field_name[1]);}
  54253. },
  54254. // This is a comparison operator
  54255. comparison: function () {
  54256. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  54257. if (str) {
  54258. return str;
  54259. }
  54260. },
  54261. // A catch-all word, such as: hard-light
  54262. // These can start with either a letter or a dash (-),
  54263. // and then contain numbers, underscores, and letters.
  54264. keyword: function () {
  54265. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  54266. if (k) {
  54267. return new CartoCSS.Tree.Keyword(k);
  54268. }
  54269. },
  54270. // A function call like rgb(255, 0, 255)
  54271. // The arguments are parsed with the `entities.arguments` parser.
  54272. call: function () {
  54273. var name, args;
  54274. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  54275. name = name[1];
  54276. if (name === 'url') {
  54277. // url() is handled by the url parser instead
  54278. return null;
  54279. } else {
  54280. i += name.length;
  54281. }
  54282. var l = '(', r = ')';
  54283. _match(l); // Parse the '(' and consume whitespace.
  54284. args = _match(this.entities['arguments']);
  54285. if (!_match(r)) {return;}
  54286. if (name) {
  54287. return new CartoCSS.Tree.Call(name, args, i);
  54288. }
  54289. },
  54290. // Arguments are comma-separated expressions
  54291. 'arguments': function () {
  54292. var args = [], arg;
  54293. while (arg = _match(this.expression)) {
  54294. args.push(arg);
  54295. var q = ',';
  54296. if (!_match(q)) {
  54297. break;
  54298. }
  54299. }
  54300. return args;
  54301. },
  54302. literal: function () {
  54303. return _match(this.entities.dimension) ||
  54304. _match(this.entities.keywordcolor) ||
  54305. _match(this.entities.hexcolor) ||
  54306. _match(this.entities.quoted);
  54307. },
  54308. // Parse url() tokens
  54309. //
  54310. // We use a specific rule for urls, because they don't really behave like
  54311. // standard function calls. The difference is that the argument doesn't have
  54312. // to be enclosed within a string, so it can't be parsed as an Expression.
  54313. url: function () {
  54314. var value;
  54315. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  54316. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  54317. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  54318. var r = ')';
  54319. if (!_match(r)) {
  54320. return new CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  54321. } else {
  54322. return new CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  54323. value instanceof CartoCSS.Tree.Variable) ?
  54324. value : new CartoCSS.Tree.Quoted(value));
  54325. }
  54326. },
  54327. // A Variable entity, such as `@fink`, in
  54328. //
  54329. // width: @fink + 2px
  54330. //
  54331. // We use a different parser for variable definitions,
  54332. // see `parsers.variable`.
  54333. variable: function () {
  54334. var name, index = i;
  54335. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  54336. return new CartoCSS.Tree.Variable(name, index, env.filename);
  54337. }
  54338. },
  54339. hexcolor: function () {
  54340. var rgb;
  54341. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  54342. return new CartoCSS.Tree.Color(rgb[1]);
  54343. }
  54344. },
  54345. keywordcolor: function () {
  54346. var rgb = chunks[j].match(/^[a-z]+/);
  54347. if (rgb && rgb[0] in CartoCSS.Tree.Reference.data.colors) {
  54348. return new CartoCSS.Tree.Color(CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  54349. }
  54350. },
  54351. // A Dimension, that is, a number and a unit. The only
  54352. // unit that has an effect is %
  54353. dimension: function () {
  54354. var c = input.charCodeAt(i);
  54355. if ((c > 57 || c < 45) || c === 47) {return;}
  54356. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  54357. if (value) {
  54358. return new CartoCSS.Tree.Dimension(value[1], value[2], memo);
  54359. }
  54360. }
  54361. },
  54362. // The variable part of a variable definition.
  54363. // Used in the `rule` parser. Like @fink:
  54364. variable: function () {
  54365. var name;
  54366. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  54367. return name[1];
  54368. }
  54369. },
  54370. // Entities are the smallest recognized token,
  54371. // and can be found inside a rule's value.
  54372. entity: function () {
  54373. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  54374. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  54375. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  54376. return property1 || property2 || property3;
  54377. },
  54378. // A Rule terminator. Note that we use `peek()` to check for '}',
  54379. // because the `block` rule will be expecting it, but we still need to make sure
  54380. // it's there, if ';' was ommitted.
  54381. end: function () {
  54382. var q = ';';
  54383. return _match(q) || peek('}');
  54384. },
  54385. // Elements are the building blocks for Selectors. They consist of
  54386. // an element name, such as a tag a class, or `*`.
  54387. //增加对中文的支持,[\u4e00-\u9fa5]
  54388. element: function () {
  54389. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  54390. if (e) {return new CartoCSS.Tree.Element(e);}
  54391. },
  54392. // Attachments allow adding multiple lines, polygons etc. to an
  54393. // object. There can only be one attachment per selector.
  54394. attachment: function () {
  54395. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  54396. if (s) {return s[1];}
  54397. },
  54398. // Selectors are made out of one or more Elements, see above.
  54399. selector: function () {
  54400. var a, attachment,
  54401. e, elements = [],
  54402. f, filters = new CartoCSS.Tree.Filterset(),
  54403. z, zooms = [],
  54404. segments = 0, conditions = 0;
  54405. while (
  54406. (e = _match(this.element)) ||
  54407. (z = _match(this.zoom)) ||
  54408. (f = _match(this.filter)) ||
  54409. (a = _match(this.attachment))
  54410. ) {
  54411. segments++;
  54412. if (e) {
  54413. elements.push(e);
  54414. } else if (z) {
  54415. zooms.push(z);
  54416. conditions++;
  54417. } else if (f) {
  54418. var err = filters.add(f);
  54419. if (err) {
  54420. throw makeError({
  54421. message: err,
  54422. index: i - 1
  54423. });
  54424. }
  54425. conditions++;
  54426. } else if (attachment) {
  54427. throw makeError({
  54428. message: 'Encountered second attachment name.',
  54429. index: i - 1
  54430. });
  54431. } else {
  54432. attachment = a;
  54433. }
  54434. var c = input.charAt(i);
  54435. if (c === '{' || c === '}' || c === ';' || c === ',') {
  54436. break;
  54437. }
  54438. }
  54439. if (segments) {
  54440. return new CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  54441. }
  54442. },
  54443. filter: function () {
  54444. save();
  54445. var key, op, val, l = '[', r = ']';
  54446. if (!_match(l)) {return;}
  54447. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  54448. _match(this.entities.quoted) ||
  54449. _match(this.entities.variable) ||
  54450. _match(this.entities.keyword) ||
  54451. _match(this.entities.field)) {
  54452. if (key instanceof CartoCSS.Tree.Quoted) {
  54453. key = new CartoCSS.Tree.Field(key.toString());
  54454. }
  54455. if ((op = _match(this.entities.comparison)) &&
  54456. (val = _match(this.entities.quoted) ||
  54457. _match(this.entities.variable) ||
  54458. _match(this.entities.dimension) ||
  54459. _match(this.entities.keyword) ||
  54460. _match(this.entities.field))) {
  54461. if (!_match(r)) {
  54462. throw makeError({
  54463. message: 'Missing closing ] of filter.',
  54464. index: memo - 1
  54465. });
  54466. }
  54467. if (!key.is) {key = new CartoCSS.Tree.Field(key);}
  54468. return new CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  54469. }
  54470. }
  54471. },
  54472. zoom: function () {
  54473. save();
  54474. var op, val, r = ']';
  54475. if (_match(/^\[\s*zoom/g) &&
  54476. (op = _match(this.entities.comparison)) &&
  54477. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  54478. return new CartoCSS.Tree.Zoom(op, val, memo);
  54479. } else {
  54480. // backtrack
  54481. restore();
  54482. }
  54483. },
  54484. // The `block` rule is used by `ruleset`
  54485. // It's a wrapper around the `primary` rule, with added `{}`.
  54486. block: function () {
  54487. var content, l = '{', r = '}';
  54488. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  54489. return content;
  54490. }
  54491. },
  54492. // div, .class, body > p {...}
  54493. ruleset: function () {
  54494. var selectors = [], s, rules, q = ',';
  54495. save();
  54496. while (s = _match(this.selector)) {
  54497. selectors.push(s);
  54498. while (_match(this.comment)) {//NOSONAR
  54499. }
  54500. if (!_match(q)) {
  54501. break;
  54502. }
  54503. while (_match(this.comment)) {//NOSONAR
  54504. }
  54505. }
  54506. if (s) {
  54507. while (_match(this.comment)) {//NOSONAR
  54508. }
  54509. }
  54510. if (selectors.length > 0 && (rules = _match(this.block))) {
  54511. if (selectors.length === 1 &&
  54512. selectors[0].elements.length &&
  54513. selectors[0].elements[0].value === 'Map') {
  54514. var rs = new CartoCSS.Tree.Ruleset(selectors, rules);
  54515. rs.isMap = true;
  54516. return rs;
  54517. }
  54518. return new CartoCSS.Tree.Ruleset(selectors, rules);
  54519. } else {
  54520. // Backtrack
  54521. restore();
  54522. }
  54523. },
  54524. rule: function () {
  54525. var name, value, c = input.charAt(i);
  54526. save();
  54527. if (c === '.' || c === '#') {
  54528. return;
  54529. }
  54530. if (name = _match(this.variable) || _match(this.property)) {
  54531. value = _match(this.value);
  54532. if (value && _match(this.end)) {
  54533. return new CartoCSS.Tree.Rule(name, value, memo, env.filename);
  54534. } else {
  54535. furthest = i;
  54536. restore();
  54537. }
  54538. }
  54539. },
  54540. font: function () {
  54541. var value = [], expression = [], e, q = ',';
  54542. while (e = _match(this.entity)) {
  54543. expression.push(e);
  54544. }
  54545. value.push(new CartoCSS.Tree.Expression(expression));
  54546. if (_match(q)) {
  54547. while (e = _match(this.expression)) {
  54548. value.push(e);
  54549. if (!_match(q)) {
  54550. break;
  54551. }
  54552. }
  54553. }
  54554. return new CartoCSS.Tree.Value(value);
  54555. },
  54556. // A Value is a comma-delimited list of Expressions
  54557. // In a Rule, a Value represents everything after the `:`,
  54558. // and before the `;`.
  54559. value: function () {
  54560. var e, expressions = [], q = ',';
  54561. while (e = _match(this.expression)) {
  54562. expressions.push(e);
  54563. if (!_match(q)) {
  54564. break;
  54565. }
  54566. }
  54567. if (expressions.length > 1) {
  54568. return new CartoCSS.Tree.Value(expressions.map(function (e) {
  54569. return e.value[0];
  54570. }));
  54571. } else if (expressions.length === 1) {
  54572. return new CartoCSS.Tree.Value(expressions);
  54573. }
  54574. },
  54575. // A sub-expression, contained by parenthensis
  54576. sub: function () {
  54577. var e, l = '(', r = ")";
  54578. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  54579. return e;
  54580. }
  54581. },
  54582. // This is a misnomer because it actually handles multiplication
  54583. // and division.
  54584. multiplication: function () {
  54585. var m, a, op, operation, q = '/';
  54586. if (m = _match(this.operand)) {
  54587. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  54588. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  54589. }
  54590. return operation || m;
  54591. }
  54592. },
  54593. addition: function () {
  54594. var m, a, op, operation, plus = '+';
  54595. if (m = _match(this.multiplication)) {
  54596. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  54597. (a = _match(this.multiplication))) {
  54598. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  54599. }
  54600. return operation || m;
  54601. }
  54602. },
  54603. // An operand is anything that can be part of an operation,
  54604. // such as a Color, or a Variable
  54605. operand: function () {
  54606. return _match(this.sub) || _match(this.entity);
  54607. },
  54608. // Expressions either represent mathematical operations,
  54609. // or white-space delimited Entities. @var * 2
  54610. expression: function () {
  54611. var e, entities = [];
  54612. while (e = _match(this.addition) || _match(this.entity)) {
  54613. entities.push(e);
  54614. }
  54615. if (entities.length > 0) {
  54616. return new CartoCSS.Tree.Expression(entities);
  54617. }
  54618. },
  54619. property: function () {
  54620. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  54621. if (name) {return name[1];}
  54622. }
  54623. }
  54624. };
  54625. return parser;
  54626. }
  54627. /**
  54628. * @function CartoCSS.prototype.parse
  54629. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集。
  54630. * @returns {Object} CartoCSS规则集。
  54631. */
  54632. parse(str) {
  54633. var parser = this.parser;
  54634. var ruleSet = this.ruleSet = parser.parse(str);
  54635. return ruleSet;
  54636. }
  54637. /**
  54638. * @function CartoCSS.prototype.toShaders
  54639. * @description 将CartoCSS规则集转化为着色器。
  54640. * @returns {Array} CartoCSS着色器集。
  54641. */
  54642. toShaders() {
  54643. if (this.ruleSet) {
  54644. var ruleset = this.ruleSet;
  54645. if (ruleset) {
  54646. var defs = ruleset.toList(this.env);
  54647. defs.reverse();
  54648. var shaders = {};
  54649. var keys = [];
  54650. this._toShaders(shaders,keys,defs);
  54651. var ordered_shaders = [];
  54652. var done = {};
  54653. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  54654. var def = defs[i];
  54655. var k = def.attachment;
  54656. var shader = shaders[keys[i]];
  54657. var shaderArray = [];
  54658. if (!done[k]) {
  54659. var j = 0;
  54660. for (var prop in shader) {
  54661. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  54662. //对layer-index作特殊处理以实现图层的控制
  54663. if (prop === "layer-index") {
  54664. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  54665. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  54666. var _value = null;
  54667. shader[prop].join('\n');
  54668. return _value;
  54669. };
  54670. var layerIndex = getLayerIndex();
  54671. Object.defineProperty(shaderArray, "layerIndex", {
  54672. configurable: true,
  54673. enumerable: false,
  54674. value: layerIndex
  54675. });
  54676. } else {
  54677. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  54678. if (!Array.isArray(ops)) {
  54679. return ops;
  54680. }
  54681. var body = ops.join('\n');
  54682. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  54683. var index = body.indexOf(myKeyword);
  54684. if (index >= 0) {
  54685. //对featureID作一些特殊处理,以将featureID提取出来
  54686. if (!shaderArray.featureFilter) {
  54687. var featureFilterStart = index + myKeyword.length;
  54688. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  54689. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  54690. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  54691. var featureFilter = function (featureId) {
  54692. if (featureFilterStr) {
  54693. return true;
  54694. }
  54695. return false;
  54696. }
  54697. Object.defineProperty(shaderArray, "featureFilter", {
  54698. configurable: true,
  54699. enumerable: false,
  54700. value: featureFilter
  54701. });
  54702. }
  54703. return {
  54704. "property": prop,
  54705. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  54706. };
  54707. } else {
  54708. return {
  54709. "property": prop,
  54710. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  54711. };
  54712. }
  54713. }(shader[prop], shaderArray);
  54714. }
  54715. }
  54716. }
  54717. Object.defineProperty(shaderArray, "attachment", {
  54718. configurable: true,
  54719. enumerable: false,
  54720. value: k
  54721. });
  54722. Object.defineProperty(shaderArray, "elements", {
  54723. configurable: true,
  54724. enumerable: false,
  54725. value: def.elements
  54726. });
  54727. ordered_shaders.push(shaderArray);
  54728. done[keys[i]] = true;
  54729. }
  54730. Object.defineProperty(shaderArray, "zoom", {
  54731. configurable: true,
  54732. enumerable: false,
  54733. value: def.zoom
  54734. });
  54735. //shader.frames.push(def.frame_offset);
  54736. }
  54737. return ordered_shaders;
  54738. }
  54739. }
  54740. return null;
  54741. }
  54742. _toShaders(shaders, keys,defs) {
  54743. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  54744. let def = defs[i];
  54745. let element_str = [];
  54746. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  54747. element_str.push(def.elements[j]);
  54748. }
  54749. let filters = def.filters.filters;
  54750. let filterStr = [];
  54751. for (let attr in filters) {
  54752. filterStr.push(filters[attr].id);
  54753. }
  54754. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  54755. keys.push(key);
  54756. let shader = shaders[key] = (shaders[key] || {});
  54757. //shader.frames = [];
  54758. shader.zoom = CartoCSS.Tree.Zoom.all;
  54759. let props = def.toJS(this.env);
  54760. for (let v in props) {
  54761. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  54762. }
  54763. }
  54764. }
  54765. /**
  54766. * @function CartoCSS.prototype.getShaders
  54767. * @description 获取CartoCSS着色器。
  54768. * @returns {Array} 着色器集。
  54769. * @example
  54770. * //shaders的结构大概如下:
  54771. * var shaders=[
  54772. * {
  54773. * attachment:"one",
  54774. * elements:[],
  54775. * zoom:23,
  54776. * length:2,
  54777. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  54778. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  54779. * },
  54780. * {
  54781. * attachment:"two",
  54782. * elements:[],
  54783. * zoom:23,
  54784. * length:2,
  54785. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  54786. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  54787. * }
  54788. * ];
  54789. */
  54790. getShaders() {
  54791. return this.shaders;
  54792. }
  54793. /**
  54794. * @function CartoCSS.prototype.destroy
  54795. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象。
  54796. */
  54797. destroy() {
  54798. this.cartoStr = null;
  54799. this.env = null;
  54800. this.ruleSet = null;
  54801. this.parser = null;
  54802. this.shaders = null;
  54803. }
  54804. }
  54805. var _mapnik_reference_latest = {
  54806. "version": "2.1.1",
  54807. "style": {
  54808. "filter-mode": {
  54809. "type": [
  54810. "all",
  54811. "first"
  54812. ],
  54813. "doc": "Control the processing behavior of Rule filters within a Style. If 'all' is used then all Rules are processed sequentially independent of whether any previous filters matched. If 'first' is used then it means processing ends after the first match (a positive filter evaluation) and no further Rules in the Style are processed ('first' is usually the default for CSS implementations on top of Mapnik to simplify translation from CSS to Mapnik XML)",
  54814. "default-value": "all",
  54815. "default-meaning": "All Rules in a Style are processed whether they have filters or not and whether or not the filter conditions evaluate to true."
  54816. },
  54817. "image-filters": {
  54818. "css": "image-filters",
  54819. "default-value": "none",
  54820. "default-meaning": "no filters",
  54821. "type": "functions",
  54822. "functions": [
  54823. ["agg-stack-blur", 2],
  54824. ["emboss", 0],
  54825. ["blur", 0],
  54826. ["gray", 0],
  54827. ["sobel", 0],
  54828. ["edge-detect", 0],
  54829. ["x-gradient", 0],
  54830. ["y-gradient", 0],
  54831. ["invert", 0],
  54832. ["sharpen", 0]
  54833. ],
  54834. "doc": "A list of image filters."
  54835. },
  54836. "comp-op": {
  54837. "css": "comp-op",
  54838. "default-value": "src-over",
  54839. "default-meaning": "add the current layer on top of other layers",
  54840. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  54841. "type": ["clear",
  54842. "src",
  54843. "dst",
  54844. "src-over",
  54845. "dst-over",
  54846. "src-in",
  54847. "dst-in",
  54848. "src-out",
  54849. "dst-out",
  54850. "src-atop",
  54851. "dst-atop",
  54852. "xor",
  54853. "plus",
  54854. "minus",
  54855. "multiply",
  54856. "screen",
  54857. "overlay",
  54858. "darken",
  54859. "lighten",
  54860. "color-dodge",
  54861. "color-burn",
  54862. "hard-light",
  54863. "soft-light",
  54864. "difference",
  54865. "exclusion",
  54866. "contrast",
  54867. "invert",
  54868. "invert-rgb",
  54869. "grain-merge",
  54870. "grain-extract",
  54871. "hue",
  54872. "saturation",
  54873. "color",
  54874. "value"
  54875. ]
  54876. },
  54877. "opacity": {
  54878. "css": "opacity",
  54879. "type": "float",
  54880. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  54881. "default-value": 1,
  54882. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  54883. }
  54884. },
  54885. "layer": {
  54886. "name": {
  54887. "default-value": "",
  54888. "type": "string",
  54889. "required": true,
  54890. "default-meaning": "No layer name has been provided",
  54891. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  54892. },
  54893. "srs": {
  54894. "default-value": "",
  54895. "type": "string",
  54896. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  54897. "doc": "The spatial reference system definition for the layer, aka the projection. Can either be a proj4 literal string like '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' or, if the proper proj4 epsg/nad/etc identifier files are installed, a string that uses an id like: '+init=epsg:4326'"
  54898. },
  54899. "status": {
  54900. "default-value": true,
  54901. "type": "boolean",
  54902. "default-meaning": "This layer will be marked as active and available for processing",
  54903. "doc": "A property that can be set to false to disable this layer from being processed"
  54904. },
  54905. "minzoom": {
  54906. "default-value": "0",
  54907. "type": "float",
  54908. "default-meaning": "The layer will be visible at the minimum possible scale",
  54909. "doc": "The minimum scale denominator that this layer will be visible at. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  54910. },
  54911. "maxzoom": {
  54912. "default-value": "1.79769e+308",
  54913. "type": "float",
  54914. "default-meaning": "The layer will be visible at the maximum possible scale",
  54915. "doc": "The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  54916. },
  54917. "queryable": {
  54918. "default-value": false,
  54919. "type": "boolean",
  54920. "default-meaning": "The layer will not be available for the direct querying of data values",
  54921. "doc": "This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"
  54922. },
  54923. "clear-label-cache": {
  54924. "default-value": false,
  54925. "type": "boolean",
  54926. "default-meaning": "The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",
  54927. "doc": "This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"
  54928. },
  54929. "group-by": {
  54930. "default-value": "",
  54931. "type": "string",
  54932. "default-meaning": "No special layer grouping will be used during rendering",
  54933. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  54934. },
  54935. "buffer-size": {
  54936. "default-value": "0",
  54937. "type": "float",
  54938. "default-meaning": "No buffer will be used",
  54939. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  54940. },
  54941. "maximum-extent": {
  54942. "default-value": "none",
  54943. "type": "bbox",
  54944. "default-meaning": "No clipping extent will be used",
  54945. "doc": "An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."
  54946. }
  54947. },
  54948. "symbolizers": {
  54949. "*": {
  54950. "image-filters": {
  54951. "css": "image-filters",
  54952. "default-value": "none",
  54953. "default-meaning": "no filters",
  54954. "type": "functions",
  54955. "functions": [
  54956. ["agg-stack-blur", 2],
  54957. ["emboss", 0],
  54958. ["blur", 0],
  54959. ["gray", 0],
  54960. ["sobel", 0],
  54961. ["edge-detect", 0],
  54962. ["x-gradient", 0],
  54963. ["y-gradient", 0],
  54964. ["invert", 0],
  54965. ["sharpen", 0]
  54966. ],
  54967. "doc": "A list of image filters."
  54968. },
  54969. "comp-op": {
  54970. "css": "comp-op",
  54971. "default-value": "src-over",
  54972. "default-meaning": "add the current layer on top of other layers",
  54973. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  54974. "type": ["clear",
  54975. "src",
  54976. "dst",
  54977. "src-over",
  54978. "dst-over",
  54979. "src-in",
  54980. "dst-in",
  54981. "src-out",
  54982. "dst-out",
  54983. "src-atop",
  54984. "dst-atop",
  54985. "xor",
  54986. "plus",
  54987. "minus",
  54988. "multiply",
  54989. "screen",
  54990. "overlay",
  54991. "darken",
  54992. "lighten",
  54993. "color-dodge",
  54994. "color-burn",
  54995. "hard-light",
  54996. "soft-light",
  54997. "difference",
  54998. "exclusion",
  54999. "contrast",
  55000. "invert",
  55001. "invert-rgb",
  55002. "grain-merge",
  55003. "grain-extract",
  55004. "hue",
  55005. "saturation",
  55006. "color",
  55007. "value"
  55008. ]
  55009. },
  55010. "opacity": {
  55011. "css": "opacity",
  55012. "type": "float",
  55013. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  55014. "default-value": 1,
  55015. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  55016. }
  55017. },
  55018. "map": {
  55019. "background-color": {
  55020. "css": "background-color",
  55021. "default-value": "none",
  55022. "default-meaning": "transparent",
  55023. "type": "color",
  55024. "doc": "Map Background color"
  55025. },
  55026. "background-image": {
  55027. "css": "background-image",
  55028. "type": "uri",
  55029. "default-value": "",
  55030. "default-meaning": "transparent",
  55031. "doc": "An image that is repeated below all features on a map as a background.",
  55032. "description": "Map Background image"
  55033. },
  55034. "srs": {
  55035. "css": "srs",
  55036. "type": "string",
  55037. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  55038. "default-meaning": "The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",
  55039. "doc": "Map spatial reference (proj4 string)"
  55040. },
  55041. "buffer-size": {
  55042. "css": "buffer-size",
  55043. "default-value": "0",
  55044. "type": "float",
  55045. "default-meaning": "No buffer will be used",
  55046. "doc": "Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with \"avoid-edges\"."
  55047. },
  55048. "maximum-extent": {
  55049. "css": "",
  55050. "default-value": "none",
  55051. "type": "bbox",
  55052. "default-meaning": "No clipping extent will be used",
  55053. "doc": "An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."
  55054. },
  55055. "base": {
  55056. "css": "base",
  55057. "default-value": "",
  55058. "default-meaning": "This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",
  55059. "type": "string",
  55060. "doc": "Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."
  55061. },
  55062. "paths-from-xml": {
  55063. "css": "",
  55064. "default-value": true,
  55065. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  55066. "type": "boolean",
  55067. "doc": "value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"
  55068. },
  55069. "minimum-version": {
  55070. "css": "",
  55071. "default-value": "none",
  55072. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  55073. "type": "string",
  55074. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  55075. },
  55076. "font-directory": {
  55077. "css": "font-directory",
  55078. "type": "uri",
  55079. "default-value": "none",
  55080. "default-meaning": "No map-specific fonts will be registered",
  55081. "doc": "Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."
  55082. }
  55083. },
  55084. "polygon": {
  55085. "fill": {
  55086. "css": "polygon-fill",
  55087. "type": "color",
  55088. "default-value": "rgba(128,128,128,1)",
  55089. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  55090. "doc": "Fill color to assign to a polygon"
  55091. },
  55092. "fill-opacity": {
  55093. "css": "polygon-opacity",
  55094. "type": "float",
  55095. "doc": "The opacity of the polygon",
  55096. "default-value": 1,
  55097. "default-meaning": "opaque"
  55098. },
  55099. "gamma": {
  55100. "css": "polygon-gamma",
  55101. "type": "float",
  55102. "default-value": 1,
  55103. "default-meaning": "fully antialiased",
  55104. "range": "0-1",
  55105. "doc": "Level of antialiasing of polygon edges"
  55106. },
  55107. "gamma-method": {
  55108. "css": "polygon-gamma-method",
  55109. "type": [
  55110. "power",
  55111. "linear",
  55112. "none",
  55113. "threshold",
  55114. "multiply"
  55115. ],
  55116. "default-value": "power",
  55117. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  55118. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  55119. },
  55120. "clip": {
  55121. "css": "polygon-clip",
  55122. "type": "boolean",
  55123. "default-value": true,
  55124. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55125. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55126. },
  55127. "smooth": {
  55128. "css": "polygon-smooth",
  55129. "type": "float",
  55130. "default-value": 0,
  55131. "default-meaning": "no smoothing",
  55132. "range": "0-1",
  55133. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  55134. },
  55135. "geometry-transform": {
  55136. "css": "polygon-geometry-transform",
  55137. "type": "functions",
  55138. "default-value": "none",
  55139. "default-meaning": "geometry will not be transformed",
  55140. "doc": "Allows transformation functions to be applied to the geometry.",
  55141. "functions": [
  55142. ["matrix", 6],
  55143. ["translate", 2],
  55144. ["scale", 2],
  55145. ["rotate", 3],
  55146. ["skewX", 1],
  55147. ["skewY", 1]
  55148. ]
  55149. },
  55150. "comp-op": {
  55151. "css": "polygon-comp-op",
  55152. "default-value": "src-over",
  55153. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55154. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55155. "type": ["clear",
  55156. "src",
  55157. "dst",
  55158. "src-over",
  55159. "dst-over",
  55160. "src-in",
  55161. "dst-in",
  55162. "src-out",
  55163. "dst-out",
  55164. "src-atop",
  55165. "dst-atop",
  55166. "xor",
  55167. "plus",
  55168. "minus",
  55169. "multiply",
  55170. "screen",
  55171. "overlay",
  55172. "darken",
  55173. "lighten",
  55174. "color-dodge",
  55175. "color-burn",
  55176. "hard-light",
  55177. "soft-light",
  55178. "difference",
  55179. "exclusion",
  55180. "contrast",
  55181. "invert",
  55182. "invert-rgb",
  55183. "grain-merge",
  55184. "grain-extract",
  55185. "hue",
  55186. "saturation",
  55187. "color",
  55188. "value"
  55189. ]
  55190. }
  55191. },
  55192. "line": {
  55193. "stroke": {
  55194. "css": "line-color",
  55195. "default-value": "rgba(0,0,0,1)",
  55196. "type": "color",
  55197. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  55198. "doc": "The color of a drawn line"
  55199. },
  55200. "stroke-width": {
  55201. "css": "line-width",
  55202. "default-value": 1,
  55203. "type": "float",
  55204. "doc": "The width of a line in pixels"
  55205. },
  55206. "stroke-opacity": {
  55207. "css": "line-opacity",
  55208. "default-value": 1,
  55209. "type": "float",
  55210. "default-meaning": "opaque",
  55211. "doc": "The opacity of a line"
  55212. },
  55213. "stroke-linejoin": {
  55214. "css": "line-join",
  55215. "default-value": "miter",
  55216. "type": [
  55217. "miter",
  55218. "round",
  55219. "bevel"
  55220. ],
  55221. "doc": "The behavior of lines when joining"
  55222. },
  55223. "stroke-linecap": {
  55224. "css": "line-cap",
  55225. "default-value": "butt",
  55226. "type": [
  55227. "butt",
  55228. "round",
  55229. "square"
  55230. ],
  55231. "doc": "The display of line endings"
  55232. },
  55233. "stroke-gamma": {
  55234. "css": "line-gamma",
  55235. "type": "float",
  55236. "default-value": 1,
  55237. "default-meaning": "fully antialiased",
  55238. "range": "0-1",
  55239. "doc": "Level of antialiasing of stroke line"
  55240. },
  55241. "stroke-gamma-method": {
  55242. "css": "line-gamma-method",
  55243. "type": [
  55244. "power",
  55245. "linear",
  55246. "none",
  55247. "threshold",
  55248. "multiply"
  55249. ],
  55250. "default-value": "power",
  55251. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  55252. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  55253. },
  55254. "stroke-dasharray": {
  55255. "css": "line-dasharray",
  55256. "type": "numbers",
  55257. "doc": "A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.",
  55258. "default-value": "none",
  55259. "default-meaning": "solid line"
  55260. },
  55261. "stroke-dashoffset": {
  55262. "css": "line-dash-offset",
  55263. "type": "numbers",
  55264. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  55265. "default-value": "none",
  55266. "default-meaning": "solid line"
  55267. },
  55268. "stroke-miterlimit": {
  55269. "css": "line-miterlimit",
  55270. "type": "float",
  55271. "doc": "The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.",
  55272. "default-value": 4.0,
  55273. "default-meaning": "Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"
  55274. },
  55275. "clip": {
  55276. "css": "line-clip",
  55277. "type": "boolean",
  55278. "default-value": true,
  55279. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55280. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55281. },
  55282. "smooth": {
  55283. "css": "line-smooth",
  55284. "type": "float",
  55285. "default-value": 0,
  55286. "default-meaning": "no smoothing",
  55287. "range": "0-1",
  55288. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  55289. },
  55290. "offset": {
  55291. "css": "line-offset",
  55292. "type": "float",
  55293. "default-value": 0,
  55294. "default-meaning": "no offset",
  55295. "doc": "Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."
  55296. },
  55297. "rasterizer": {
  55298. "css": "line-rasterizer",
  55299. "type": [
  55300. "full",
  55301. "fast"
  55302. ],
  55303. "default-value": "full",
  55304. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  55305. },
  55306. "geometry-transform": {
  55307. "css": "line-geometry-transform",
  55308. "type": "functions",
  55309. "default-value": "none",
  55310. "default-meaning": "geometry will not be transformed",
  55311. "doc": "Allows transformation functions to be applied to the geometry.",
  55312. "functions": [
  55313. ["matrix", 6],
  55314. ["translate", 2],
  55315. ["scale", 2],
  55316. ["rotate", 3],
  55317. ["skewX", 1],
  55318. ["skewY", 1]
  55319. ]
  55320. },
  55321. "comp-op": {
  55322. "css": "line-comp-op",
  55323. "default-value": "src-over",
  55324. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55325. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55326. "type": ["clear",
  55327. "src",
  55328. "dst",
  55329. "src-over",
  55330. "dst-over",
  55331. "src-in",
  55332. "dst-in",
  55333. "src-out",
  55334. "dst-out",
  55335. "src-atop",
  55336. "dst-atop",
  55337. "xor",
  55338. "plus",
  55339. "minus",
  55340. "multiply",
  55341. "screen",
  55342. "overlay",
  55343. "darken",
  55344. "lighten",
  55345. "color-dodge",
  55346. "color-burn",
  55347. "hard-light",
  55348. "soft-light",
  55349. "difference",
  55350. "exclusion",
  55351. "contrast",
  55352. "invert",
  55353. "invert-rgb",
  55354. "grain-merge",
  55355. "grain-extract",
  55356. "hue",
  55357. "saturation",
  55358. "color",
  55359. "value"
  55360. ]
  55361. }
  55362. },
  55363. "markers": {
  55364. "file": {
  55365. "css": "marker-file",
  55366. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  55367. "default-value": "",
  55368. "default-meaning": "An ellipse or circle, if width equals height",
  55369. "type": "uri"
  55370. },
  55371. "opacity": {
  55372. "css": "marker-opacity",
  55373. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  55374. "default-value": 1,
  55375. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  55376. "type": "float"
  55377. },
  55378. "fill-opacity": {
  55379. "css": "marker-fill-opacity",
  55380. "doc": "The fill opacity of the marker",
  55381. "default-value": 1,
  55382. "default-meaning": "opaque",
  55383. "type": "float"
  55384. },
  55385. "stroke": {
  55386. "css": "marker-line-color",
  55387. "doc": "The color of the stroke around a marker shape.",
  55388. "default-value": "black",
  55389. "type": "color"
  55390. },
  55391. "stroke-width": {
  55392. "css": "marker-line-width",
  55393. "doc": "The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",
  55394. "type": "float"
  55395. },
  55396. "stroke-opacity": {
  55397. "css": "marker-line-opacity",
  55398. "default-value": 1,
  55399. "default-meaning": "opaque",
  55400. "doc": "The opacity of a line",
  55401. "type": "float"
  55402. },
  55403. "placement": {
  55404. "css": "marker-placement",
  55405. "type": [
  55406. "point",
  55407. "line",
  55408. "interior"
  55409. ],
  55410. "default-value": "point",
  55411. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  55412. "doc": "Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"
  55413. },
  55414. "multi-policy": {
  55415. "css": "marker-multi-policy",
  55416. "type": [
  55417. "each",
  55418. "whole",
  55419. "largest"
  55420. ],
  55421. "default-value": "each",
  55422. "default-meaning": "If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",
  55423. "doc": "A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."
  55424. },
  55425. "marker-type": {
  55426. "css": "marker-type",
  55427. "type": [
  55428. "arrow",
  55429. "ellipse"
  55430. ],
  55431. "default-value": "ellipse",
  55432. "doc": "The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"
  55433. },
  55434. "width": {
  55435. "css": "marker-width",
  55436. "default-value": 10,
  55437. "doc": "The width of the marker, if using one of the default types.",
  55438. "type": "expression"
  55439. },
  55440. "height": {
  55441. "css": "marker-height",
  55442. "default-value": 10,
  55443. "doc": "The height of the marker, if using one of the default types.",
  55444. "type": "expression"
  55445. },
  55446. "fill": {
  55447. "css": "marker-fill",
  55448. "default-value": "blue",
  55449. "doc": "The color of the area of the marker.",
  55450. "type": "color"
  55451. },
  55452. "allow-overlap": {
  55453. "css": "marker-allow-overlap",
  55454. "type": "boolean",
  55455. "default-value": false,
  55456. "doc": "Control whether overlapping markers are shown or hidden.",
  55457. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  55458. },
  55459. "ignore-placement": {
  55460. "css": "marker-ignore-placement",
  55461. "type": "boolean",
  55462. "default-value": false,
  55463. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  55464. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  55465. },
  55466. "spacing": {
  55467. "css": "marker-spacing",
  55468. "doc": "Space between repeated labels",
  55469. "default-value": 100,
  55470. "type": "float"
  55471. },
  55472. "max-error": {
  55473. "css": "marker-max-error",
  55474. "type": "float",
  55475. "default-value": 0.2,
  55476. "doc": "The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."
  55477. },
  55478. "transform": {
  55479. "css": "marker-transform",
  55480. "type": "functions",
  55481. "functions": [
  55482. ["matrix", 6],
  55483. ["translate", 2],
  55484. ["scale", 2],
  55485. ["rotate", 3],
  55486. ["skewX", 1],
  55487. ["skewY", 1]
  55488. ],
  55489. "default-value": "",
  55490. "default-meaning": "No transformation",
  55491. "doc": "SVG transformation definition"
  55492. },
  55493. "clip": {
  55494. "css": "marker-clip",
  55495. "type": "boolean",
  55496. "default-value": true,
  55497. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55498. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55499. },
  55500. "smooth": {
  55501. "css": "marker-smooth",
  55502. "type": "float",
  55503. "default-value": 0,
  55504. "default-meaning": "no smoothing",
  55505. "range": "0-1",
  55506. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  55507. },
  55508. "geometry-transform": {
  55509. "css": "marker-geometry-transform",
  55510. "type": "functions",
  55511. "default-value": "none",
  55512. "default-meaning": "geometry will not be transformed",
  55513. "doc": "Allows transformation functions to be applied to the geometry.",
  55514. "functions": [
  55515. ["matrix", 6],
  55516. ["translate", 2],
  55517. ["scale", 2],
  55518. ["rotate", 3],
  55519. ["skewX", 1],
  55520. ["skewY", 1]
  55521. ]
  55522. },
  55523. "comp-op": {
  55524. "css": "marker-comp-op",
  55525. "default-value": "src-over",
  55526. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55527. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55528. "type": ["clear",
  55529. "src",
  55530. "dst",
  55531. "src-over",
  55532. "dst-over",
  55533. "src-in",
  55534. "dst-in",
  55535. "src-out",
  55536. "dst-out",
  55537. "src-atop",
  55538. "dst-atop",
  55539. "xor",
  55540. "plus",
  55541. "minus",
  55542. "multiply",
  55543. "screen",
  55544. "overlay",
  55545. "darken",
  55546. "lighten",
  55547. "color-dodge",
  55548. "color-burn",
  55549. "hard-light",
  55550. "soft-light",
  55551. "difference",
  55552. "exclusion",
  55553. "contrast",
  55554. "invert",
  55555. "invert-rgb",
  55556. "grain-merge",
  55557. "grain-extract",
  55558. "hue",
  55559. "saturation",
  55560. "color",
  55561. "value"
  55562. ]
  55563. }
  55564. },
  55565. "shield": {
  55566. "name": {
  55567. "css": "shield-name",
  55568. "type": "expression",
  55569. "serialization": "content",
  55570. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  55571. },
  55572. "file": {
  55573. "css": "shield-file",
  55574. "required": true,
  55575. "type": "uri",
  55576. "default-value": "none",
  55577. "doc": "Image file to render behind the shield text"
  55578. },
  55579. "face-name": {
  55580. "css": "shield-face-name",
  55581. "type": "string",
  55582. "validate": "font",
  55583. "doc": "Font name and style to use for the shield text",
  55584. "default-value": "",
  55585. "required": true
  55586. },
  55587. "unlock-image": {
  55588. "css": "shield-unlock-image",
  55589. "type": "boolean",
  55590. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  55591. "default-value": false,
  55592. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  55593. },
  55594. "size": {
  55595. "css": "shield-size",
  55596. "type": "float",
  55597. "doc": "The size of the shield text in pixels"
  55598. },
  55599. "fill": {
  55600. "css": "shield-fill",
  55601. "type": "color",
  55602. "doc": "The color of the shield text"
  55603. },
  55604. "placement": {
  55605. "css": "shield-placement",
  55606. "type": [
  55607. "point",
  55608. "line",
  55609. "vertex",
  55610. "interior"
  55611. ],
  55612. "default-value": "point",
  55613. "doc": "How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."
  55614. },
  55615. "avoid-edges": {
  55616. "css": "shield-avoid-edges",
  55617. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  55618. "type": "boolean",
  55619. "default-value": false
  55620. },
  55621. "allow-overlap": {
  55622. "css": "shield-allow-overlap",
  55623. "type": "boolean",
  55624. "default-value": false,
  55625. "doc": "Control whether overlapping shields are shown or hidden.",
  55626. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  55627. },
  55628. "minimum-distance": {
  55629. "css": "shield-min-distance",
  55630. "type": "float",
  55631. "default-value": 0,
  55632. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  55633. },
  55634. "spacing": {
  55635. "css": "shield-spacing",
  55636. "type": "float",
  55637. "default-value": 0,
  55638. "doc": "The spacing between repeated occurrences of the same shield on a line"
  55639. },
  55640. "minimum-padding": {
  55641. "css": "shield-min-padding",
  55642. "default-value": 0,
  55643. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  55644. "type": "float"
  55645. },
  55646. "wrap-width": {
  55647. "css": "shield-wrap-width",
  55648. "type": "unsigned",
  55649. "default-value": 0,
  55650. "doc": "Length of a chunk of text in characters before wrapping text"
  55651. },
  55652. "wrap-before": {
  55653. "css": "shield-wrap-before",
  55654. "type": "boolean",
  55655. "default-value": false,
  55656. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  55657. },
  55658. "wrap-character": {
  55659. "css": "shield-wrap-character",
  55660. "type": "string",
  55661. "default-value": " ",
  55662. "doc": "Use this character instead of a space to wrap long names."
  55663. },
  55664. "halo-fill": {
  55665. "css": "shield-halo-fill",
  55666. "type": "color",
  55667. "default-value": "#FFFFFF",
  55668. "default-meaning": "white",
  55669. "doc": "Specifies the color of the halo around the text."
  55670. },
  55671. "halo-radius": {
  55672. "css": "shield-halo-radius",
  55673. "doc": "Specify the radius of the halo in pixels",
  55674. "default-value": 0,
  55675. "default-meaning": "no halo",
  55676. "type": "float"
  55677. },
  55678. "character-spacing": {
  55679. "css": "shield-character-spacing",
  55680. "type": "unsigned",
  55681. "default-value": 0,
  55682. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  55683. },
  55684. "line-spacing": {
  55685. "css": "shield-line-spacing",
  55686. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  55687. "type": "unsigned"
  55688. },
  55689. "dx": {
  55690. "css": "shield-text-dx",
  55691. "type": "float",
  55692. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  55693. "default-value": 0
  55694. },
  55695. "dy": {
  55696. "css": "shield-text-dy",
  55697. "type": "float",
  55698. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  55699. "default-value": 0
  55700. },
  55701. "shield-dx": {
  55702. "css": "shield-dx",
  55703. "type": "float",
  55704. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  55705. "default-value": 0
  55706. },
  55707. "shield-dy": {
  55708. "css": "shield-dy",
  55709. "type": "float",
  55710. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  55711. "default-value": 0
  55712. },
  55713. "opacity": {
  55714. "css": "shield-opacity",
  55715. "type": "float",
  55716. "doc": "(Default 1.0) - opacity of the image used for the shield",
  55717. "default-value": 1
  55718. },
  55719. "text-opacity": {
  55720. "css": "shield-text-opacity",
  55721. "type": "float",
  55722. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  55723. "default-value": 1
  55724. },
  55725. "horizontal-alignment": {
  55726. "css": "shield-horizontal-alignment",
  55727. "type": [
  55728. "left",
  55729. "middle",
  55730. "right",
  55731. "auto"
  55732. ],
  55733. "doc": "The shield's horizontal alignment from its centerpoint",
  55734. "default-value": "auto"
  55735. },
  55736. "vertical-alignment": {
  55737. "css": "shield-vertical-alignment",
  55738. "type": [
  55739. "top",
  55740. "middle",
  55741. "bottom",
  55742. "auto"
  55743. ],
  55744. "doc": "The shield's vertical alignment from its centerpoint",
  55745. "default-value": "middle"
  55746. },
  55747. "text-transform": {
  55748. "css": "shield-text-transform",
  55749. "type": [
  55750. "none",
  55751. "uppercase",
  55752. "lowercase",
  55753. "capitalize"
  55754. ],
  55755. "doc": "Transform the case of the characters",
  55756. "default-value": "none"
  55757. },
  55758. "justify-alignment": {
  55759. "css": "shield-justify-alignment",
  55760. "type": [
  55761. "left",
  55762. "center",
  55763. "right",
  55764. "auto"
  55765. ],
  55766. "doc": "Define how text in a shield's label is justified",
  55767. "default-value": "auto"
  55768. },
  55769. "clip": {
  55770. "css": "shield-clip",
  55771. "type": "boolean",
  55772. "default-value": true,
  55773. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55774. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55775. },
  55776. "comp-op": {
  55777. "css": "shield-comp-op",
  55778. "default-value": "src-over",
  55779. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55780. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55781. "type": ["clear",
  55782. "src",
  55783. "dst",
  55784. "src-over",
  55785. "dst-over",
  55786. "src-in",
  55787. "dst-in",
  55788. "src-out",
  55789. "dst-out",
  55790. "src-atop",
  55791. "dst-atop",
  55792. "xor",
  55793. "plus",
  55794. "minus",
  55795. "multiply",
  55796. "screen",
  55797. "overlay",
  55798. "darken",
  55799. "lighten",
  55800. "color-dodge",
  55801. "color-burn",
  55802. "hard-light",
  55803. "soft-light",
  55804. "difference",
  55805. "exclusion",
  55806. "contrast",
  55807. "invert",
  55808. "invert-rgb",
  55809. "grain-merge",
  55810. "grain-extract",
  55811. "hue",
  55812. "saturation",
  55813. "color",
  55814. "value"
  55815. ]
  55816. }
  55817. },
  55818. "line-pattern": {
  55819. "file": {
  55820. "css": "line-pattern-file",
  55821. "type": "uri",
  55822. "default-value": "none",
  55823. "required": true,
  55824. "doc": "An image file to be repeated and warped along a line"
  55825. },
  55826. "clip": {
  55827. "css": "line-pattern-clip",
  55828. "type": "boolean",
  55829. "default-value": true,
  55830. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55831. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55832. },
  55833. "smooth": {
  55834. "css": "line-pattern-smooth",
  55835. "type": "float",
  55836. "default-value": 0,
  55837. "default-meaning": "no smoothing",
  55838. "range": "0-1",
  55839. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  55840. },
  55841. "geometry-transform": {
  55842. "css": "line-pattern-geometry-transform",
  55843. "type": "functions",
  55844. "default-value": "none",
  55845. "default-meaning": "geometry will not be transformed",
  55846. "doc": "Allows transformation functions to be applied to the geometry.",
  55847. "functions": [
  55848. ["matrix", 6],
  55849. ["translate", 2],
  55850. ["scale", 2],
  55851. ["rotate", 3],
  55852. ["skewX", 1],
  55853. ["skewY", 1]
  55854. ]
  55855. },
  55856. "comp-op": {
  55857. "css": "line-pattern-comp-op",
  55858. "default-value": "src-over",
  55859. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55860. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55861. "type": ["clear",
  55862. "src",
  55863. "dst",
  55864. "src-over",
  55865. "dst-over",
  55866. "src-in",
  55867. "dst-in",
  55868. "src-out",
  55869. "dst-out",
  55870. "src-atop",
  55871. "dst-atop",
  55872. "xor",
  55873. "plus",
  55874. "minus",
  55875. "multiply",
  55876. "screen",
  55877. "overlay",
  55878. "darken",
  55879. "lighten",
  55880. "color-dodge",
  55881. "color-burn",
  55882. "hard-light",
  55883. "soft-light",
  55884. "difference",
  55885. "exclusion",
  55886. "contrast",
  55887. "invert",
  55888. "invert-rgb",
  55889. "grain-merge",
  55890. "grain-extract",
  55891. "hue",
  55892. "saturation",
  55893. "color",
  55894. "value"
  55895. ]
  55896. }
  55897. },
  55898. "polygon-pattern": {
  55899. "file": {
  55900. "css": "polygon-pattern-file",
  55901. "type": "uri",
  55902. "default-value": "none",
  55903. "required": true,
  55904. "doc": "Image to use as a repeated pattern fill within a polygon"
  55905. },
  55906. "alignment": {
  55907. "css": "polygon-pattern-alignment",
  55908. "type": [
  55909. "local",
  55910. "global"
  55911. ],
  55912. "default-value": "local",
  55913. "doc": "Specify whether to align pattern fills to the layer or to the map."
  55914. },
  55915. "gamma": {
  55916. "css": "polygon-pattern-gamma",
  55917. "type": "float",
  55918. "default-value": 1,
  55919. "default-meaning": "fully antialiased",
  55920. "range": "0-1",
  55921. "doc": "Level of antialiasing of polygon pattern edges"
  55922. },
  55923. "opacity": {
  55924. "css": "polygon-pattern-opacity",
  55925. "type": "float",
  55926. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  55927. "default-value": 1,
  55928. "default-meaning": "The image is rendered without modifications"
  55929. },
  55930. "clip": {
  55931. "css": "polygon-pattern-clip",
  55932. "type": "boolean",
  55933. "default-value": true,
  55934. "default-meaning": "geometry will be clipped to map bounds before rendering",
  55935. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  55936. },
  55937. "smooth": {
  55938. "css": "polygon-pattern-smooth",
  55939. "type": "float",
  55940. "default-value": 0,
  55941. "default-meaning": "no smoothing",
  55942. "range": "0-1",
  55943. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  55944. },
  55945. "geometry-transform": {
  55946. "css": "polygon-pattern-geometry-transform",
  55947. "type": "functions",
  55948. "default-value": "none",
  55949. "default-meaning": "geometry will not be transformed",
  55950. "doc": "Allows transformation functions to be applied to the geometry.",
  55951. "functions": [
  55952. ["matrix", 6],
  55953. ["translate", 2],
  55954. ["scale", 2],
  55955. ["rotate", 3],
  55956. ["skewX", 1],
  55957. ["skewY", 1]
  55958. ]
  55959. },
  55960. "comp-op": {
  55961. "css": "polygon-pattern-comp-op",
  55962. "default-value": "src-over",
  55963. "default-meaning": "add the current symbolizer on top of other symbolizer",
  55964. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  55965. "type": ["clear",
  55966. "src",
  55967. "dst",
  55968. "src-over",
  55969. "dst-over",
  55970. "src-in",
  55971. "dst-in",
  55972. "src-out",
  55973. "dst-out",
  55974. "src-atop",
  55975. "dst-atop",
  55976. "xor",
  55977. "plus",
  55978. "minus",
  55979. "multiply",
  55980. "screen",
  55981. "overlay",
  55982. "darken",
  55983. "lighten",
  55984. "color-dodge",
  55985. "color-burn",
  55986. "hard-light",
  55987. "soft-light",
  55988. "difference",
  55989. "exclusion",
  55990. "contrast",
  55991. "invert",
  55992. "invert-rgb",
  55993. "grain-merge",
  55994. "grain-extract",
  55995. "hue",
  55996. "saturation",
  55997. "color",
  55998. "value"
  55999. ]
  56000. }
  56001. },
  56002. "raster": {
  56003. "opacity": {
  56004. "css": "raster-opacity",
  56005. "default-value": 1,
  56006. "default-meaning": "opaque",
  56007. "type": "float",
  56008. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  56009. },
  56010. "filter-factor": {
  56011. "css": "raster-filter-factor",
  56012. "default-value": -1,
  56013. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  56014. "type": "float",
  56015. "doc": "This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."
  56016. },
  56017. "scaling": {
  56018. "css": "raster-scaling",
  56019. "type": [
  56020. "near",
  56021. "fast",
  56022. "bilinear",
  56023. "bilinear8",
  56024. "bicubic",
  56025. "spline16",
  56026. "spline36",
  56027. "hanning",
  56028. "hamming",
  56029. "hermite",
  56030. "kaiser",
  56031. "quadric",
  56032. "catrom",
  56033. "gaussian",
  56034. "bessel",
  56035. "mitchell",
  56036. "sinc",
  56037. "lanczos",
  56038. "blackman"
  56039. ],
  56040. "default-value": "near",
  56041. "doc": "The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."
  56042. },
  56043. "mesh-size": {
  56044. "css": "raster-mesh-size",
  56045. "default-value": 16,
  56046. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  56047. "type": "unsigned",
  56048. "doc": "A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."
  56049. },
  56050. "comp-op": {
  56051. "css": "raster-comp-op",
  56052. "default-value": "src-over",
  56053. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56054. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56055. "type": ["clear",
  56056. "src",
  56057. "dst",
  56058. "src-over",
  56059. "dst-over",
  56060. "src-in",
  56061. "dst-in",
  56062. "src-out",
  56063. "dst-out",
  56064. "src-atop",
  56065. "dst-atop",
  56066. "xor",
  56067. "plus",
  56068. "minus",
  56069. "multiply",
  56070. "screen",
  56071. "overlay",
  56072. "darken",
  56073. "lighten",
  56074. "color-dodge",
  56075. "color-burn",
  56076. "hard-light",
  56077. "soft-light",
  56078. "difference",
  56079. "exclusion",
  56080. "contrast",
  56081. "invert",
  56082. "invert-rgb",
  56083. "grain-merge",
  56084. "grain-extract",
  56085. "hue",
  56086. "saturation",
  56087. "color",
  56088. "value"
  56089. ]
  56090. }
  56091. },
  56092. "point": {
  56093. "file": {
  56094. "css": "point-file",
  56095. "type": "uri",
  56096. "required": false,
  56097. "default-value": "none",
  56098. "doc": "Image file to represent a point"
  56099. },
  56100. "allow-overlap": {
  56101. "css": "point-allow-overlap",
  56102. "type": "boolean",
  56103. "default-value": false,
  56104. "doc": "Control whether overlapping points are shown or hidden.",
  56105. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  56106. },
  56107. "ignore-placement": {
  56108. "css": "point-ignore-placement",
  56109. "type": "boolean",
  56110. "default-value": false,
  56111. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  56112. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  56113. },
  56114. "opacity": {
  56115. "css": "point-opacity",
  56116. "type": "float",
  56117. "default-value": 1.0,
  56118. "default-meaning": "Fully opaque",
  56119. "doc": "A value from 0 to 1 to control the opacity of the point"
  56120. },
  56121. "placement": {
  56122. "css": "point-placement",
  56123. "type": [
  56124. "centroid",
  56125. "interior"
  56126. ],
  56127. "doc": "How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.",
  56128. "default-value": "centroid"
  56129. },
  56130. "transform": {
  56131. "css": "point-transform",
  56132. "type": "functions",
  56133. "functions": [
  56134. ["matrix", 6],
  56135. ["translate", 2],
  56136. ["scale", 2],
  56137. ["rotate", 3],
  56138. ["skewX", 1],
  56139. ["skewY", 1]
  56140. ],
  56141. "default-value": "",
  56142. "default-meaning": "No transformation",
  56143. "doc": "SVG transformation definition"
  56144. },
  56145. "comp-op": {
  56146. "css": "point-comp-op",
  56147. "default-value": "src-over",
  56148. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56149. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56150. "type": ["clear",
  56151. "src",
  56152. "dst",
  56153. "src-over",
  56154. "dst-over",
  56155. "src-in",
  56156. "dst-in",
  56157. "src-out",
  56158. "dst-out",
  56159. "src-atop",
  56160. "dst-atop",
  56161. "xor",
  56162. "plus",
  56163. "minus",
  56164. "multiply",
  56165. "screen",
  56166. "overlay",
  56167. "darken",
  56168. "lighten",
  56169. "color-dodge",
  56170. "color-burn",
  56171. "hard-light",
  56172. "soft-light",
  56173. "difference",
  56174. "exclusion",
  56175. "contrast",
  56176. "invert",
  56177. "invert-rgb",
  56178. "grain-merge",
  56179. "grain-extract",
  56180. "hue",
  56181. "saturation",
  56182. "color",
  56183. "value"
  56184. ]
  56185. }
  56186. },
  56187. "text": {
  56188. "name": {
  56189. "css": "text-name",
  56190. "type": "expression",
  56191. "required": true,
  56192. "default-value": "",
  56193. "serialization": "content",
  56194. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  56195. },
  56196. "face-name": {
  56197. "css": "text-face-name",
  56198. "type": "string",
  56199. "validate": "font",
  56200. "doc": "Font name and style to render a label in",
  56201. "required": true
  56202. },
  56203. "size": {
  56204. "css": "text-size",
  56205. "type": "float",
  56206. "default-value": 10,
  56207. "doc": "Text size in pixels"
  56208. },
  56209. "text-ratio": {
  56210. "css": "text-ratio",
  56211. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  56212. "default-value": 0,
  56213. "type": "unsigned"
  56214. },
  56215. "wrap-width": {
  56216. "css": "text-wrap-width",
  56217. "doc": "Length of a chunk of text in characters before wrapping text",
  56218. "default-value": 0,
  56219. "type": "unsigned"
  56220. },
  56221. "wrap-before": {
  56222. "css": "text-wrap-before",
  56223. "type": "boolean",
  56224. "default-value": false,
  56225. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  56226. },
  56227. "wrap-character": {
  56228. "css": "text-wrap-character",
  56229. "type": "string",
  56230. "default-value": " ",
  56231. "doc": "Use this character instead of a space to wrap long text."
  56232. },
  56233. "spacing": {
  56234. "css": "text-spacing",
  56235. "type": "unsigned",
  56236. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  56237. },
  56238. "character-spacing": {
  56239. "css": "text-character-spacing",
  56240. "type": "float",
  56241. "default-value": 0,
  56242. "doc": "Horizontal spacing adjustment between characters in pixels"
  56243. },
  56244. "line-spacing": {
  56245. "css": "text-line-spacing",
  56246. "default-value": 0,
  56247. "type": "unsigned",
  56248. "doc": "Vertical spacing adjustment between lines in pixels"
  56249. },
  56250. "label-position-tolerance": {
  56251. "css": "text-label-position-tolerance",
  56252. "default-value": 0,
  56253. "type": "unsigned",
  56254. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  56255. },
  56256. "max-char-angle-delta": {
  56257. "css": "text-max-char-angle-delta",
  56258. "type": "float",
  56259. "default-value": "22.5",
  56260. "doc": "The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."
  56261. },
  56262. "fill": {
  56263. "css": "text-fill",
  56264. "doc": "Specifies the color for the text",
  56265. "default-value": "#000000",
  56266. "type": "color"
  56267. },
  56268. "opacity": {
  56269. "css": "text-opacity",
  56270. "doc": "A number from 0 to 1 specifying the opacity for the text",
  56271. "default-value": 1.0,
  56272. "default-meaning": "Fully opaque",
  56273. "type": "float"
  56274. },
  56275. "halo-fill": {
  56276. "css": "text-halo-fill",
  56277. "type": "color",
  56278. "default-value": "#FFFFFF",
  56279. "default-meaning": "white",
  56280. "doc": "Specifies the color of the halo around the text."
  56281. },
  56282. "halo-radius": {
  56283. "css": "text-halo-radius",
  56284. "doc": "Specify the radius of the halo in pixels",
  56285. "default-value": 0,
  56286. "default-meaning": "no halo",
  56287. "type": "float"
  56288. },
  56289. "dx": {
  56290. "css": "text-dx",
  56291. "type": "float",
  56292. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  56293. "default-value": 0
  56294. },
  56295. "dy": {
  56296. "css": "text-dy",
  56297. "type": "float",
  56298. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  56299. "default-value": 0
  56300. },
  56301. "vertical-alignment": {
  56302. "css": "text-vertical-alignment",
  56303. "type": [
  56304. "top",
  56305. "middle",
  56306. "bottom",
  56307. "auto"
  56308. ],
  56309. "doc": "Position of label relative to point position.",
  56310. "default-value": "auto",
  56311. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  56312. },
  56313. "avoid-edges": {
  56314. "css": "text-avoid-edges",
  56315. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  56316. "default-value": false,
  56317. "type": "boolean"
  56318. },
  56319. "minimum-distance": {
  56320. "css": "text-min-distance",
  56321. "doc": "Minimum permitted distance to the next text symbolizer.",
  56322. "type": "float"
  56323. },
  56324. "minimum-padding": {
  56325. "css": "text-min-padding",
  56326. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  56327. "type": "float"
  56328. },
  56329. "minimum-path-length": {
  56330. "css": "text-min-path-length",
  56331. "type": "float",
  56332. "default-value": 0,
  56333. "default-meaning": "place labels on all paths",
  56334. "doc": "Place labels only on paths longer than this value."
  56335. },
  56336. "allow-overlap": {
  56337. "css": "text-allow-overlap",
  56338. "type": "boolean",
  56339. "default-value": false,
  56340. "doc": "Control whether overlapping text is shown or hidden.",
  56341. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  56342. },
  56343. "orientation": {
  56344. "css": "text-orientation",
  56345. "type": "expression",
  56346. "doc": "Rotate the text."
  56347. },
  56348. "placement": {
  56349. "css": "text-placement",
  56350. "type": [
  56351. "point",
  56352. "line",
  56353. "vertex",
  56354. "interior"
  56355. ],
  56356. "default-value": "point",
  56357. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  56358. },
  56359. "placement-type": {
  56360. "css": "text-placement-type",
  56361. "doc": "Re-position and/or re-size text to avoid overlaps. \"simple\" for basic algorithm (using text-placements string,) \"dummy\" to turn this feature off.",
  56362. "type": [
  56363. "dummy",
  56364. "simple"
  56365. ],
  56366. "default-value": "dummy"
  56367. },
  56368. "placements": {
  56369. "css": "text-placements",
  56370. "type": "string",
  56371. "default-value": "",
  56372. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  56373. },
  56374. "text-transform": {
  56375. "css": "text-transform",
  56376. "type": [
  56377. "none",
  56378. "uppercase",
  56379. "lowercase",
  56380. "capitalize"
  56381. ],
  56382. "doc": "Transform the case of the characters",
  56383. "default-value": "none"
  56384. },
  56385. "horizontal-alignment": {
  56386. "css": "text-horizontal-alignment",
  56387. "type": [
  56388. "left",
  56389. "middle",
  56390. "right",
  56391. "auto"
  56392. ],
  56393. "doc": "The text's horizontal alignment from its centerpoint",
  56394. "default-value": "auto"
  56395. },
  56396. "justify-alignment": {
  56397. "css": "text-align",
  56398. "type": [
  56399. "left",
  56400. "right",
  56401. "center",
  56402. "auto"
  56403. ],
  56404. "doc": "Define how text is justified",
  56405. "default-value": "auto",
  56406. "default-meaning": "Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"
  56407. },
  56408. "clip": {
  56409. "css": "text-clip",
  56410. "type": "boolean",
  56411. "default-value": true,
  56412. "default-meaning": "geometry will be clipped to map bounds before rendering",
  56413. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  56414. },
  56415. "comp-op": {
  56416. "css": "text-comp-op",
  56417. "default-value": "src-over",
  56418. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56419. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56420. "type": ["clear",
  56421. "src",
  56422. "dst",
  56423. "src-over",
  56424. "dst-over",
  56425. "src-in",
  56426. "dst-in",
  56427. "src-out",
  56428. "dst-out",
  56429. "src-atop",
  56430. "dst-atop",
  56431. "xor",
  56432. "plus",
  56433. "minus",
  56434. "multiply",
  56435. "screen",
  56436. "overlay",
  56437. "darken",
  56438. "lighten",
  56439. "color-dodge",
  56440. "color-burn",
  56441. "hard-light",
  56442. "soft-light",
  56443. "difference",
  56444. "exclusion",
  56445. "contrast",
  56446. "invert",
  56447. "invert-rgb",
  56448. "grain-merge",
  56449. "grain-extract",
  56450. "hue",
  56451. "saturation",
  56452. "color",
  56453. "value"
  56454. ]
  56455. }
  56456. },
  56457. "building": {
  56458. "fill": {
  56459. "css": "building-fill",
  56460. "default-value": "#FFFFFF",
  56461. "doc": "The color of the buildings walls.",
  56462. "type": "color"
  56463. },
  56464. "fill-opacity": {
  56465. "css": "building-fill-opacity",
  56466. "type": "float",
  56467. "doc": "The opacity of the building as a whole, including all walls.",
  56468. "default-value": 1
  56469. },
  56470. "height": {
  56471. "css": "building-height",
  56472. "doc": "The height of the building in pixels.",
  56473. "type": "expression",
  56474. "default-value": "0"
  56475. }
  56476. }
  56477. },
  56478. "colors": {
  56479. "aliceblue": [240, 248, 255],
  56480. "antiquewhite": [250, 235, 215],
  56481. "aqua": [0, 255, 255],
  56482. "aquamarine": [127, 255, 212],
  56483. "azure": [240, 255, 255],
  56484. "beige": [245, 245, 220],
  56485. "bisque": [255, 228, 196],
  56486. "black": [0, 0, 0],
  56487. "blanchedalmond": [255, 235, 205],
  56488. "blue": [0, 0, 255],
  56489. "blueviolet": [138, 43, 226],
  56490. "brown": [165, 42, 42],
  56491. "burlywood": [222, 184, 135],
  56492. "cadetblue": [95, 158, 160],
  56493. "chartreuse": [127, 255, 0],
  56494. "chocolate": [210, 105, 30],
  56495. "coral": [255, 127, 80],
  56496. "cornflowerblue": [100, 149, 237],
  56497. "cornsilk": [255, 248, 220],
  56498. "crimson": [220, 20, 60],
  56499. "cyan": [0, 255, 255],
  56500. "darkblue": [0, 0, 139],
  56501. "darkcyan": [0, 139, 139],
  56502. "darkgoldenrod": [184, 134, 11],
  56503. "darkgray": [169, 169, 169],
  56504. "darkgreen": [0, 100, 0],
  56505. "darkgrey": [169, 169, 169],
  56506. "darkkhaki": [189, 183, 107],
  56507. "darkmagenta": [139, 0, 139],
  56508. "darkolivegreen": [85, 107, 47],
  56509. "darkorange": [255, 140, 0],
  56510. "darkorchid": [153, 50, 204],
  56511. "darkred": [139, 0, 0],
  56512. "darksalmon": [233, 150, 122],
  56513. "darkseagreen": [143, 188, 143],
  56514. "darkslateblue": [72, 61, 139],
  56515. "darkslategrey": [47, 79, 79],
  56516. "darkturquoise": [0, 206, 209],
  56517. "darkviolet": [148, 0, 211],
  56518. "deeppink": [255, 20, 147],
  56519. "deepskyblue": [0, 191, 255],
  56520. "dimgray": [105, 105, 105],
  56521. "dimgrey": [105, 105, 105],
  56522. "dodgerblue": [30, 144, 255],
  56523. "firebrick": [178, 34, 34],
  56524. "floralwhite": [255, 250, 240],
  56525. "forestgreen": [34, 139, 34],
  56526. "fuchsia": [255, 0, 255],
  56527. "gainsboro": [220, 220, 220],
  56528. "ghostwhite": [248, 248, 255],
  56529. "gold": [255, 215, 0],
  56530. "goldenrod": [218, 165, 32],
  56531. "gray": [128, 128, 128],
  56532. "grey": [128, 128, 128],
  56533. "green": [0, 128, 0],
  56534. "greenyellow": [173, 255, 47],
  56535. "honeydew": [240, 255, 240],
  56536. "hotpink": [255, 105, 180],
  56537. "indianred": [205, 92, 92],
  56538. "indigo": [75, 0, 130],
  56539. "ivory": [255, 255, 240],
  56540. "khaki": [240, 230, 140],
  56541. "lavender": [230, 230, 250],
  56542. "lavenderblush": [255, 240, 245],
  56543. "lawngreen": [124, 252, 0],
  56544. "lemonchiffon": [255, 250, 205],
  56545. "lightblue": [173, 216, 230],
  56546. "lightcoral": [240, 128, 128],
  56547. "lightcyan": [224, 255, 255],
  56548. "lightgoldenrodyellow": [250, 250, 210],
  56549. "lightgray": [211, 211, 211],
  56550. "lightgreen": [144, 238, 144],
  56551. "lightgrey": [211, 211, 211],
  56552. "lightpink": [255, 182, 193],
  56553. "lightsalmon": [255, 160, 122],
  56554. "lightseagreen": [32, 178, 170],
  56555. "lightskyblue": [135, 206, 250],
  56556. "lightslategray": [119, 136, 153],
  56557. "lightslategrey": [119, 136, 153],
  56558. "lightsteelblue": [176, 196, 222],
  56559. "lightyellow": [255, 255, 224],
  56560. "lime": [0, 255, 0],
  56561. "limegreen": [50, 205, 50],
  56562. "linen": [250, 240, 230],
  56563. "magenta": [255, 0, 255],
  56564. "maroon": [128, 0, 0],
  56565. "mediumaquamarine": [102, 205, 170],
  56566. "mediumblue": [0, 0, 205],
  56567. "mediumorchid": [186, 85, 211],
  56568. "mediumpurple": [147, 112, 219],
  56569. "mediumseagreen": [60, 179, 113],
  56570. "mediumslateblue": [123, 104, 238],
  56571. "mediumspringgreen": [0, 250, 154],
  56572. "mediumturquoise": [72, 209, 204],
  56573. "mediumvioletred": [199, 21, 133],
  56574. "midnightblue": [25, 25, 112],
  56575. "mintcream": [245, 255, 250],
  56576. "mistyrose": [255, 228, 225],
  56577. "moccasin": [255, 228, 181],
  56578. "navajowhite": [255, 222, 173],
  56579. "navy": [0, 0, 128],
  56580. "oldlace": [253, 245, 230],
  56581. "olive": [128, 128, 0],
  56582. "olivedrab": [107, 142, 35],
  56583. "orange": [255, 165, 0],
  56584. "orangered": [255, 69, 0],
  56585. "orchid": [218, 112, 214],
  56586. "palegoldenrod": [238, 232, 170],
  56587. "palegreen": [152, 251, 152],
  56588. "paleturquoise": [175, 238, 238],
  56589. "palevioletred": [219, 112, 147],
  56590. "papayawhip": [255, 239, 213],
  56591. "peachpuff": [255, 218, 185],
  56592. "peru": [205, 133, 63],
  56593. "pink": [255, 192, 203],
  56594. "plum": [221, 160, 221],
  56595. "powderblue": [176, 224, 230],
  56596. "purple": [128, 0, 128],
  56597. "red": [255, 0, 0],
  56598. "rosybrown": [188, 143, 143],
  56599. "royalblue": [65, 105, 225],
  56600. "saddlebrown": [139, 69, 19],
  56601. "salmon": [250, 128, 114],
  56602. "sandybrown": [244, 164, 96],
  56603. "seagreen": [46, 139, 87],
  56604. "seashell": [255, 245, 238],
  56605. "sienna": [160, 82, 45],
  56606. "silver": [192, 192, 192],
  56607. "skyblue": [135, 206, 235],
  56608. "slateblue": [106, 90, 205],
  56609. "slategray": [112, 128, 144],
  56610. "slategrey": [112, 128, 144],
  56611. "snow": [255, 250, 250],
  56612. "springgreen": [0, 255, 127],
  56613. "steelblue": [70, 130, 180],
  56614. "tan": [210, 180, 140],
  56615. "teal": [0, 128, 128],
  56616. "thistle": [216, 191, 216],
  56617. "tomato": [255, 99, 71],
  56618. "turquoise": [64, 224, 208],
  56619. "violet": [238, 130, 238],
  56620. "wheat": [245, 222, 179],
  56621. "white": [255, 255, 255],
  56622. "whitesmoke": [245, 245, 245],
  56623. "yellow": [255, 255, 0],
  56624. "yellowgreen": [154, 205, 50],
  56625. "transparent": [0, 0, 0, 0]
  56626. },
  56627. "filter": {
  56628. "value": [
  56629. "true",
  56630. "false",
  56631. "null",
  56632. "point",
  56633. "linestring",
  56634. "polygon",
  56635. "collection"
  56636. ]
  56637. }
  56638. };
  56639. CartoCSS['mapnik_reference'] = {
  56640. version: {
  56641. latest: _mapnik_reference_latest,
  56642. '2.1.1': _mapnik_reference_latest
  56643. }
  56644. };
  56645. CartoCSS.Tree = {};
  56646. CartoCSS.Tree.operate = function(op, a, b) {
  56647. switch (op) {
  56648. case '+': return a + b;
  56649. case '-': return a - b;
  56650. case '*': return a * b;
  56651. case '%': return a % b;
  56652. case '/': return a / b;
  56653. }
  56654. };
  56655. CartoCSS.Tree.functions = {
  56656. rgb: function (r, g, b) {
  56657. return this.rgba(r, g, b, 1.0);
  56658. },
  56659. rgba: function (r, g, b, a) {
  56660. var me = this;
  56661. var rgb = [r, g, b].map(function (c) {
  56662. return me.number(c);
  56663. });
  56664. a = me.number(a);
  56665. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  56666. return new CartoCSS.Tree.Color(rgb, a);
  56667. },
  56668. // Only require val
  56669. stop: function (val) {
  56670. var color, mode;
  56671. if (arguments.length > 1) {color = arguments[1];}
  56672. if (arguments.length > 2) {mode = arguments[2];}
  56673. return {
  56674. is: 'tag',
  56675. val: val,
  56676. color: color,
  56677. mode: mode,
  56678. toString(env) {
  56679. return '\n\t<stop value="' + val.ev(env) + '"' +
  56680. (color ? ' color="' + color.ev(env) + '" ' : '') +
  56681. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  56682. '/>';
  56683. }
  56684. };
  56685. },
  56686. hsl: function (h, s, l) {
  56687. return this.hsla(h, s, l, 1.0);
  56688. },
  56689. hsla: function (h, s, l, a) {
  56690. h = (this.number(h) % 360) / 360;
  56691. s = this.number(s);
  56692. l = this.number(l);
  56693. a = this.number(a);
  56694. if ([h, s, l, a].some(isNaN)) {return null;}
  56695. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  56696. m1 = l * 2 - m2;
  56697. return this.rgba(hue(h + 1 / 3) * 255,
  56698. hue(h) * 255,
  56699. hue(h - 1 / 3) * 255,
  56700. a);
  56701. function hue(h) {
  56702. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  56703. if (h * 6 < 1) {return m1 + (m2 - m1) * h * 6;} else if (h * 2 < 1) {return m2;} else if (h * 3 < 2) {return m1 + (m2 - m1) * (2 / 3 - h) * 6;} else {return m1;}
  56704. }
  56705. },
  56706. hue: function (color) {
  56707. if (!('toHSL' in color)) {return null;}
  56708. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  56709. },
  56710. saturation: function (color) {
  56711. if (!('toHSL' in color)) {return null;}
  56712. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  56713. },
  56714. lightness: function (color) {
  56715. if (!('toHSL' in color)) {return null;}
  56716. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  56717. },
  56718. alpha: function (color) {
  56719. if (!('toHSL' in color)) {return null;}
  56720. return new CartoCSS.Tree.Dimension(color.toHSL().a);
  56721. },
  56722. saturate: function (color, amount) {
  56723. if (!('toHSL' in color)) {return null;}
  56724. var hsl = color.toHSL();
  56725. hsl.s += amount.value / 100;
  56726. hsl.s = this.clamp(hsl.s);
  56727. return this.hsla_simple(hsl);
  56728. },
  56729. desaturate: function (color, amount) {
  56730. if (!('toHSL' in color)) {return null;}
  56731. var hsl = color.toHSL();
  56732. hsl.s -= amount.value / 100;
  56733. hsl.s = this.clamp(hsl.s);
  56734. return this.hsla_simple(hsl);
  56735. },
  56736. lighten: function (color, amount) {
  56737. if (!('toHSL' in color)) {return null;}
  56738. var hsl = color.toHSL();
  56739. hsl.l += amount.value / 100;
  56740. hsl.l = this.clamp(hsl.l);
  56741. return this.hsla_simple(hsl);
  56742. },
  56743. darken: function (color, amount) {
  56744. if (!('toHSL' in color)) {return null;}
  56745. var hsl = color.toHSL();
  56746. hsl.l -= amount.value / 100;
  56747. hsl.l = this.clamp(hsl.l);
  56748. return this.hsla_simple(hsl);
  56749. },
  56750. fadein: function (color, amount) {
  56751. if (!('toHSL' in color)) {return null;}
  56752. var hsl = color.toHSL();
  56753. hsl.a += amount.value / 100;
  56754. hsl.a = this.clamp(hsl.a);
  56755. return this.hsla_simple(hsl);
  56756. },
  56757. fadeout: function (color, amount) {
  56758. if (!('toHSL' in color)) {return null;}
  56759. var hsl = color.toHSL();
  56760. hsl.a -= amount.value / 100;
  56761. hsl.a = this.clamp(hsl.a);
  56762. return this.hsla_simple(hsl);
  56763. },
  56764. spin: function (color, amount) {
  56765. if (!('toHSL' in color)) {return null;}
  56766. var hsl = color.toHSL();
  56767. var hue = (hsl.h + amount.value) % 360;
  56768. hsl.h = hue < 0 ? 360 + hue : hue;
  56769. return this.hsla_simple(hsl);
  56770. },
  56771. replace: function (entity, a, b) {
  56772. if (entity.is === 'field') {
  56773. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  56774. } else {
  56775. return entity.replace(a, b);
  56776. }
  56777. },
  56778. //
  56779. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  56780. // http://sass-lang.com
  56781. //
  56782. mix: function (color1, color2, weight) {
  56783. var p = weight.value / 100.0;
  56784. var w = p * 2 - 1;
  56785. var a = color1.toHSL().a - color2.toHSL().a;
  56786. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  56787. var w2 = 1 - w1;
  56788. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  56789. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  56790. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  56791. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  56792. return new CartoCSS.Tree.Color(rgb, alpha);
  56793. },
  56794. greyscale: function (color) {
  56795. return this.desaturate(color, new CartoCSS.Tree.Dimension(100));
  56796. },
  56797. '%': function (quoted /* arg, arg, ...*/) {
  56798. var args = Array.prototype.slice.call(arguments, 1),
  56799. str = quoted.value;
  56800. for (var i = 0; i < args.length; i++) {
  56801. str = str.replace(/%s/, args[i].value)
  56802. .replace(/%[da]/, args[i].toString());
  56803. }
  56804. str = str.replace(/%%/g, '%');
  56805. return new CartoCSS.Tree.Quoted(str);
  56806. },
  56807. hsla_simple: function (h) {
  56808. return this.hsla(h.h, h.s, h.l, h.a);
  56809. },
  56810. number: function (n) {
  56811. if (n instanceof CartoCSS.Tree.Dimension) {
  56812. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  56813. } else if (typeof(n) === 'number') {
  56814. return n;
  56815. } else {
  56816. return NaN;
  56817. }
  56818. },
  56819. clamp: function (val) {
  56820. return Math.min(1, Math.max(0, val));
  56821. }
  56822. };
  56823. CartoCSS.Tree.Call = class Call {
  56824. constructor(name, args, index) {
  56825. this.is = 'call';
  56826. this.name = name;
  56827. this.args = args;
  56828. this.index = index;
  56829. }
  56830. // When evuating a function call,
  56831. // we either find the function in `tree.functions` [1],
  56832. // in which case we call it, passing the evaluated arguments,
  56833. // or we simply print it out as it appeared originally [2].
  56834. // The *functions.js* file contains the built-in functions.
  56835. // The reason why we evaluate the arguments, is in the case where
  56836. // we try to pass a variable to a function, like: `saturate(@color)`.
  56837. // The function should receive the value, not the variable.
  56838. 'ev'(env) {
  56839. var args = this.args.map(function (a) {
  56840. return a.ev(env);
  56841. });
  56842. for (var i = 0; i < args.length; i++) {
  56843. if (args[i].is === 'undefined') {
  56844. return {
  56845. is: 'undefined',
  56846. value: 'undefined'
  56847. };
  56848. }
  56849. }
  56850. if (this.name in CartoCSS.Tree.functions) {
  56851. if (CartoCSS.Tree.functions[this.name].length <= args.length) {
  56852. var val = CartoCSS.Tree.functions[this.name].apply(CartoCSS.Tree.functions, args);
  56853. if (val === null) {
  56854. env.error({
  56855. message: 'incorrect arguments given to ' + this.name + '()',
  56856. index: this.index,
  56857. type: 'runtime',
  56858. filename: this.filename
  56859. });
  56860. return {is: 'undefined', value: 'undefined'};
  56861. }
  56862. return val;
  56863. } else {
  56864. env.error({
  56865. message: 'incorrect number of arguments for ' + this.name +
  56866. '(). ' + CartoCSS.Tree.functions[this.name].length + ' expected.',
  56867. index: this.index,
  56868. type: 'runtime',
  56869. filename: this.filename
  56870. });
  56871. return {
  56872. is: 'undefined',
  56873. value: 'undefined'
  56874. };
  56875. }
  56876. } else {
  56877. var fn = CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  56878. if (fn === undefined) {
  56879. var functions = lodash_topairs_default()(CartoCSS.Tree.Reference.mapnikFunctions);
  56880. // cheap closest, needs improvement.
  56881. var name = this.name;
  56882. var mean = functions.map(function (f) {
  56883. return [f[0], CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  56884. }).sort(function (a, b) {
  56885. return a[1] - b[1];
  56886. });
  56887. env.error({
  56888. message: 'unknown function ' + this.name + '(), did you mean ' +
  56889. mean[0][0] + '(' + mean[0][2] + ')',
  56890. index: this.index,
  56891. type: 'runtime',
  56892. filename: this.filename
  56893. });
  56894. return {
  56895. is: 'undefined',
  56896. value: 'undefined'
  56897. };
  56898. }
  56899. if (fn !== args.length &&
  56900. // support variable-arg functions like `colorize-alpha`
  56901. fn !== -1) {
  56902. env.error({
  56903. message: 'function ' + this.name + '() takes ' +
  56904. fn + ' arguments and was given ' + args.length,
  56905. index: this.index,
  56906. type: 'runtime',
  56907. filename: this.filename
  56908. });
  56909. return {
  56910. is: 'undefined',
  56911. value: 'undefined'
  56912. };
  56913. } else {
  56914. // Save the evaluated versions of arguments
  56915. this.args = args;
  56916. return this;
  56917. }
  56918. }
  56919. }
  56920. toString(env, format) {
  56921. if (this.args.length) {
  56922. return this.name + '(' + this.args.join(',') + ')';
  56923. } else {
  56924. return this.name;
  56925. }
  56926. }
  56927. };
  56928. CartoCSS.Tree.Color = class Color {
  56929. constructor(rgb, a) {
  56930. this.is = 'color';
  56931. // The end goal here, is to parse the arguments
  56932. // into an integer triplet, such as `128, 255, 0`
  56933. //
  56934. // This facilitates operations and conversions.
  56935. if (Array.isArray(rgb)) {
  56936. this.rgb = rgb.slice(0, 3);
  56937. } else if (rgb.length == 6) {
  56938. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  56939. return parseInt(c, 16);
  56940. });
  56941. } else {
  56942. this.rgb = rgb.split('').map(function (c) {
  56943. return parseInt(c + c, 16);
  56944. });
  56945. }
  56946. if (typeof(a) === 'number') {
  56947. this.alpha = a;
  56948. } else if (rgb.length === 4) {
  56949. this.alpha = rgb[3];
  56950. } else {
  56951. this.alpha = 1;
  56952. }
  56953. }
  56954. 'ev'() {
  56955. return this;
  56956. }
  56957. // If we have some transparency, the only way to represent it
  56958. // is via `rgba`. Otherwise, we use the hex representation,
  56959. // which has better compatibility with older browsers.
  56960. // Values are capped between `0` and `255`, rounded and zero-padded.
  56961. toString() {
  56962. /* if (this.alpha < 1.0) {*/
  56963. return 'rgba(' + this.rgb.map(function (c) {
  56964. return Math.round(c);
  56965. }).concat(this.alpha).join(', ') + ')';
  56966. /*} else {
  56967. return '#' + this.rgb.map(function(i) {
  56968. i = Math.round(i);
  56969. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  56970. return i.length === 1 ? '0' + i : i;
  56971. }).join('');
  56972. }*/
  56973. }
  56974. // Operations have to be done per-channel, if not,
  56975. // channels will spill onto each other. Once we have
  56976. // our result, in the form of an integer triplet,
  56977. // we create a new Color node to hold the result.
  56978. operate(env, op, other) {
  56979. var result = [];
  56980. if (!(other instanceof CartoCSS.Tree.Color)) {
  56981. other = other.toColor();
  56982. }
  56983. for (var c = 0; c < 3; c++) {
  56984. result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  56985. }
  56986. return new CartoCSS.Tree.Color(result);
  56987. }
  56988. toHSL() {
  56989. var r = this.rgb[0] / 255,
  56990. g = this.rgb[1] / 255,
  56991. b = this.rgb[2] / 255,
  56992. a = this.alpha;
  56993. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  56994. var h, s, l = (max + min) / 2, d = max - min;
  56995. if (max === min) {
  56996. h = s = 0;
  56997. } else {
  56998. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  56999. switch (max) {
  57000. case r:
  57001. h = (g - b) / d + (g < b ? 6 : 0);
  57002. break;
  57003. case g:
  57004. h = (b - r) / d + 2;
  57005. break;
  57006. case b:
  57007. h = (r - g) / d + 4;
  57008. break;
  57009. default:
  57010. break;
  57011. }
  57012. h /= 6;
  57013. }
  57014. return {h: h * 360, s: s, l: l, a: a};
  57015. }
  57016. };
  57017. CartoCSS.Tree.Comment = class Comment {
  57018. constructor(value, silent) {
  57019. this.value = value;
  57020. this.silent = !!silent;
  57021. }
  57022. toString(env) {
  57023. return '<!--' + this.value + '-->';
  57024. }
  57025. 'ev'() {
  57026. return this;
  57027. }
  57028. };
  57029. CartoCSS.Tree.Definition = class Definition {
  57030. constructor(selector, rules) {
  57031. this.elements = selector.elements;
  57032. //assert.ok(selector.filters instanceof CartoCSS.Tree.Filterset);
  57033. this.rules = rules;
  57034. this.ruleIndex = {};
  57035. for (var i = 0; i < this.rules.length; i++) {
  57036. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  57037. this.rules[i].zoom = selector.zoom;
  57038. this.ruleIndex[this.rules[i].updateID()] = true;
  57039. }
  57040. this.filters = selector.filters;
  57041. this.zoom = selector.zoom;
  57042. this.attachment = selector.attachment || '__default__';
  57043. this.specificity = selector.specificity();
  57044. }
  57045. toString() {
  57046. var str = this.filters.toString();
  57047. for (var i = 0; i < this.rules.length; i++) {
  57048. str += '\n ' + this.rules[i];
  57049. }
  57050. return str;
  57051. }
  57052. toJS(env) {
  57053. var shaderAttrs = {};
  57054. // merge conditions from filters with zoom condition of the
  57055. // definition
  57056. var zoom = this.zoom;
  57057. //var frame_offset = this.frame_offset;
  57058. var _if = this.filters.toJS(env);
  57059. var filters = [zoom];
  57060. if (_if) {filters.push(_if);}
  57061. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  57062. _if = filters.join(" && ");
  57063. function eachRule(rule) {
  57064. if (rule instanceof CartoCSS.Tree.Rule) {
  57065. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  57066. if (_if) {
  57067. shaderAttrs[rule.name].push(
  57068. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  57069. );
  57070. } else {
  57071. shaderAttrs[rule.name].push(rule.value.toJS(env));
  57072. }
  57073. } else {
  57074. if (rule instanceof CartoCSS.Tree.Ruleset) {
  57075. var sh = rule.toJS(env);
  57076. for (var v in sh) {
  57077. shaderAttrs[v] = shaderAttrs[v] || [];
  57078. for (var attr in sh[v]) {
  57079. shaderAttrs[v].push(sh[v][attr]);
  57080. }
  57081. }
  57082. }
  57083. }
  57084. }
  57085. for (var id in this.rules) {
  57086. eachRule(this.rules[id]);
  57087. }
  57088. return shaderAttrs;
  57089. }
  57090. };
  57091. CartoCSS.Tree.Dimension = class Dimension {
  57092. constructor(value, unit, index) {
  57093. this.is = 'float';
  57094. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  57095. this.screen_units = ['px', '%'];
  57096. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  57097. this.densities = {
  57098. m: 0.0254,
  57099. mm: 25.4,
  57100. cm: 2.54,
  57101. pt: 72,
  57102. pc: 6
  57103. };
  57104. this.value = parseFloat(value);
  57105. this.unit = unit || null;
  57106. this.index = index;
  57107. }
  57108. ev(env) {
  57109. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  57110. env.error({
  57111. message: "Invalid unit: '" + this.unit + "'",
  57112. index: this.index
  57113. });
  57114. return {is: 'undefined', value: 'undefined'};
  57115. }
  57116. // normalize units which are not px or %
  57117. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  57118. if (!env.ppi) {
  57119. env.error({
  57120. message: "ppi is not set, so metric units can't be used",
  57121. index: this.index
  57122. });
  57123. return {is: 'undefined', value: 'undefined'};
  57124. }
  57125. // convert all units to inch
  57126. // convert inch to px using ppi
  57127. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  57128. this.unit = 'px';
  57129. }
  57130. return this;
  57131. }
  57132. toColor() {
  57133. return new CartoCSS.Tree.Color([this.value, this.value, this.value]);
  57134. }
  57135. round() {
  57136. this.value = Math.round(this.value);
  57137. return this;
  57138. }
  57139. toString() {
  57140. return this.value.toString();
  57141. }
  57142. operate(env, op, other) {
  57143. if (this.unit === '%' && other.unit !== '%') {
  57144. env.error({
  57145. message: 'If two operands differ, the first must not be %',
  57146. index: this.index
  57147. });
  57148. return {
  57149. is: 'undefined',
  57150. value: 'undefined'
  57151. };
  57152. }
  57153. if (this.unit !== '%' && other.unit === '%') {
  57154. if (op === '*' || op === '/' || op === '%') {
  57155. env.error({
  57156. message: 'Percent values can only be added or subtracted from other values',
  57157. index: this.index
  57158. });
  57159. return {
  57160. is: 'undefined',
  57161. value: 'undefined'
  57162. };
  57163. }
  57164. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op,
  57165. this.value, this.value * other.value * 0.01),
  57166. this.unit);
  57167. }
  57168. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  57169. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op, this.value, other.value),
  57170. this.unit || other.unit);
  57171. }
  57172. };
  57173. CartoCSS.Tree.Element = class Element {
  57174. constructor(value) {
  57175. this.value = value.trim();
  57176. if (this.value[0] === '#') {
  57177. this.type = 'id';
  57178. this.clean = this.value.replace(/^#/, '');
  57179. }
  57180. if (this.value[0] === '.') {
  57181. this.type = 'class';
  57182. this.clean = this.value.replace(/^\./, '');
  57183. }
  57184. if (this.value.indexOf('*') !== -1) {
  57185. this.type = 'wildcard';
  57186. }
  57187. }
  57188. specificity() {
  57189. return [
  57190. (this.type === 'id') ? 1 : 0, // a
  57191. (this.type === 'class') ? 1 : 0 // b
  57192. ];
  57193. }
  57194. toString() {
  57195. return this.value;
  57196. }
  57197. };
  57198. CartoCSS.Tree.Expression = class Expression {
  57199. constructor(value) {
  57200. this.is = 'expression';
  57201. this.value = value;
  57202. }
  57203. ev(env) {
  57204. if (this.value.length > 1) {
  57205. return new CartoCSS.Tree.Expression(this.value.map(function (e) {
  57206. return e.ev(env);
  57207. }));
  57208. } else {
  57209. return this.value[0].ev(env);
  57210. }
  57211. }
  57212. toString(env) {
  57213. return this.value.map(function (e) {
  57214. return e.toString(env);
  57215. }).join(' ');
  57216. }
  57217. };
  57218. CartoCSS.Tree.Field = class Field {
  57219. constructor(content) {
  57220. this.is = 'field';
  57221. this.value = content || '';
  57222. }
  57223. toString() {
  57224. return '["' + this.value.toUpperCase() + '"]';
  57225. }
  57226. 'ev'() {
  57227. return this;
  57228. }
  57229. };
  57230. CartoCSS.Tree.Filter = class Filter {
  57231. constructor(key, op, val, index, filename) {
  57232. this.ops = {
  57233. '<': [' &lt; ', 'numeric'],
  57234. '>': [' &gt; ', 'numeric'],
  57235. '=': [' = ', 'both'],
  57236. '!=': [' != ', 'both'],
  57237. '<=': [' &lt;= ', 'numeric'],
  57238. '>=': [' &gt;= ', 'numeric'],
  57239. '=~': ['.match(', 'string', ')']
  57240. };
  57241. this.key = key;
  57242. this.op = op;
  57243. this.val = val;
  57244. this.index = index;
  57245. this.filename = filename;
  57246. this.id = this.key + this.op + this.val;
  57247. }
  57248. ev(env) {
  57249. this.key = this.key.ev(env);
  57250. this.val = this.val.ev(env);
  57251. return this;
  57252. }
  57253. toString() {
  57254. return '[' + this.id + ']';
  57255. }
  57256. };
  57257. CartoCSS.Tree.Filterset = class Filterset {
  57258. constructor() {
  57259. this.filters = {};
  57260. }
  57261. toJS(env) {
  57262. function eachFilter(filter) {
  57263. var op = filter.op;
  57264. if (op === "=") {
  57265. op = "==";
  57266. }
  57267. var val = filter.val;
  57268. if (filter._val !== undefined) {
  57269. val = filter._val.toString(true);
  57270. }
  57271. //对scale进行特殊处理,将值转换成数值
  57272. if (filter.key && filter.key.value === 'scale') {
  57273. val = +val;
  57274. } else if (typeof val === 'string' || typeof val === 'object') {
  57275. val = "'" + val + "'";
  57276. }
  57277. var attrs = "attributes";
  57278. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  57279. }
  57280. var results = [];
  57281. for (var id in this.filters) {
  57282. results.push(eachFilter(this.filters[id]));
  57283. }
  57284. return results.join(' && ');
  57285. }
  57286. toString() {
  57287. var arr = [];
  57288. for (var id in this.filters) {arr.push(this.filters[id].id);}
  57289. return arr.sort().join('\t');
  57290. }
  57291. ev(env) {
  57292. for (var i in this.filters) {
  57293. this.filters[i].ev(env);
  57294. }
  57295. return this;
  57296. }
  57297. clone() {
  57298. var clone = new CartoCSS.Tree.Filterset();
  57299. for (var id in this.filters) {
  57300. clone.filters[id] = this.filters[id];
  57301. }
  57302. return clone;
  57303. }
  57304. cloneWith(other) {
  57305. var additions = [];
  57306. for (var id in other.filters) {
  57307. var status = this.addable(other.filters[id]);
  57308. // status is true, false or null. if it's null we don't fail this
  57309. // clone nor do we add the filter.
  57310. if (status === false) {
  57311. return false;
  57312. }
  57313. if (status === true) {
  57314. // Adding the filter will override another value.
  57315. additions.push(other.filters[id]);
  57316. }
  57317. }
  57318. // Adding the other filters doesn't make this filterset invalid, but it
  57319. // doesn't add anything to it either.
  57320. if (!additions.length) {
  57321. return null;
  57322. }
  57323. // We can successfully add all filters. Now clone the filterset and add the
  57324. // new rules.
  57325. var clone = new CartoCSS.Tree.Filterset();
  57326. // We can add the rules that are already present without going through the
  57327. // add function as a Filterset is always in it's simplest canonical form.
  57328. for (id in this.filters) {
  57329. clone.filters[id] = this.filters[id];
  57330. }
  57331. // Only add new filters that actually change the filter.
  57332. while (id = additions.shift()) {
  57333. clone.add(id);
  57334. }
  57335. return clone;
  57336. }
  57337. addable(filter) {
  57338. var key = filter.key.toString(),
  57339. value = filter.val.toString();
  57340. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  57341. switch (filter.op) {
  57342. case '=':
  57343. // if there is already foo= and we're adding foo=
  57344. if (this.filters[key + '='] !== undefined) {
  57345. if (this.filters[key + '='].val.toString() != value) {
  57346. return false;
  57347. } else {
  57348. return null;
  57349. }
  57350. }
  57351. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  57352. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  57353. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  57354. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  57355. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  57356. return true;
  57357. case '=~':
  57358. return true;
  57359. case '!=':
  57360. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  57361. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  57362. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  57363. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  57364. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  57365. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  57366. return true;
  57367. case '>':
  57368. if (key + '=' in this.filters) {
  57369. if (this.filters[key + '='].val <= value) {
  57370. return false;
  57371. } else {
  57372. return null;
  57373. }
  57374. }
  57375. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  57376. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  57377. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  57378. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  57379. return true;
  57380. case '>=':
  57381. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  57382. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  57383. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  57384. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  57385. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  57386. return true;
  57387. case '<':
  57388. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  57389. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  57390. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  57391. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  57392. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  57393. return true;
  57394. case '<=':
  57395. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  57396. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  57397. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  57398. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  57399. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  57400. return true;
  57401. default:
  57402. break;
  57403. }
  57404. }
  57405. conflict(filter) {
  57406. var key = filter.key.toString(),
  57407. value = filter.val.toString();
  57408. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  57409. // if (a=b) && (a=c)
  57410. // if (a=b) && (a!=b)
  57411. // or (a!=b) && (a=b)
  57412. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  57413. value != this.filters[key + '='].val.toString()) ||
  57414. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  57415. value == this.filters[key + '='].val.toString()) ||
  57416. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  57417. value === this.filters[key + '!='].val.toString())) {
  57418. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  57419. }
  57420. return false;
  57421. }
  57422. add(filter, env) {
  57423. var key = filter.key.toString(),
  57424. op = filter.op,
  57425. conflict = this.conflict(filter),
  57426. numval;
  57427. if (conflict) {return conflict;}
  57428. if (op === '=') {
  57429. for (var i in this.filters) {
  57430. if (this.filters[i].key === key) {delete this.filters[i];}
  57431. }
  57432. this.filters[key + '='] = filter;
  57433. } else if (op === '!=') {
  57434. this.filters[key + '!=' + filter.val] = filter;
  57435. } else if (op === '=~') {
  57436. this.filters[key + '=~' + filter.val] = filter;
  57437. } else if (op === '>') {
  57438. // If there are other filters that are also >
  57439. // but are less than this one, they don't matter, so
  57440. // remove them.
  57441. for (var j in this.filters) {
  57442. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  57443. delete this.filters[j];
  57444. }
  57445. }
  57446. this.filters[key + '>'] = filter;
  57447. } else if (op === '>=') {
  57448. for (var k in this.filters) {
  57449. numval = (+this.filters[k].val.toString());
  57450. if (this.filters[k].key === key && numval < filter.val) {
  57451. delete this.filters[k];
  57452. }
  57453. }
  57454. if (this.filters[key + '!=' + filter.val] !== undefined) {
  57455. delete this.filters[key + '!=' + filter.val];
  57456. filter.op = '>';
  57457. this.filters[key + '>'] = filter;
  57458. } else {
  57459. this.filters[key + '>='] = filter;
  57460. }
  57461. } else if (op === '<') {
  57462. for (var l in this.filters) {
  57463. numval = (+this.filters[l].val.toString());
  57464. if (this.filters[l].key === key && numval >= filter.val) {
  57465. delete this.filters[l];
  57466. }
  57467. }
  57468. this.filters[key + '<'] = filter;
  57469. } else if (op === '<=') {
  57470. for (var m in this.filters) {
  57471. numval = (+this.filters[m].val.toString());
  57472. if (this.filters[m].key === key && numval > filter.val) {
  57473. delete this.filters[m];
  57474. }
  57475. }
  57476. if (this.filters[key + '!=' + filter.val] !== undefined) {
  57477. delete this.filters[key + '!=' + filter.val];
  57478. filter.op = '<';
  57479. this.filters[key + '<'] = filter;
  57480. } else {
  57481. this.filters[key + '<='] = filter;
  57482. }
  57483. }
  57484. }
  57485. };
  57486. CartoCSS.Tree.Fontset = class Fontset {
  57487. constructor(env, fonts) {
  57488. this.fonts = fonts;
  57489. this.name = 'fontset-' + env.effects.length;
  57490. }
  57491. };
  57492. CartoCSS.Tree.Invalid = class Invalid {
  57493. constructor(chunk, index, message) {
  57494. this.is = 'invalid';
  57495. this.chunk = chunk;
  57496. this.index = index;
  57497. this.type = 'syntax';
  57498. this.message = message || "Invalid code: " + this.chunk;
  57499. }
  57500. ev(env) {
  57501. env.error({
  57502. chunk: this.chunk,
  57503. index: this.index,
  57504. type: 'syntax',
  57505. message: this.message || "Invalid code: " + this.chunk
  57506. });
  57507. return {
  57508. is: 'undefined'
  57509. };
  57510. }
  57511. };
  57512. CartoCSS.Tree.Keyword = class Keyword {
  57513. ev() {
  57514. return this;
  57515. }
  57516. constructor(value) {
  57517. this.value = value;
  57518. var special = {
  57519. 'transparent': 'color',
  57520. 'true': 'boolean',
  57521. 'false': 'boolean'
  57522. };
  57523. this.is = special[value] ? special[value] : 'keyword';
  57524. }
  57525. toString() {
  57526. return this.value;
  57527. }
  57528. };
  57529. /*Layer:class Invalid ),*/
  57530. CartoCSS.Tree.Literal = class Literal {
  57531. constructor(content) {
  57532. this.value = content || '';
  57533. this.is = 'field';
  57534. }
  57535. toString() {
  57536. return this.value;
  57537. }
  57538. 'ev'() {
  57539. return this;
  57540. }
  57541. };
  57542. CartoCSS.Tree.Operation = class Operation {
  57543. constructor(op, operands, index) {
  57544. this.is = 'operation';
  57545. this.op = op.trim();
  57546. this.operands = operands;
  57547. this.index = index;
  57548. }
  57549. ev(env) {
  57550. var a = this.operands[0].ev(env),
  57551. b = this.operands[1].ev(env),
  57552. temp;
  57553. if (a.is === 'undefined' || b.is === 'undefined') {
  57554. return {
  57555. is: 'undefined',
  57556. value: 'undefined'
  57557. };
  57558. }
  57559. if (a instanceof CartoCSS.Tree.Dimension && b instanceof CartoCSS.Tree.Color) {
  57560. if (this.op === '*' || this.op === '+') {
  57561. temp = b;
  57562. b = a;
  57563. a = temp;
  57564. } else {
  57565. env.error({
  57566. name: "OperationError",
  57567. message: "Can't substract or divide a color from a number",
  57568. index: this.index
  57569. });
  57570. }
  57571. }
  57572. // Only concatenate plain strings, because this is easily
  57573. // pre-processed
  57574. if (a instanceof CartoCSS.Tree.Quoted && b instanceof CartoCSS.Tree.Quoted && this.op !== '+') {
  57575. env.error({
  57576. message: "Can't subtract, divide, or multiply strings.",
  57577. index: this.index,
  57578. type: 'runtime',
  57579. filename: this.filename
  57580. });
  57581. return {
  57582. is: 'undefined',
  57583. value: 'undefined'
  57584. };
  57585. }
  57586. // Fields, literals, dimensions, and quoted strings can be combined.
  57587. if (a instanceof CartoCSS.Tree.Field || b instanceof CartoCSS.Tree.Field ||
  57588. a instanceof CartoCSS.Tree.Literal || b instanceof CartoCSS.Tree.Literal) {
  57589. if (a.is === 'color' || b.is === 'color') {
  57590. env.error({
  57591. message: "Can't subtract, divide, or multiply colors in expressions.",
  57592. index: this.index,
  57593. type: 'runtime',
  57594. filename: this.filename
  57595. });
  57596. return {
  57597. is: 'undefined',
  57598. value: 'undefined'
  57599. };
  57600. } else {
  57601. return new CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  57602. }
  57603. }
  57604. if (a.operate === undefined) {
  57605. env.error({
  57606. message: 'Cannot do math with type ' + a.is + '.',
  57607. index: this.index,
  57608. type: 'runtime',
  57609. filename: this.filename
  57610. });
  57611. return {
  57612. is: 'undefined',
  57613. value: 'undefined'
  57614. };
  57615. }
  57616. return a.operate(env, this.op, b);
  57617. }
  57618. };
  57619. CartoCSS.Tree.Quoted = class Quoted {
  57620. constructor(content) {
  57621. this.is = 'string';
  57622. this.value = content || '';
  57623. }
  57624. toString(quotes) {
  57625. var escapedValue = this.value
  57626. .replace(/&/g, '&amp;')
  57627. var xmlvalue = escapedValue
  57628. .replace(/\'/g, '\\\'')
  57629. .replace(/\"/g, '&quot;')
  57630. .replace(/</g, '&lt;')
  57631. .replace(/\>/g, '&gt;');
  57632. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  57633. }
  57634. ev() {
  57635. return this;
  57636. }
  57637. operate(env, op, other) {
  57638. return new CartoCSS.Tree.Quoted(CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  57639. }
  57640. };
  57641. CartoCSS.Tree.Reference = {
  57642. _validateValue: {
  57643. 'font': function (env, value) {
  57644. if (env.validation_data && env.validation_data.fonts) {
  57645. return env.validation_data.fonts.indexOf(value) != -1;
  57646. } else {
  57647. return true;
  57648. }
  57649. }
  57650. },
  57651. setData: function (data) {
  57652. this.data = data;
  57653. this.selector_cache = generateSelectorCache(data);
  57654. this.mapnikFunctions = generateMapnikFunctions(data);
  57655. this.required_cache = generateRequiredProperties(data);
  57656. function generateSelectorCache(data) {
  57657. var index = {};
  57658. for (var i in data.symbolizers) {
  57659. for (var j in data.symbolizers[i]) {
  57660. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  57661. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  57662. }
  57663. }
  57664. }
  57665. return index;
  57666. }
  57667. function generateMapnikFunctions(data) {
  57668. var functions = {};
  57669. for (var i in data.symbolizers) {
  57670. for (var j in data.symbolizers[i]) {
  57671. if (data.symbolizers[i][j].type === 'functions') {
  57672. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  57673. var fn = data.symbolizers[i][j].functions[k];
  57674. functions[fn[0]] = fn[1];
  57675. }
  57676. }
  57677. }
  57678. }
  57679. return functions;
  57680. }
  57681. function generateRequiredProperties(data) {
  57682. var cache = {};
  57683. for (var symbolizer_name in data.symbolizers) {
  57684. cache[symbolizer_name] = [];
  57685. for (var j in data.symbolizers[symbolizer_name]) {
  57686. if (data.symbolizers[symbolizer_name][j].required) {
  57687. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  57688. }
  57689. }
  57690. }
  57691. return cache;
  57692. }
  57693. },
  57694. setVersion: function (version) {
  57695. if (CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  57696. this.setData(CartoCSS.mapnik_reference.version[version]);
  57697. return true;
  57698. }
  57699. return false;
  57700. },
  57701. selectorData: function (selector, i) {
  57702. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  57703. },
  57704. validSelector: function (selector) {
  57705. return !!this.selector_cache[selector];
  57706. },
  57707. selectorName: function (selector) {
  57708. return this.selectorData(selector, 2);
  57709. },
  57710. selector: function (selector) {
  57711. return this.selectorData(selector, 0);
  57712. },
  57713. symbolizer: function (selector) {
  57714. return this.selectorData(selector, 1);
  57715. },
  57716. requiredProperties: function (symbolizer_name, rules) {
  57717. var req = this.required_cache[symbolizer_name];
  57718. for (var i in req) {
  57719. if (!(req[i] in rules)) {
  57720. return 'Property ' + req[i] + ' required for defining ' +
  57721. symbolizer_name + ' styles.';
  57722. }
  57723. }
  57724. },
  57725. isFont: function (selector) {
  57726. return this.selector(selector).validate === 'font';
  57727. },
  57728. editDistance: function (a, b) {
  57729. if (a.length === 0) {return b.length;}
  57730. if (b.length === 0) {return a.length;}
  57731. var matrix = [];
  57732. for (var i = 0; i <= b.length; i++) {
  57733. matrix[i] = [i];
  57734. }
  57735. for (var j = 0; j <= a.length; j++) {
  57736. matrix[0][j] = j;
  57737. }
  57738. for (i = 1; i <= b.length; i++) {
  57739. for (j = 1; j <= a.length; j++) {
  57740. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  57741. matrix[i][j] = matrix[i - 1][j - 1];
  57742. } else {
  57743. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  57744. Math.min(matrix[i][j - 1] + 1, // insertion
  57745. matrix[i - 1][j] + 1)); // deletion
  57746. }
  57747. }
  57748. }
  57749. return matrix[b.length][a.length];
  57750. },
  57751. validValue: function (env, selector, value) {
  57752. function validateFunctions(value, selector) {
  57753. if (value.value[0].is === 'string') {return true;}
  57754. for (var i in value.value) {
  57755. for (var j in value.value[i].value) {
  57756. if (value.value[i].value[j].is !== 'call') {return false;}
  57757. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  57758. return x[0] === value.value[i].value[j].name;
  57759. });
  57760. if (!(f && f[1] === -1)) {
  57761. // This filter is unknown or given an incorrect number of arguments
  57762. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  57763. }
  57764. }
  57765. }
  57766. return true;
  57767. }
  57768. function validateKeyword(value, selector) {
  57769. if (typeof this.selector(selector).type === 'object') {
  57770. return this.selector(selector).type
  57771. .indexOf(value.value[0].value) !== -1;
  57772. } else {
  57773. // allow unquoted keywords as strings
  57774. return this.selector(selector).type === 'string';
  57775. }
  57776. }
  57777. var i;
  57778. if (!this.selector(selector)) {
  57779. return false;
  57780. } else if (value.value[0].is === 'keyword') {
  57781. return validateKeyword(value, selector);
  57782. } else if (value.value[0].is === 'undefined') {
  57783. // caught earlier in the chain - ignore here so that
  57784. // error is not overridden
  57785. return true;
  57786. } else if (this.selector(selector).type === 'numbers') {
  57787. for (i in value.value) {
  57788. if (value.value[i].is !== 'float') {
  57789. return false;
  57790. }
  57791. }
  57792. return true;
  57793. } else if (this.selector(selector).type === 'tags') {
  57794. if (!value.value) {return false;}
  57795. if (!value.value[0].value) {
  57796. return value.value[0].is === 'tag';
  57797. }
  57798. for (i = 0; i < value.value[0].value.length; i++) {
  57799. if (value.value[0].value[i].is !== 'tag') {return false;}
  57800. }
  57801. return true;
  57802. } else if (this.selector(selector).type == 'functions') {
  57803. // For backwards compatibility, you can specify a string for `functions`-compatible
  57804. // values, though they will not be validated.
  57805. return validateFunctions(value, selector);
  57806. } else if (this.selector(selector).type === 'expression') {
  57807. return true;
  57808. } else if (this.selector(selector).type === 'unsigned') {
  57809. if (value.value[0].is === 'float') {
  57810. value.value[0].round();
  57811. return true;
  57812. } else {
  57813. return false;
  57814. }
  57815. } else {
  57816. if (this.selector(selector).validate) {
  57817. var valid = false;
  57818. for (i = 0; i < value.value.length; i++) {
  57819. if (this.selector(selector).type === value.value[i].is &&
  57820. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  57821. return true;
  57822. }
  57823. }
  57824. return valid;
  57825. } else {
  57826. return this.selector(selector).type === value.value[0].is;
  57827. }
  57828. }
  57829. }
  57830. };
  57831. CartoCSS.Tree.Reference.setVersion("latest");
  57832. CartoCSS.Tree.Rule = class Rule {
  57833. constructor(name, value, index, filename) {
  57834. this.is = 'rule';
  57835. var parts = name.split('/');
  57836. this.name = parts.pop();
  57837. this.instance = parts.length ? parts[0] : '__default__';
  57838. this.value = (value instanceof CartoCSS.Tree.Value) ?
  57839. value : new CartoCSS.Tree.Value([value]);
  57840. this.index = index;
  57841. this.symbolizer = CartoCSS.Tree.Reference.symbolizer(this.name);
  57842. this.filename = filename;
  57843. this.variable = (name.charAt(0) === '@');
  57844. }
  57845. clone() {
  57846. var clone = Object.create(CartoCSS.Tree.Rule.prototype);
  57847. clone.name = this.name;
  57848. clone.value = this.value;
  57849. clone.index = this.index;
  57850. clone.instance = this.instance;
  57851. clone.symbolizer = this.symbolizer;
  57852. clone.filename = this.filename;
  57853. clone.variable = this.variable;
  57854. return clone;
  57855. }
  57856. updateID() {
  57857. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  57858. }
  57859. toString() {
  57860. return '[' + CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  57861. }
  57862. ev(context) {
  57863. return new CartoCSS.Tree.Rule(this.name,
  57864. this.value.ev(context),
  57865. this.index,
  57866. this.filename);
  57867. }
  57868. };
  57869. CartoCSS.Tree.Ruleset = class Ruleset {
  57870. constructor(selectors, rules) {
  57871. this.is = 'ruleset';
  57872. this.selectors = selectors;
  57873. this.rules = rules;
  57874. // static cache of find() function
  57875. this._lookups = {};
  57876. }
  57877. ev(env) {
  57878. var i,
  57879. rule,
  57880. ruleset = new CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  57881. ruleset.root = this.root;
  57882. // push the current ruleset to the frames stack
  57883. env.frames.unshift(ruleset);
  57884. // Evaluate everything else
  57885. for (i = 0, rule; i < ruleset.rules.length; i++) {
  57886. rule = ruleset.rules[i];
  57887. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  57888. }
  57889. // Pop the stack
  57890. env.frames.shift();
  57891. return ruleset;
  57892. }
  57893. match(args) {
  57894. return !args || args.length === 0;
  57895. }
  57896. variables() {
  57897. if (this._variables) {
  57898. return this._variables;
  57899. } else {
  57900. return this._variables = this.rules.reduce(function (hash, r) {
  57901. if (r instanceof CartoCSS.Tree.Rule && r.variable === true) {
  57902. hash[r.name] = r;
  57903. }
  57904. return hash;
  57905. }, {});
  57906. }
  57907. }
  57908. variable(name) {
  57909. return this.variables()[name];
  57910. }
  57911. rulesets() {
  57912. if (this._rulesets) {
  57913. return this._rulesets;
  57914. } else {
  57915. return this._rulesets = this.rules.filter(function (r) {
  57916. return (r instanceof CartoCSS.Tree.Ruleset);
  57917. });
  57918. }
  57919. }
  57920. find(selector, self) {
  57921. self = self || this;
  57922. var rules = [], match,
  57923. key = selector.toString();
  57924. if (key in this._lookups) {
  57925. return this._lookups[key];
  57926. }
  57927. this.rulesets().forEach(function (rule) {
  57928. if (rule !== self) {
  57929. for (var j = 0; j < rule.selectors.length; j++) {
  57930. match = selector.match(rule.selectors[j]);
  57931. if (match) {
  57932. if (selector.elements.length > 1) {
  57933. Array.prototype.push.apply(rules, rule.find(
  57934. new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  57935. } else {
  57936. rules.push(rule);
  57937. }
  57938. break;
  57939. }
  57940. }
  57941. }
  57942. });
  57943. return this._lookups[key] = rules;
  57944. }
  57945. // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
  57946. // with simple bit-arrays that we can compare easily.
  57947. evZooms(env) {
  57948. for (var i = 0; i < this.selectors.length; i++) {
  57949. var zval = CartoCSS.Tree.Zoom.all;
  57950. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  57951. zval = this.selectors[i].zoom[z].ev(env).zoom;
  57952. }
  57953. this.selectors[i].zoom = zval;
  57954. }
  57955. }
  57956. flatten(result, parents, env) {
  57957. var selectors = [], i, j;
  57958. if (this.selectors.length === 0) {
  57959. env.frames = env.frames.concat(this.rules);
  57960. }
  57961. // evaluate zoom variables on this object.
  57962. this.evZooms(env);
  57963. for (i = 0; i < this.selectors.length; i++) {
  57964. var child = this.selectors[i];
  57965. if (!child.filters) {
  57966. // This is an invalid filterset.
  57967. continue;
  57968. }
  57969. if (parents.length) {
  57970. for (j = 0; j < parents.length; j++) {
  57971. var parent = parents[j];
  57972. var mergedFilters = parent.filters.cloneWith(child.filters);
  57973. if (mergedFilters === null) {
  57974. // Filters could be added, but they didn't change the
  57975. // filters. This means that we only have to clone when
  57976. // the zoom levels or the attachment is different too.
  57977. if (parent.zoom === child.zoom &&
  57978. parent.attachment === child.attachment &&
  57979. parent.elements.join() === child.elements.join()) {
  57980. selectors.push(parent);
  57981. continue;
  57982. } else {
  57983. mergedFilters = parent.filters;
  57984. }
  57985. } else if (!mergedFilters) {
  57986. // The merged filters are invalid, that means we don't
  57987. // have to clone.
  57988. continue;
  57989. }
  57990. var clone = Object.create(CartoCSS.Tree.Selector.prototype);
  57991. clone.filters = mergedFilters;
  57992. clone.zoom = child.zoom;
  57993. clone.elements = parent.elements.concat(child.elements);
  57994. if (parent.attachment && child.attachment) {
  57995. clone.attachment = parent.attachment + '/' + child.attachment;
  57996. } else {clone.attachment = child.attachment || parent.attachment;}
  57997. clone.conditions = parent.conditions + child.conditions;
  57998. clone.index = child.index;
  57999. selectors.push(clone);
  58000. }
  58001. } else {
  58002. selectors.push(child);
  58003. }
  58004. }
  58005. var rules = [];
  58006. for (i = 0; i < this.rules.length; i++) {
  58007. var rule = this.rules[i];
  58008. // Recursively flatten any nested rulesets
  58009. if (rule instanceof CartoCSS.Tree.Ruleset) {
  58010. rule.flatten(result, selectors, env);
  58011. } else if (rule instanceof CartoCSS.Tree.Rule) {
  58012. rules.push(rule);
  58013. } else if (rule instanceof CartoCSS.Tree.Invalid) {
  58014. env.error(rule);
  58015. }
  58016. }
  58017. var index = rules.length ? rules[0].index : false;
  58018. for (i = 0; i < selectors.length; i++) {
  58019. // For specificity sort, use the position of the first rule to allow
  58020. // defining attachments that are under current element as a descendant
  58021. // selector.
  58022. if (index !== false) {
  58023. selectors[i].index = index;
  58024. }
  58025. result.push(new CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  58026. }
  58027. return result;
  58028. }
  58029. };
  58030. CartoCSS.Tree.Selector = class Selector {
  58031. constructor(filters, zoom, elements, attachment, conditions, index) {
  58032. this.elements = elements || [];
  58033. this.attachment = attachment;
  58034. this.filters = filters || {};
  58035. this.zoom = typeof zoom !== 'undefined' ? zoom : CartoCSS.Tree.Zoom.all;
  58036. this.conditions = conditions;
  58037. this.index = index;
  58038. }
  58039. specificity() {
  58040. return this.elements.reduce(function (memo, e) {
  58041. var spec = e.specificity();
  58042. memo[0] += spec[0];
  58043. memo[1] += spec[1];
  58044. return memo;
  58045. }, [0, 0, this.conditions, this.index]);
  58046. }
  58047. };
  58048. /*style:class Invalid ),*/
  58049. CartoCSS.Tree.URL = class URL {
  58050. constructor(val, paths) {
  58051. this.is = 'uri';
  58052. this.value = val;
  58053. this.paths = paths;
  58054. }
  58055. toString() {
  58056. return this.value.toString();
  58057. }
  58058. ev(ctx) {
  58059. return new CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  58060. }
  58061. };
  58062. CartoCSS.Tree.Value = class Value {
  58063. constructor(value) {
  58064. this.is = 'value';
  58065. this.value = value;
  58066. }
  58067. ev(env) {
  58068. if (this.value.length === 1) {
  58069. return this.value[0].ev(env);
  58070. } else {
  58071. return new CartoCSS.Tree.Value(this.value.map(function (v) {
  58072. return v.ev(env);
  58073. }));
  58074. }
  58075. }
  58076. toJS(env) {
  58077. //var v = this.value[0].value[0];
  58078. var val = this.ev(env);
  58079. var v = val.toString();
  58080. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  58081. v = "'" + v + "'";
  58082. } else if (val.is === 'field') {
  58083. // replace [varuable] by ctx['variable']
  58084. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  58085. } else if (val.value && typeof val.value === "object") {
  58086. v = "[" + v + "]";
  58087. }
  58088. return "_value = " + v + ";";
  58089. }
  58090. toString(env, selector, sep, format) {
  58091. return this.value.map(function (e) {
  58092. return e.toString(env, format);
  58093. }).join(sep || ', ');
  58094. }
  58095. clone() {
  58096. var obj = Object.create(CartoCSS.Tree.Value.prototype);
  58097. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  58098. obj.is = this.is;
  58099. return obj;
  58100. }
  58101. };
  58102. CartoCSS.Tree.Variable = class Variable {
  58103. constructor(name, index, filename) {
  58104. this.is = 'variable';
  58105. this.name = name;
  58106. this.index = index;
  58107. this.filename = filename;
  58108. }
  58109. toString() {
  58110. return this.name;
  58111. }
  58112. ev(env) {
  58113. if (this._css) {return this._css;}
  58114. var thisframe = env.frames.filter(function (f) {
  58115. return f.name === this.name;
  58116. }.bind(this));
  58117. if (thisframe.length) {
  58118. return thisframe[0].value.ev(env);
  58119. } else {
  58120. env.error({
  58121. message: 'variable ' + this.name + ' is undefined',
  58122. index: this.index,
  58123. type: 'runtime',
  58124. filename: this.filename
  58125. });
  58126. return {
  58127. is: 'undefined',
  58128. value: 'undefined'
  58129. };
  58130. }
  58131. }
  58132. };
  58133. CartoCSS.Tree.Zoom = class Zoom {
  58134. constructor(op, value, index) {
  58135. this.op = op;
  58136. this.value = value;
  58137. this.index = index;
  58138. }
  58139. setZoom(zoom) {
  58140. this.zoom = zoom;
  58141. return this;
  58142. }
  58143. ev(env) {
  58144. var value = parseInt(this.value.ev(env).toString(), 10);
  58145. if (value > CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  58146. env.error({
  58147. message: 'Only zoom levels between 0 and ' +
  58148. CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  58149. index: this.index
  58150. });
  58151. }
  58152. switch (this.op) {
  58153. case '=':
  58154. this.zoom = "zoom && zoom === " + value;
  58155. return this;
  58156. case '>':
  58157. this.zoom = "zoom && zoom > " + value;
  58158. break;
  58159. case '>=':
  58160. this.zoom = "zoom && zoom >= " + value;
  58161. break;
  58162. case '<':
  58163. this.zoom = "zoom && zoom < " + value;
  58164. break;
  58165. case '<=':
  58166. this.zoom = "zoom && zoom <= " + value;
  58167. break;
  58168. default:
  58169. break;
  58170. }
  58171. /*
  58172. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  58173. if (i >= start && i <= end) {
  58174. zoom |= (1 << i);
  58175. }
  58176. }
  58177. this.zoom = zoom;
  58178. this.zoom=value+this.op+"zoom";*/
  58179. return this;
  58180. }
  58181. toString() {
  58182. var str = '';
  58183. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  58184. str += (this.zoom & (1 << i)) ? 'X' : '.';
  58185. }
  58186. return str;
  58187. }
  58188. };
  58189. // Covers all zoomlevels from 0 to 22
  58190. CartoCSS.Tree.Zoom.all = 23;
  58191. CartoCSS.Tree.Zoom.maxZoom = 22;
  58192. CartoCSS.Tree.Zoom.ranges = {
  58193. 0: 1000000000,
  58194. 1: 500000000,
  58195. 2: 200000000,
  58196. 3: 100000000,
  58197. 4: 50000000,
  58198. 5: 25000000,
  58199. 6: 12500000,
  58200. 7: 6500000,
  58201. 8: 3000000,
  58202. 9: 1500000,
  58203. 10: 750000,
  58204. 11: 400000,
  58205. 12: 200000,
  58206. 13: 100000,
  58207. 14: 50000,
  58208. 15: 25000,
  58209. 16: 12500,
  58210. 17: 5000,
  58211. 18: 2500,
  58212. 19: 1500,
  58213. 20: 750,
  58214. 21: 500,
  58215. 22: 250,
  58216. 23: 100
  58217. };
  58218. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  58219. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58220. * This program are made available under the terms of the Apache License, Version 2.0
  58221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58222. /**
  58223. * @class ThemeStyle
  58224. * @deprecatedclass SuperMap.ThemeStyle
  58225. * @classdesc 客户端专题图风格类。
  58226. * @modulecategory Overlay
  58227. * @category Visualization Theme
  58228. * @param {Object} options - 可选参数。
  58229. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  58230. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  58231. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  58232. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  58233. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  58234. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  58235. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  58236. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  58237. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  58238. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  58239. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  58240. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  58241. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  58242. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  58243. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  58244. * @param {string} options.label - 专题要素附加文本标签内容。
  58245. * @param {string} [options.fontColor] - 附加文本字体颜色。
  58246. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  58247. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  58248. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  58249. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  58250. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  58251. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  58252. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  58253. * @param {string} [options.labelPosition='top'] - 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  58254. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  58255. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。可以是 'top', 'bottom', 'middle' 。
  58256. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  58257. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  58258. * @usage
  58259. */
  58260. class ThemeStyle {
  58261. constructor(options) {
  58262. options = options || {};
  58263. /**
  58264. * @member {boolean} [ThemeStyle.prototype.fill=true]
  58265. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  58266. */
  58267. this.fill = true;
  58268. /**
  58269. * @member {string} [ThemeStyle.prototype.fillColor="#000000"]
  58270. * @description 十六进制填充颜色。
  58271. */
  58272. this.fillColor = "#000000";
  58273. /**
  58274. * @member {number} [ThemeStyle.prototype.fillOpacity=1]
  58275. * @description 填充不透明度。取值范围[0, 1]。
  58276. */
  58277. this.fillOpacity = 1;
  58278. /**
  58279. * @member {boolean} [ThemeStyle.prototype.stroke=false]
  58280. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  58281. */
  58282. this.stroke = false;
  58283. /**
  58284. * @member {string} [ThemeStyle.prototype.strokeColor="#000000"]
  58285. * @description 十六进制描边颜色。
  58286. */
  58287. this.strokeColor = "#000000";
  58288. /**
  58289. * @member {number} [ThemeStyle.prototype.strokeOpacity=1]
  58290. * @description 描边的不透明度。取值范围[0, 1]。
  58291. */
  58292. this.strokeOpacity = 1;
  58293. /**
  58294. * @member {number} [ThemeStyle.prototype.strokeWidth=1]
  58295. * @description 线宽度/描边宽度。
  58296. */
  58297. this.strokeWidth = 1;
  58298. /**
  58299. * @member {string} [ThemeStyle.prototype.strokeLinecap="butt"]
  58300. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  58301. */
  58302. this.strokeLinecap = "butt";
  58303. /**
  58304. * @member {string} [ThemeStyle.prototype.strokeLineJoin="miter"]
  58305. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  58306. */
  58307. this.strokeLineJoin = "miter";
  58308. /**
  58309. * @member {string} [ThemeStyle.prototype.strokeDashstyle="solid"]
  58310. * @description 虚线类型;strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  58311. * solid 表示实线。
  58312. */
  58313. this.strokeDashstyle = "solid";
  58314. /**
  58315. * @member {number} [ThemeStyle.prototype.pointRadius=6]
  58316. * @description 点半径。单位为像素。
  58317. */
  58318. this.pointRadius = 6;
  58319. /**
  58320. * @member {number} [ThemeStyle.prototype.shadowBlur=0]
  58321. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  58322. */
  58323. this.shadowBlur = 0;
  58324. /**
  58325. * @member {string} [ThemeStyle.prototype.shadowColor='#000000']
  58326. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  58327. */
  58328. this.shadowColor = "#000000";
  58329. /**
  58330. * @member {number} [ThemeStyle.prototype.shadowOffsetX=0]
  58331. * @description 阴影 X 方向偏移值。
  58332. */
  58333. this.shadowOffsetX = 0;
  58334. /**
  58335. * @member {number} ThemeStyle.prototype.shadowOffsetY
  58336. * @description Y 方向偏移值。
  58337. */
  58338. this.shadowOffsetY = 0;
  58339. /**
  58340. * @member {string} [ThemeStyle.prototype.label]
  58341. * @description 专题要素附加文本标签内容。
  58342. */
  58343. this.label = "";
  58344. /**
  58345. * @member {boolean} [ThemeStyle.prototype.labelRect=false]
  58346. * @description 是否显示文本标签矩形背景。
  58347. */
  58348. this.labelRect = false;
  58349. /**
  58350. * @member {string} [ThemeStyle.prototype.fontColor]
  58351. * @description 附加文本字体颜色。
  58352. */
  58353. this.fontColor = "";
  58354. /**
  58355. * @member {number} [ThemeStyle.prototype.fontSize=12]
  58356. * @description 附加文本字体大小,单位是像素。
  58357. */
  58358. this.fontSize = 12;
  58359. /**
  58360. * @member {string} [ThemeStyle.prototype.fontStyle="normal"]
  58361. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  58362. */
  58363. this.fontStyle = "normal";
  58364. /**
  58365. * @member {string} [ThemeStyle.prototype.fontVariant="normal"]
  58366. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  58367. */
  58368. this.fontVariant = "normal";
  58369. /**
  58370. * @member {string} [ThemeStyle.prototype.fontWeight="normal"]
  58371. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  58372. */
  58373. this.fontWeight = "normal";
  58374. /**
  58375. * @member {string} [ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  58376. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  58377. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  58378. */
  58379. this.fontFamily = "arial,sans-serif";
  58380. /**
  58381. * @member {string} [ThemeStyle.prototype.labelPosition='top']
  58382. * @description 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  58383. */
  58384. this.labelPosition = "top";
  58385. /**
  58386. * @member {string} [ThemeStyle.prototype.labelAlign='center']
  58387. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  58388. */
  58389. this.labelAlign = "center";
  58390. /**
  58391. * @member {string} [ThemeStyle.prototype.labelBaseline='middle']
  58392. * @description 附加文本垂直对齐。可以是 'top', 'bottom', 'middle'。
  58393. */
  58394. this.labelBaseline = "middle";
  58395. /**
  58396. * @member {number} [ThemeStyle.prototype.labelXOffset=0]
  58397. * @description 附加文本在 X 轴方向的偏移量。
  58398. */
  58399. this.labelXOffset = 0;
  58400. /**
  58401. * @member {number} [ThemeStyle.prototype.labelYOffset=0]
  58402. * @description 附加文本在 Y 轴方向的偏移量。
  58403. */
  58404. this.labelYOffset = 0;
  58405. Util_Util.extend(this, options);
  58406. }
  58407. }
  58408. ;// CONCATENATED MODULE: ./src/common/style/index.js
  58409. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58410. * This program are made available under the terms of the Apache License, Version 2.0
  58411. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58412. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  58413. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58414. * This program are made available under the terms of the Apache License, Version 2.0
  58415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58416. /**
  58417. * @class ShapeParameters
  58418. * @aliasclass Feature.ShapeParameters
  58419. * @deprecatedclass SuperMap.Feature.ShapeParameters
  58420. * @category Visualization Theme
  58421. * @classdesc 图形参数基类
  58422. * @usage
  58423. */
  58424. class ShapeParameters {
  58425. constructor() {
  58426. /**
  58427. * @member {Array.<number>} [ShapeParameters.prototype.refOriginalPosition=[0,0]]
  58428. * @description 图形参考原点位置,图形的参考中心位置。
  58429. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  58430. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  58431. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  58432. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  58433. * 图形(Shape)的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  58434. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  58435. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  58436. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  58437. */
  58438. this.refOriginalPosition = [0, 0];
  58439. /**
  58440. * @member {string} ShapeParameters.prototype.refDataID
  58441. * @description 图形所关联数据的 ID(<{@link FeatureVector}> 的 ID)。
  58442. */
  58443. this.refDataID = null;
  58444. /**
  58445. * @member {boolean} ShapeParameters.prototype.isHoverByRefDataID
  58446. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  58447. */
  58448. this.isHoverByRefDataID = false;
  58449. /**
  58450. * @member {string} ShapeParameters.prototype.refDataHoverGroup
  58451. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  58452. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  58453. */
  58454. this.refDataHoverGroup = null;
  58455. /**
  58456. * @member {Object} ShapeParameters.prototype.dataInfo
  58457. * @description 图形携带的附加数据。
  58458. */
  58459. this.dataInfo = null;
  58460. /**
  58461. * @member {boolean} ShapeParameters.prototype.clickable
  58462. * @description 是否可点击。
  58463. */
  58464. this.clickable = true;
  58465. /**
  58466. * @member {boolean} ShapeParameters.prototype.hoverable
  58467. * @description 是否可点击。
  58468. */
  58469. this.hoverable = true;
  58470. /**
  58471. * @member {Object} ShapeParameters.prototype.style
  58472. * @description 图形样式对象,可设样式属性在子类中确定。
  58473. */
  58474. this.style = null;
  58475. /**
  58476. * @member {Object} ShapeParameters.prototype.highlightStyle
  58477. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  58478. */
  58479. this.highlightStyle = {};
  58480. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  58481. }
  58482. /**
  58483. * @function ShapeParameters.prototype.destroy
  58484. * @description 销毁对象。
  58485. */
  58486. destroy() {
  58487. this.refOriginalPosition = null;
  58488. this.refDataID = null;
  58489. this.isHoverByRefDataID = null;
  58490. this.refDataHoverGroup = null;
  58491. this.dataInfo = null;
  58492. this.clickable = null;
  58493. this.hoverable = null;
  58494. this.style = null;
  58495. this.highlightStyle = null;
  58496. }
  58497. }
  58498. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  58499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58500. * This program are made available under the terms of the Apache License, Version 2.0
  58501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58502. /**
  58503. * @class ShapeParametersPoint
  58504. * @aliasclass Feature.ShapeParameters.Point
  58505. * @deprecatedclass SuperMap.Feature.ShapeParameters.Point
  58506. * @category Visualization Theme
  58507. * @classdesc 点参数对象。
  58508. * @extends {ShapeParameters}
  58509. * @param {number} x - 点 x 坐标。
  58510. * @param {number} y - 点 y 坐标。
  58511. * @usage
  58512. */
  58513. class Point_Point extends ShapeParameters {
  58514. constructor(x, y) {
  58515. super(x, y);
  58516. /**
  58517. * @member {number} ShapeParametersPoint.prototype.x
  58518. * @description 点 x 坐标。
  58519. */
  58520. this.x = !isNaN(x) ? x : 0;
  58521. /**
  58522. * @member {number} ShapeParametersPoint.prototype.y
  58523. * @description 点 y 坐标。
  58524. */
  58525. this.y = !isNaN(y) ? y : 0;
  58526. /**
  58527. * @member {number} ShapeParametersPoint.prototype.r
  58528. * @description 点的半径。
  58529. */
  58530. this.r = 6;
  58531. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  58532. }
  58533. /**
  58534. * @function ShapeParametersPoint.prototype.destroy
  58535. * @description 销毁对象。
  58536. */
  58537. destroy() {
  58538. this.x = null;
  58539. this.y = null;
  58540. this.r = null;
  58541. super.destroy();
  58542. }
  58543. }
  58544. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  58545. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58546. * This program are made available under the terms of the Apache License, Version 2.0
  58547. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58548. /**
  58549. * @class ShapeParametersLine
  58550. * @aliasclass Feature.ShapeParameters.Line
  58551. * @deprecatedclass SuperMap.Feature.ShapeParameters.Line
  58552. * @category Visualization Theme
  58553. * @classdesc 线参数对象。
  58554. * @extends {ShapeParameters}
  58555. * @param {Array} pointList - 线要素节点数组,二维数组。
  58556. * @usage
  58557. */
  58558. class Line_Line extends ShapeParameters {
  58559. constructor(pointList) {
  58560. super(pointList);
  58561. /**
  58562. * @member {Array} ShapeParametersLine.prototype.pointList
  58563. * @description 线要素节点数组,二维数组。
  58564. * 数组形如:
  58565. * (start code)
  58566. * [
  58567. * [10, 20], //节点
  58568. * [30, 40],
  58569. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  58570. * ]
  58571. * (end)
  58572. */
  58573. this.pointList = pointList;
  58574. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  58575. }
  58576. /**
  58577. * @function ShapeParametersLine.prototype.destroy
  58578. * @description 销毁对象。
  58579. */
  58580. destroy() {
  58581. this.pointList = null;
  58582. super.destroy();
  58583. }
  58584. }
  58585. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  58586. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58587. * This program are made available under the terms of the Apache License, Version 2.0
  58588. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58589. /**
  58590. * @class ShapeParametersPolygon
  58591. * @aliasclass Feature.ShapeParameters.Polygon
  58592. * @deprecatedclass SuperMap.Feature.ShapeParameters.Polygon
  58593. * @category Visualization Theme
  58594. * @classdesc 面参数对象。
  58595. * @extends {ShapeParameters}
  58596. * @param {Array} pointList - 横坐标。
  58597. * @usage
  58598. */
  58599. class feature_Polygon_Polygon extends ShapeParameters {
  58600. constructor(pointList) {
  58601. super(pointList);
  58602. /**
  58603. * @member {Array} ShapeParametersPolygon.prototype.pointList
  58604. * @description 面要素节点数组,二维数组。
  58605. * 数组形如:
  58606. * (start code)
  58607. * [
  58608. * [10, 20], //节点
  58609. * [30, 40],
  58610. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  58611. * ]
  58612. * (end)
  58613. */
  58614. this.pointList = pointList;
  58615. /**
  58616. * @member {Array} ShapeParametersPolygon.prototype.holePolygonPointLists
  58617. * @description 岛洞面多边形顶点数组(三维数组)
  58618. */
  58619. this.holePolygonPointLists = null;
  58620. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  58621. }
  58622. /**
  58623. * @function ShapeParametersPolygon.prototype.destroy
  58624. * @description 销毁对象。
  58625. */
  58626. destroy() {
  58627. this.pointList = null;
  58628. this.holePolygonPointLists = null;
  58629. super.destroy();
  58630. }
  58631. }
  58632. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  58633. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58634. * This program are made available under the terms of the Apache License, Version 2.0
  58635. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58636. /**
  58637. * @class ShapeParametersRectangle
  58638. * @aliasclass Feature.ShapeParameters.Rectangle
  58639. * @deprecatedclass SuperMap.Feature.ShapeParameters.Rectangle
  58640. * @category Visualization Theme
  58641. * @classdesc 矩形参数对象。
  58642. * @extends {ShapeParameters}
  58643. * @param {number} x - 矩形 x 坐标。
  58644. * @param {number} y - 矩形 y 坐标。
  58645. * @param {number} width - 矩形 width 宽度。
  58646. * @param {number} height - 矩形 height 高度。
  58647. * @usage
  58648. */
  58649. class Rectangle_Rectangle extends ShapeParameters {
  58650. constructor(x, y, width, height) {
  58651. super(x, y, width, height);
  58652. /**
  58653. * @member {number} ShapeParametersRectangle.prototype.x
  58654. * @description 左上角 x 坐标。
  58655. */
  58656. this.x = !isNaN(x) ? x : 0;
  58657. /**
  58658. * @member {number} ShapeParametersRectangle.prototype.y
  58659. * @description 左上角 y 坐标。
  58660. */
  58661. this.y = !isNaN(x) ? y : 0;
  58662. /**
  58663. * @member {number} ShapeParametersRectangle.prototype.width
  58664. * @description 宽度。
  58665. */
  58666. this.width = !isNaN(width) ? width : 0;
  58667. /**
  58668. * @member {number} ShapeParametersRectangle.prototype.height
  58669. * @description 高度。
  58670. */
  58671. this.height = !isNaN(height) ? height : 0;
  58672. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  58673. }
  58674. /**
  58675. * @function ShapeParametersRectangle.prototype.destroy
  58676. * @description 销毁对象。
  58677. */
  58678. destroy() {
  58679. this.x = null;
  58680. this.y = null;
  58681. this.width = null;
  58682. this.height = null;
  58683. super.destroy();
  58684. }
  58685. }
  58686. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  58687. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58688. * This program are made available under the terms of the Apache License, Version 2.0
  58689. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58690. /**
  58691. * @class ShapeParametersSector
  58692. * @aliasclass Feature.ShapeParameters.Sector
  58693. * @deprecatedclass SuperMap.Feature.ShapeParameters.Sector
  58694. * @category Visualization Theme
  58695. * @classdesc 扇形参数对象。
  58696. * @extends {ShapeParameters}
  58697. * @param {number} x - 圆心 x 坐标。
  58698. * @param {number} y - 圆心 y 坐标。
  58699. * @param {number} r - 外圆半径。
  58700. * @param {number} startAngle - 起始角度。取值范围[0, 360)。
  58701. * @param {number} endAngle - 结束角度。取值范围(0, 360]。
  58702. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  58703. * @usage
  58704. */
  58705. class Sector extends ShapeParameters {
  58706. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  58707. super(x, y, r, startAngle, endAngle, r0, clockWise);
  58708. /**
  58709. * @member {number} ShapeParametersSector.prototype.x
  58710. * @description 圆心 x 坐标。
  58711. */
  58712. this.x = !isNaN(x) ? x : 0;
  58713. /**
  58714. * @member {number} ShapeParametersSector.prototype.Y
  58715. * @description 圆心 Y 坐标。
  58716. */
  58717. this.y = !isNaN(y) ? y : 0;
  58718. /**
  58719. * @member {number} ShapeParametersSector.prototype.r
  58720. * @description 外圆半径。
  58721. */
  58722. this.r = !isNaN(r) ? r : 0;
  58723. /**
  58724. * @member {number} ShapeParametersSector.prototype.startAngle
  58725. * @description 起始角度。取值范围[0, 360),默认值:null。
  58726. */
  58727. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  58728. /**
  58729. * @member {number} ShapeParametersSector.prototype.endAngle
  58730. * @description 结束角度。取值范围(0, 360],默认值:null。
  58731. */
  58732. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  58733. /**
  58734. * @member {number} [ShapeParametersSector.prototype.r0=0]
  58735. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  58736. */
  58737. this.r0 = !isNaN(r0) ? r0 : 0;
  58738. /**
  58739. * @member {number} [ShapeParametersSector.prototype.clockWise=false]
  58740. * @description 是否是顺时针。默认值:false。
  58741. */
  58742. this.clockWise = clockWise;
  58743. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  58744. }
  58745. /**
  58746. * @function ShapeParametersSector.prototype.destroy
  58747. * @description 销毁对象。
  58748. */
  58749. destroy() {
  58750. this.x = null;
  58751. this.y = null;
  58752. this.r = null;
  58753. this.startAngle = null;
  58754. this.endAngle = null;
  58755. this.r0 = null;
  58756. this.clockWise = null;
  58757. super.destroy();
  58758. }
  58759. }
  58760. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  58761. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58762. * This program are made available under the terms of the Apache License, Version 2.0
  58763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58764. /**
  58765. * @class ShapeParametersLabel
  58766. * @aliasclass Feature.ShapeParameters.Label
  58767. * @deprecatedclass SuperMap.Feature.ShapeParameters.Label
  58768. * @category Visualization Theme
  58769. * @classdesc 标签参数对象。
  58770. * @extends {ShapeParameters}
  58771. * @param {number} x - 横坐标。
  58772. * @param {number} y - 纵坐标。
  58773. * @param {string} text - 图形中的附加文本。
  58774. * @usage
  58775. * ```
  58776. * // 浏览器
  58777. * <script type="text/javascript" src="{cdn}"></script>
  58778. * <script>
  58779. * new {namespace}.Feature.ShapeParameters.Label(x, y, text);
  58780. *
  58781. * // 弃用的写法
  58782. * new SuperMap.Feature.ShapeParameters.Label(x, y, text);
  58783. *
  58784. * </script>
  58785. * // ES6 Import
  58786. * import { ShapeParametersLabel } from '{npm}';
  58787. * new ShapeParametersLabel(x, y, text);
  58788. *
  58789. * // 弃用的写法
  58790. * import { Label } from '{npm}';
  58791. * new Label(x, y, text);
  58792. *
  58793. * ```
  58794. */
  58795. class Label extends ShapeParameters {
  58796. constructor(x, y, text) {
  58797. super(x, y, text);
  58798. /**
  58799. * @member {number} ShapeParametersLabel.prototype.x
  58800. * @description 标签 x 坐标。
  58801. */
  58802. this.x = x;
  58803. /**
  58804. * @member {number} ShapeParametersLabel.prototype.y
  58805. * @description 标签 y 坐标。
  58806. */
  58807. this.y = y;
  58808. /**
  58809. * @member {number} ShapeParametersLabel.prototype.text
  58810. * @description 标签的文本内容。
  58811. */
  58812. this.text = text;
  58813. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  58814. }
  58815. /**
  58816. * @function ShapeParametersLabel.prototype.destroy
  58817. * @description 销毁对象。
  58818. */
  58819. destroy() {
  58820. this.x = null;
  58821. this.y = null;
  58822. this.text = null;
  58823. super.destroy();
  58824. }
  58825. }
  58826. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  58827. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58828. * This program are made available under the terms of the Apache License, Version 2.0
  58829. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58830. /**
  58831. * @class ShapeParametersImage
  58832. * @aliasclass Feature.ShapeParameters.Image
  58833. * @deprecatedclass SuperMap.Feature.ShapeParameters.Image
  58834. * @category Visualization Theme
  58835. * @classdesc 图片参数对象。
  58836. * @extends {ShapeParameters}
  58837. * @param {number} x - 左上角横坐标。
  58838. * @param {number} y - 左上角纵坐标。
  58839. * @param {(string|Object)} image - 图片地址或Cavans对象。
  58840. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  58841. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  58842. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  58843. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  58844. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  58845. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  58846. * @usage
  58847. */
  58848. class Image_Image extends ShapeParameters {
  58849. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  58850. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  58851. /**
  58852. * @member {number} ShapeParametersImage.prototype.x
  58853. * @description 左上角横坐标,必设参数。
  58854. */
  58855. this.x = x;
  58856. /**
  58857. * @member {number} ShapeParametersImage.prototype.y
  58858. * @description 左上角纵坐标,必设参数。
  58859. */
  58860. this.y = y;
  58861. /**
  58862. * @member {(string|Object)} ShapeParametersImage.prototype.image
  58863. * @description 图片地址。
  58864. */
  58865. this.image = image;
  58866. /**
  58867. * @member {number} ShapeParametersImage.prototype.width
  58868. * @description 绘制到画布上的宽度,默认为图片高度。
  58869. */
  58870. this.width = width;
  58871. /**
  58872. * @member {number} ShapeParametersImage.prototype.height
  58873. * @description 绘制到画布上的高度,默认为图片高度。
  58874. */
  58875. this.height = height;
  58876. /**
  58877. * @member {number} ShapeParametersImage.prototype.sx
  58878. * @description 从图片中裁剪的左上角横坐标。
  58879. */
  58880. this.sx = sx;
  58881. /**
  58882. * @member {number} ShapeParametersImage.prototype.sy
  58883. * @description 从图片中裁剪的左上角纵坐标。
  58884. */
  58885. this.sy = sy;
  58886. /**
  58887. * @member {number} ShapeParametersImage.prototype.sWidth
  58888. * @description 从图片中裁剪的宽度,默认为图片高度。
  58889. */
  58890. this.sWidth = sWidth;
  58891. /**
  58892. * @member {number} ShapeParametersImage.prototype.sHeight
  58893. * @description 绘制到画布上的高度,默认为图片高度。
  58894. */
  58895. this.sHeight = sHeight;
  58896. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  58897. }
  58898. /**
  58899. * @function ShapeParametersImage.prototype.destroy
  58900. * @description 销毁对象。
  58901. */
  58902. destroy() {
  58903. this.x = null;
  58904. this.y = null;
  58905. this.image = null;
  58906. this.width = null;
  58907. this.height = null;
  58908. this.sx = null;
  58909. this.sy = null;
  58910. this.sWidth = null;
  58911. this.sHeight = null;
  58912. super.destroy();
  58913. }
  58914. }
  58915. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  58916. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58917. * This program are made available under the terms of the Apache License, Version 2.0
  58918. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58919. /**
  58920. * @class ShapeParametersCircle
  58921. * @aliasclass Feature.ShapeParameters.Circle
  58922. * @deprecatedclass SuperMap.Feature.ShapeParameters.Circle
  58923. * @classdesc 圆形参数对象。
  58924. * @category Visualization Theme
  58925. * @extends {ShapeParameters}
  58926. * @param {number} x - 圆心 x 坐标。
  58927. * @param {number} y - 圆心 y 坐标。
  58928. * @param {number} r - 圆半径。
  58929. * @usage
  58930. */
  58931. class Circle_Circle extends ShapeParameters {
  58932. constructor(x, y, r) {
  58933. super(x, y, r);
  58934. /**
  58935. * @member {number} ShapeParametersCircle.prototype.x
  58936. * @description 圆心 x 坐标。
  58937. */
  58938. this.x = !isNaN(x) ? x : 0;
  58939. /**
  58940. * @member {number} ShapeParametersCircle.prototype.y
  58941. * @description 圆心 y 坐标。
  58942. */
  58943. this.y = !isNaN(y) ? y : 0;
  58944. /**
  58945. * @member {number} ShapeParametersCircle.prototype.r
  58946. * @description 圆半径。
  58947. */
  58948. this.r = !isNaN(r) ? r : 0;
  58949. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  58950. }
  58951. /**
  58952. * @function ShapeParametersCircle.prototype.destroy
  58953. * @description 销毁对象。
  58954. */
  58955. destroy() {
  58956. this.x = null;
  58957. this.y = null;
  58958. this.r = null;
  58959. super.destroy();
  58960. }
  58961. }
  58962. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  58963. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58964. * This program are made available under the terms of the Apache License, Version 2.0
  58965. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58966. /**
  58967. * @class LevelRenderer.Eventful
  58968. * @category Visualization Theme
  58969. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  58970. * 此类不可实例化。
  58971. * 支持的事件:
  58972. * Symbolizer properties:
  58973. * onclick - {function} 默认值:null。
  58974. * onmouseover - {function} 默认值:null。
  58975. * onmouseout - {function} 默认值:null。
  58976. * onmousemove - {function} 默认值:null。
  58977. * onmousewheel - {function} 默认值:null。
  58978. * onmousedown - {function} 默认值:null。
  58979. * onmouseup - {function} 默认值:null。
  58980. * ondragstart - {function} 默认值:null。
  58981. * ondragend - {function} 默认值:null。
  58982. * ondragenter - {function} 默认值:null。
  58983. * ondragleave - {function} 默认值:null。
  58984. * ondragover - {function} 默认值:null。
  58985. * ondrop - {function} 默认值:null。
  58986. * @private
  58987. */
  58988. class Eventful {
  58989. constructor() {
  58990. /**
  58991. * @member {Object} LevelRenderer.Eventful.prototype._handlers
  58992. * @description 事件处理对象(事件分发器)。
  58993. */
  58994. this._handlers = {};
  58995. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  58996. }
  58997. /**
  58998. * @function {Object} LevelRenderer.Eventful.prototype.destroy
  58999. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  59000. */
  59001. destroy() {
  59002. this._handlers = null;
  59003. }
  59004. /**
  59005. * @function LevelRenderer.Eventful.prototype.one
  59006. * @description 单次触发绑定,dispatch后销毁。
  59007. * @param {string} event - 事件名。
  59008. * @param {boolean} handler - 响应函数。
  59009. * @param {Object} context - context。
  59010. * @returns {LevelRenderer.Eventful} this
  59011. */
  59012. one(event, handler, context) {
  59013. var _h = this._handlers;
  59014. if (!handler || !event) {
  59015. return this;
  59016. }
  59017. if (!_h[event]) {
  59018. _h[event] = [];
  59019. }
  59020. _h[event].push({
  59021. h: handler,
  59022. one: true,
  59023. ctx: context || this
  59024. });
  59025. return this;
  59026. }
  59027. /**
  59028. * @function LevelRenderer.Eventful.prototype.bind
  59029. * @description 绑定事件。
  59030. * @param {string} event - 事件名。
  59031. * @param {boolean} handler - 响应函数。
  59032. * @param {Object} context - context。
  59033. * @returns {LevelRenderer.Eventful} this
  59034. */
  59035. bind(event, handler, context) {
  59036. var _h = this._handlers;
  59037. if (!handler || !event) {
  59038. return this;
  59039. }
  59040. if (!_h[event]) {
  59041. _h[event] = [];
  59042. }
  59043. _h[event].push({
  59044. h: handler,
  59045. one: false,
  59046. ctx: context || this
  59047. });
  59048. return this;
  59049. }
  59050. /**
  59051. * @function LevelRenderer.Eventful.prototype.unbind
  59052. * @description 解绑事件。
  59053. * @param {string} event - 事件名。
  59054. * @param {boolean} handler - 响应函数。
  59055. * @returns {LevelRenderer.Eventful} this
  59056. */
  59057. unbind(event, handler) {
  59058. var _h = this._handlers;
  59059. if (!event) {
  59060. this._handlers = {};
  59061. return this;
  59062. }
  59063. if (handler) {
  59064. if (_h[event]) {
  59065. var newList = [];
  59066. for (var i = 0, l = _h[event].length; i < l; i++) {
  59067. if (_h[event][i]['h'] != handler) {
  59068. newList.push(_h[event][i]);
  59069. }
  59070. }
  59071. _h[event] = newList;
  59072. }
  59073. if (_h[event] && _h[event].length === 0) {
  59074. delete _h[event];
  59075. }
  59076. } else {
  59077. delete _h[event];
  59078. }
  59079. return this;
  59080. }
  59081. /**
  59082. * @function LevelRenderer.Eventful.prototype.dispatch
  59083. * @description 事件分发。
  59084. * @param {string} type - 事件类型。
  59085. * @returns {LevelRenderer.Eventful} this
  59086. */
  59087. dispatch(type) {
  59088. if (this._handlers[type]) {
  59089. var args = arguments;
  59090. var argLen = args.length;
  59091. if (argLen > 3) {
  59092. args = Array.prototype.slice.call(args, 1);
  59093. }
  59094. var _h = this._handlers[type];
  59095. var len = _h.length;
  59096. for (var i = 0; i < len;) {
  59097. // Optimize advise from backbone
  59098. switch (argLen) {
  59099. case 1:
  59100. _h[i]['h'].call(_h[i]['ctx']);
  59101. break;
  59102. case 2:
  59103. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  59104. break;
  59105. case 3:
  59106. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  59107. break;
  59108. default:
  59109. // have more than 2 given arguments
  59110. _h[i]['h'].apply(_h[i]['ctx'], args);
  59111. break;
  59112. }
  59113. if (_h[i]['one']) {
  59114. _h.splice(i, 1);
  59115. len--;
  59116. } else {
  59117. i++;
  59118. }
  59119. }
  59120. }
  59121. return this;
  59122. }
  59123. /**
  59124. * @function LevelRenderer.Eventful.prototype.dispatchWithContext
  59125. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  59126. * @param {string} type - 事件类型。
  59127. * @returns {LevelRenderer.Eventful} this
  59128. */
  59129. dispatchWithContext(type) {
  59130. if (this._handlers[type]) {
  59131. var args = arguments;
  59132. var argLen = args.length;
  59133. if (argLen > 4) {
  59134. args = Array.prototype.slice.call(args, 1, args.length - 1);
  59135. }
  59136. var ctx = args[args.length - 1];
  59137. var _h = this._handlers[type];
  59138. var len = _h.length;
  59139. for (var i = 0; i < len;) {
  59140. // Optimize advise from backbone
  59141. switch (argLen) {
  59142. case 1:
  59143. _h[i]['h'].call(ctx);
  59144. break;
  59145. case 2:
  59146. _h[i]['h'].call(ctx, args[1]);
  59147. break;
  59148. case 3:
  59149. _h[i]['h'].call(ctx, args[1], args[2]);
  59150. break;
  59151. default:
  59152. // have more than 2 given arguments
  59153. _h[i]['h'].apply(ctx, args);
  59154. break;
  59155. }
  59156. if (_h[i]['one']) {
  59157. _h.splice(i, 1);
  59158. len--;
  59159. } else {
  59160. i++;
  59161. }
  59162. }
  59163. }
  59164. return this;
  59165. }
  59166. }
  59167. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  59168. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59169. * This program are made available under the terms of the Apache License, Version 2.0
  59170. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59171. /**
  59172. * @private
  59173. * @class LevelRenderer.Tool.Vector
  59174. * @category Visualization Theme
  59175. * @classdesc LevelRenderer 二维向量类
  59176. *
  59177. */
  59178. class levelRenderer_Vector_Vector {
  59179. constructor() {
  59180. this.ArrayCtor = typeof Float32Array === 'undefined'
  59181. ? Array
  59182. : Float32Array;
  59183. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  59184. }
  59185. /**
  59186. * @function LevelRenderer.Tool.Vector.prototype.create
  59187. * @description 创建一个向量。
  59188. *
  59189. * @param {number} x - x坐标
  59190. * @param {number} y - Y坐标
  59191. * @return {Vector2} 向量。
  59192. */
  59193. create(x, y) {
  59194. var ArrayCtor = this.ArrayCtor;
  59195. var out = new ArrayCtor(2);
  59196. out[0] = x || 0;
  59197. out[1] = y || 0;
  59198. return out;
  59199. }
  59200. /**
  59201. * @function LevelRenderer.Tool.Vector.prototype.copy
  59202. * @description 复制一个向量。
  59203. *
  59204. * @param {Vector2} out - 基础向量。
  59205. * @param {Vector2} v - 向量。
  59206. * @return {Vector2} 克隆向量。
  59207. */
  59208. copy(out, v) {
  59209. out[0] = v[0];
  59210. out[1] = v[1];
  59211. return out;
  59212. }
  59213. /**
  59214. * @function LevelRenderer.Tool.Vector.prototype.set
  59215. * @description 设置向量的两个项。
  59216. *
  59217. * @param {Vector2} out - 基础向量。
  59218. * @param {number} a - 项 a。
  59219. * @param {number} b - 项 b。
  59220. * @return {Vector2} 结果。
  59221. */
  59222. set(out, a, b) {
  59223. out[0] = a;
  59224. out[1] = b;
  59225. return out;
  59226. }
  59227. /**
  59228. * @function LevelRenderer.Tool.Vector.prototype.add
  59229. * @description 向量相加。
  59230. *
  59231. * @param {Vector2} out - 基础向量。
  59232. * @param {Vector2} v1 - 向量 v1。
  59233. * @param {Vector2} v2 - 向量 v2。
  59234. * @return {Vector2} 结果。
  59235. */
  59236. add(out, v1, v2) {
  59237. out[0] = v1[0] + v2[0];
  59238. out[1] = v1[1] + v2[1];
  59239. return out;
  59240. }
  59241. /**
  59242. * @function LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  59243. * @description 向量缩放后相加。
  59244. * @param {Vector2} out - 基础向量。
  59245. * @param {Vector2} v1 - 向量 v1。
  59246. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  59247. * @param {number} a - 缩放参数。
  59248. * @return {Vector2} 结果。
  59249. */
  59250. scaleAndAdd(out, v1, v2, a) {
  59251. out[0] = v1[0] + v2[0] * a;
  59252. out[1] = v1[1] + v2[1] * a;
  59253. return out;
  59254. }
  59255. /**
  59256. * @function LevelRenderer.Tool.Vector.prototype.sub
  59257. * @description 向量相减。
  59258. * @param {Vector2} out - 基础向量。
  59259. * @param {Vector2} v1 - 向量 v1。
  59260. * @param {Vector2} v2 - 向量 v2。
  59261. * @return {Vector2} 结果。
  59262. */
  59263. sub(out, v1, v2) {
  59264. out[0] = v1[0] - v2[0];
  59265. out[1] = v1[1] - v2[1];
  59266. return out;
  59267. }
  59268. /**
  59269. * @function LevelRenderer.Tool.Vector.prototype.len
  59270. * @description 向量长度。
  59271. * @param {Vector2} v - 向量。
  59272. * @return {number} 向量长度。
  59273. */
  59274. len(v) {
  59275. return Math.sqrt(this.lenSquare(v));
  59276. }
  59277. /**
  59278. * @function LevelRenderer.Tool.Vector.prototype.lenSquare
  59279. * @description 向量长度平方。
  59280. * @param {Vector2} v - 向量。
  59281. * @return {number} 向量长度平方。
  59282. */
  59283. lenSquare(v) {
  59284. return v[0] * v[0] + v[1] * v[1];
  59285. }
  59286. /**
  59287. * @function LevelRenderer.Tool.Vector.prototype.mul
  59288. * @description 向量乘法。
  59289. * @param {Vector2} out - 基础向量。
  59290. * @param {Vector2} v1 - 向量 v1。
  59291. * @param {Vector2} v2 - 向量 v2。
  59292. * @return {Vector2} 结果。
  59293. */
  59294. mul(out, v1, v2) {
  59295. out[0] = v1[0] * v2[0];
  59296. out[1] = v1[1] * v2[1];
  59297. return out;
  59298. }
  59299. /**
  59300. * @function LevelRenderer.Tool.Vector.prototype.div
  59301. * @description 向量除法。
  59302. *
  59303. * @param {Vector2} out - 基础向量。
  59304. * @param {Vector2} v1 - 向量 v1。
  59305. * @param {Vector2} v2 - 向量 v2。
  59306. * @return {Vector2} 结果。
  59307. */
  59308. div(out, v1, v2) {
  59309. out[0] = v1[0] / v2[0];
  59310. out[1] = v1[1] / v2[1];
  59311. return out;
  59312. }
  59313. /**
  59314. * @function LevelRenderer.Tool.Vector.prototype.dot
  59315. * @description 向量点乘。
  59316. *
  59317. * @param {Vector2} v1 - 向量 v1。
  59318. * @param {Vector2} v2 - 向量 v2。
  59319. * @return {number} 向量点乘。
  59320. */
  59321. dot(v1, v2) {
  59322. return v1[0] * v2[0] + v1[1] * v2[1];
  59323. }
  59324. /**
  59325. * @function LevelRenderer.Tool.Vector.prototype.scale
  59326. * @description 向量缩放。
  59327. *
  59328. * @param {Vector2} out - 基础向量。
  59329. * @param {Vector2} v - 向量v。
  59330. * @param {number} s -缩放参数。
  59331. * @return {Vector2} 结果。
  59332. */
  59333. scale(out, v, s) {
  59334. out[0] = v[0] * s;
  59335. out[1] = v[1] * s;
  59336. return out;
  59337. }
  59338. /**
  59339. * @function LevelRenderer.Tool.Vector.prototype.normalize
  59340. * @description 向量归一化。
  59341. *
  59342. * @param {Vector2} out - 基础向量。
  59343. * @param {Vector2} v - 向量 v。
  59344. * @return {Vector2} 结果。
  59345. */
  59346. normalize(out, v) {
  59347. var d = this.len(v);
  59348. if (d === 0) {
  59349. out[0] = 0;
  59350. out[1] = 0;
  59351. } else {
  59352. out[0] = v[0] / d;
  59353. out[1] = v[1] / d;
  59354. }
  59355. return out;
  59356. }
  59357. /**
  59358. * @function LevelRenderer.Tool.Vector.prototype.distance
  59359. * @description 计算向量间距离。
  59360. *
  59361. * @param {Vector2} v1 - 向量 v1。
  59362. * @param {Vector2} v2 - 向量 v2。
  59363. * @return {number} 向量间距离。
  59364. */
  59365. distance(v1, v2) {
  59366. return Math.sqrt(
  59367. (v1[0] - v2[0]) * (v1[0] - v2[0])
  59368. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  59369. );
  59370. }
  59371. /**
  59372. * @function LevelRenderer.Tool.Vector.prototype.distanceSquare
  59373. * @description 向量距离平方。
  59374. *
  59375. * @param {Vector2} v1 - 向量 v1。
  59376. * @param {Vector2} v2 - 向量 v2。
  59377. * @return {number} 向量距离平方。
  59378. */
  59379. distanceSquare(v1, v2) {
  59380. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  59381. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  59382. }
  59383. /**
  59384. * @function LevelRenderer.Tool.Vector.prototype.negate
  59385. * @description 求负向量。
  59386. *
  59387. * @param {Vector2} out - 基础向量。
  59388. * @param {Vector2} v - 向量 v。
  59389. * @return {Vector2} 负向量。
  59390. */
  59391. negate(out, v) {
  59392. out[0] = -v[0];
  59393. out[1] = -v[1];
  59394. return out;
  59395. }
  59396. /**
  59397. * @function LevelRenderer.Tool.Vector.prototype.lerp
  59398. * @description 两点之间线性插值。
  59399. *
  59400. * @param {Vector2} out - 基础向量。
  59401. * @param {Vector2} v1 - 向量 v1。
  59402. * @param {Vector2} v2 - 向量 v2。
  59403. * @param {number} t
  59404. * @return {Vector2} 结果。
  59405. */
  59406. lerp(out, v1, v2, t) {
  59407. out[0] = v1[0] + t * (v2[0] - v1[0]);
  59408. out[1] = v1[1] + t * (v2[1] - v1[1]);
  59409. return out;
  59410. }
  59411. /**
  59412. * @function LevelRenderer.Tool.Vector.prototype.applyTransform
  59413. * @description 矩阵左乘向量。
  59414. *
  59415. * @param {Vector2} out - 基础向量。
  59416. * @param {Vector2} v1 - 向量 v1。
  59417. * @param {Vector2} v2 - 向量 v2。
  59418. * @return {Vector2} 结果。
  59419. */
  59420. applyTransform(out, v, m) {
  59421. var x = v[0];
  59422. var y = v[1];
  59423. out[0] = m[0] * x + m[2] * y + m[4];
  59424. out[1] = m[1] * x + m[3] * y + m[5];
  59425. return out;
  59426. }
  59427. /**
  59428. * @function LevelRenderer.Tool.Vector.prototype.min
  59429. * @description 求两个向量最小值。
  59430. * @param {Vector2} out - 基础向量。
  59431. * @param {Vector2} v1 - 向量 v1。
  59432. * @param {Vector2} v2 - 向量 v2。
  59433. * @return {Vector2} 结果。
  59434. */
  59435. min(out, v1, v2) {
  59436. out[0] = Math.min(v1[0], v2[0]);
  59437. out[1] = Math.min(v1[1], v2[1]);
  59438. return out;
  59439. }
  59440. /**
  59441. * @function LevelRenderer.Tool.Vector.prototype.max
  59442. * @description 求两个向量最大值。
  59443. *
  59444. * @param {Vector2} out - 基础向量。
  59445. * @param {Vector2} v1 - 向量 v1。
  59446. * @param {Vector2} v2 - 向量 v2。
  59447. * @return {Vector2} 结果。
  59448. */
  59449. max(out, v1, v2) {
  59450. out[0] = Math.max(v1[0], v2[0]);
  59451. out[1] = Math.max(v1[1], v2[1]);
  59452. return out;
  59453. }
  59454. /**
  59455. * @function LevelRenderer.Tool.Vector.prototype.length
  59456. * @description 向量长度。
  59457. *
  59458. * @param {Vector2} v - 向量。
  59459. * @return {number} 向量长度。
  59460. */
  59461. length(v) {
  59462. return this.len(v);
  59463. }
  59464. /**
  59465. * @function LevelRenderer.Tool.Vector.prototype.lengthSquare
  59466. * @description 向量长度平方。
  59467. *
  59468. * @param {Vector2} v - 向量。
  59469. * @return {number} 向量长度平方。
  59470. */
  59471. lengthSquare(v) {
  59472. return this.lenSquare(v);
  59473. }
  59474. /**
  59475. * @function LevelRenderer.Tool.Vector.prototype.dist
  59476. * @description 计算向量间距离。
  59477. *
  59478. * @param {Vector2} v1 - 向量 v1。
  59479. * @param {Vector2} v2 - 向量 v2。
  59480. * @return {number} 向量间距离。
  59481. */
  59482. dist(v1, v2) {
  59483. return this.distance(v1, v2);
  59484. }
  59485. /**
  59486. * @function LevelRenderer.Tool.Vector.prototype.distSquare
  59487. * @description 向量距离平方。
  59488. *
  59489. * @param {Vector2} v1 - 向量 v1。
  59490. * @param {Vector2} v2 - 向量 v2。
  59491. * @return {number} 向量距离平方
  59492. */
  59493. distSquare(v1, v2) {
  59494. return this.distanceSquare(v1, v2);
  59495. }
  59496. }
  59497. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  59498. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59499. * This program are made available under the terms of the Apache License, Version 2.0
  59500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59501. /**
  59502. * @class LevelRenderer.Tool.Curve
  59503. * @category Visualization Theme
  59504. * @classdesc LevelRenderer 工具-曲线
  59505. * @private
  59506. */
  59507. class Curve_Curve {
  59508. constructor() {
  59509. /**
  59510. * @member {LevelRenderer.Tool.Vector} LevelRenderer.Tool.Curve.prototype.vector
  59511. * @description 矢量工具。
  59512. */
  59513. this.vector = new levelRenderer_Vector_Vector();
  59514. /**
  59515. * @member {number} LevelRenderer.Tool.Curve.prototype.EPSILON
  59516. * @description e。
  59517. */
  59518. this.EPSILON = 1e-4;
  59519. /**
  59520. * @member {number} LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  59521. * @description 3 的平方根。
  59522. */
  59523. this.THREE_SQRT = Math.sqrt(3);
  59524. /**
  59525. * @member {number} LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  59526. * @description 1/3。
  59527. */
  59528. this.ONE_THIRD = 1 / 3;
  59529. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  59530. }
  59531. /*
  59532. * Method: evalCubicCoeff
  59533. *
  59534. * Parameters:
  59535. * a - {number} 值。
  59536. * b - {number} 值。
  59537. * c - {number} 值。
  59538. * d - {number} 值。
  59539. * t - {number} 值。
  59540. *
  59541. * Returns:
  59542. * {number}
  59543. */
  59544. /*
  59545. evalCubicCoeff: function(a, b, c, d, t){
  59546. return ((a * t + b) * t + c) * t + d;
  59547. },
  59548. */
  59549. /**
  59550. * @function LevelRenderer.Tool.Curve.prototype.isAroundZero
  59551. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  59552. * @param {number} val - 值。
  59553. * @returns {boolean} 值是否趋于0。
  59554. */
  59555. isAroundZero(val) {
  59556. return val > -this.EPSILON && val < this.EPSILON;
  59557. }
  59558. /**
  59559. * @function LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  59560. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  59561. * @param {number} val - 值。
  59562. * @returns {boolean} 值是否不趋于0。
  59563. */
  59564. isNotAroundZero(val) {
  59565. return val > this.EPSILON || val < -this.EPSILON;
  59566. }
  59567. /**
  59568. * @function LevelRenderer.Tool.Curve.prototype.cubicAt
  59569. * @description 计算三次贝塞尔值
  59570. * @param {number} p0 - 点p0。
  59571. * @param {number} p1 - 点p1。
  59572. * @param {number} p2 - 点p2。
  59573. * @param {number} p3 - 点p3。
  59574. * @param {number} t - t值。
  59575. * @returns {number} 三次贝塞尔值。
  59576. */
  59577. cubicAt(p0, p1, p2, p3, t) {
  59578. var onet = 1 - t;
  59579. return onet * onet * (onet * p0 + 3 * t * p1)
  59580. + t * t * (t * p3 + 3 * onet * p2);
  59581. }
  59582. /**
  59583. * @function LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  59584. * @description 计算三次贝塞尔导数值
  59585. * @param {number} p0 - 点p0。
  59586. * @param {number} p1 - 点p1。
  59587. * @param {number} p2 - 点p2。
  59588. * @param {number} p3 - 点p3。
  59589. * @param {number} t - t值。
  59590. * @returns {number} 三次贝塞尔导数值。
  59591. */
  59592. cubicDerivativeAt(p0, p1, p2, p3, t) {
  59593. var onet = 1 - t;
  59594. return 3 * (
  59595. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  59596. + (p3 - p2) * t * t
  59597. );
  59598. }
  59599. /**
  59600. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  59601. * @description 计算三次贝塞尔方程根,使用盛金公式
  59602. * @param {number} p0 - 点p0。
  59603. * @param {number} p1 - 点p1。
  59604. * @param {number} p2 - 点p2。
  59605. * @param {number} p3 - 点p3。
  59606. * @param {number} val - 值。
  59607. * @param {Array.<number>} roots - 有效根数目。
  59608. * @returns {number} 有效根。
  59609. */
  59610. cubicRootAt(p0, p1, p2, p3, val, roots) {
  59611. // Evaluate roots of cubic functions
  59612. var a = p3 + 3 * (p1 - p2) - p0;
  59613. var b = 3 * (p2 - p1 * 2 + p0);
  59614. var c = 3 * (p1 - p0);
  59615. var d = p0 - val;
  59616. var A = b * b - 3 * a * c;
  59617. var B = b * c - 9 * a * d;
  59618. var C = c * c - 3 * b * d;
  59619. var n = 0;
  59620. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  59621. if (this.isAroundZero(b)) {
  59622. roots[0] = 0;
  59623. } else {
  59624. let t1 = -c / b; //t1, t2, t3, b is not zero
  59625. if (t1 >= 0 && t1 <= 1) {
  59626. roots[n++] = t1;
  59627. }
  59628. }
  59629. } else {
  59630. var disc = B * B - 4 * A * C;
  59631. if (this.isAroundZero(disc)) {
  59632. var K = B / A;
  59633. let t1 = -b / a + K; // t1, a is not zero
  59634. let t2 = -K / 2; // t2, t3
  59635. if (t1 >= 0 && t1 <= 1) {
  59636. roots[n++] = t1;
  59637. }
  59638. if (t2 >= 0 && t2 <= 1) {
  59639. roots[n++] = t2;
  59640. }
  59641. } else if (disc > 0) {
  59642. let discSqrt = Math.sqrt(disc);
  59643. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  59644. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  59645. if (Y1 < 0) {
  59646. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  59647. } else {
  59648. Y1 = Math.pow(Y1, this.ONE_THIRD);
  59649. }
  59650. if (Y2 < 0) {
  59651. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  59652. } else {
  59653. Y2 = Math.pow(Y2, this.ONE_THIRD);
  59654. }
  59655. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  59656. if (t1 >= 0 && t1 <= 1) {
  59657. roots[n++] = t1;
  59658. }
  59659. } else {
  59660. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  59661. var theta = Math.acos(T) / 3;
  59662. var ASqrt = Math.sqrt(A);
  59663. var tmp = Math.cos(theta);
  59664. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  59665. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  59666. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  59667. if (t1 >= 0 && t1 <= 1) {
  59668. roots[n++] = t1;
  59669. }
  59670. if (t2 >= 0 && t2 <= 1) {
  59671. roots[n++] = t2;
  59672. }
  59673. if (t3 >= 0 && t3 <= 1) {
  59674. roots[n++] = t3;
  59675. }
  59676. }
  59677. }
  59678. return n;
  59679. }
  59680. /**
  59681. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  59682. * @description 计算三次贝塞尔方程极限值的位置
  59683. * @param {number} p0 - 点p0。
  59684. * @param {number} p1 - 点p1。
  59685. * @param {number} p2 - 点p2。
  59686. * @param {number} p3 - 点p3。
  59687. * @param {Array.<number>} extrema - 值。
  59688. * @returns {number} 有效数目。
  59689. */
  59690. cubicExtrema(p0, p1, p2, p3, extrema) {
  59691. var b = 6 * p2 - 12 * p1 + 6 * p0;
  59692. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  59693. var c = 3 * p1 - 3 * p0;
  59694. var n = 0;
  59695. if (this.isAroundZero(a)) {
  59696. if (this.isNotAroundZero(b)) {
  59697. let t1 = -c / b;
  59698. if (t1 >= 0 && t1 <= 1) {
  59699. extrema[n++] = t1;
  59700. }
  59701. }
  59702. } else {
  59703. var disc = b * b - 4 * a * c;
  59704. if (this.isAroundZero(disc)) {
  59705. extrema[0] = -b / (2 * a);
  59706. } else if (disc > 0) {
  59707. let discSqrt = Math.sqrt(disc);
  59708. let t1 = (-b + discSqrt) / (2 * a);
  59709. let t2 = (-b - discSqrt) / (2 * a);
  59710. if (t1 >= 0 && t1 <= 1) {
  59711. extrema[n++] = t1;
  59712. }
  59713. if (t2 >= 0 && t2 <= 1) {
  59714. extrema[n++] = t2;
  59715. }
  59716. }
  59717. }
  59718. return n;
  59719. }
  59720. /**
  59721. * @function LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  59722. * @description 细分三次贝塞尔曲线
  59723. * @param {number} p0 - 点p0。
  59724. * @param {number} p1 - 点p1。
  59725. * @param {number} p2 - 点p2。
  59726. * @param {number} p3 - 点p3。
  59727. * @param {number} t - t值。
  59728. * @param {Array.<number>} out - 投射点。
  59729. * @returns {number} 投射点。
  59730. */
  59731. cubicSubdivide(p0, p1, p2, p3, t, out) {
  59732. var p01 = (p1 - p0) * t + p0;
  59733. var p12 = (p2 - p1) * t + p1;
  59734. var p23 = (p3 - p2) * t + p2;
  59735. var p012 = (p12 - p01) * t + p01;
  59736. var p123 = (p23 - p12) * t + p12;
  59737. var p0123 = (p123 - p012) * t + p012;
  59738. // Seg0
  59739. out[0] = p0;
  59740. out[1] = p01;
  59741. out[2] = p012;
  59742. out[3] = p0123;
  59743. // Seg1
  59744. out[4] = p0123;
  59745. out[5] = p123;
  59746. out[6] = p23;
  59747. out[7] = p3;
  59748. }
  59749. /**
  59750. * @function LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  59751. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  59752. * @param {number} x0 - 点p0横坐标。
  59753. * @param {number} y0 - 点p0纵坐标。
  59754. * @param {number} x1 - 点p1横坐标。
  59755. * @param {number} y1 - 点p1纵坐标。
  59756. * @param {number} x2 - 点p2横坐标。
  59757. * @param {number} y2 - 点p2纵坐标。
  59758. * @param {number} x3 - 点p3横坐标。
  59759. * @param {number} y3 - 点p3纵坐标。
  59760. * @param {number} x - 点p横坐标。
  59761. * @param {number} y - 点p纵坐标。
  59762. * @param {Array.<number>} out - 投射点。
  59763. * @returns {number} 投射点。
  59764. */
  59765. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  59766. // 临时变量
  59767. var _v0 = this.vector.create();
  59768. var _v1 = this.vector.create();
  59769. var _v2 = this.vector.create();
  59770. // var _v3 = vector.create();
  59771. // http://pomax.github.io/bezierinfo/#projections
  59772. var t;
  59773. var interval = 0.005;
  59774. var d = Infinity;
  59775. _v0[0] = x;
  59776. _v0[1] = y;
  59777. // 先粗略估计一下可能的最小距离的 t 值
  59778. // PENDING
  59779. for (let _t = 0; _t < 1; _t += 0.05) {
  59780. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  59781. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  59782. let d1 = this.vector.distSquare(_v0, _v1);
  59783. if (d1 < d) {
  59784. t = _t;
  59785. d = d1;
  59786. }
  59787. }
  59788. d = Infinity;
  59789. // At most 32 iteration
  59790. for (let i = 0; i < 32; i++) {
  59791. if (interval < this.EPSILON) {
  59792. break;
  59793. }
  59794. let prev = t - interval;
  59795. let next = t + interval;
  59796. // t - interval
  59797. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  59798. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  59799. let d1 = this.vector.distSquare(_v1, _v0);
  59800. if (prev >= 0 && d1 < d) {
  59801. t = prev;
  59802. d = d1;
  59803. } else {
  59804. // t + interval
  59805. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  59806. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  59807. let d2 = this.vector.distSquare(_v2, _v0);
  59808. if (next <= 1 && d2 < d) {
  59809. t = next;
  59810. d = d2;
  59811. } else {
  59812. interval *= 0.5;
  59813. }
  59814. }
  59815. }
  59816. // t
  59817. if (out) {
  59818. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  59819. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  59820. }
  59821. // console.log(interval, i);
  59822. return Math.sqrt(d);
  59823. }
  59824. /**
  59825. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  59826. * @description 计算二次方贝塞尔值。
  59827. * @param {number} p0 - 点p0。
  59828. * @param {number} p1 - 点p1。
  59829. * @param {number} p2 - 点p2。
  59830. * @param {number} t - t值。
  59831. * @returns {number} 二次方贝塞尔值。
  59832. */
  59833. quadraticAt(p0, p1, p2, t) {
  59834. var onet = 1 - t;
  59835. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  59836. }
  59837. /**
  59838. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  59839. * @description 计算二次方贝塞尔导数值。
  59840. * @param {number} p0 - 点p0。
  59841. * @param {number} p1 - 点p1。
  59842. * @param {number} p2 - 点p2。
  59843. * @param {number} t - t值。
  59844. * @returns {number} 二次方贝塞尔导数值。
  59845. */
  59846. quadraticDerivativeAt(p0, p1, p2, t) {
  59847. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  59848. }
  59849. /**
  59850. * @function LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  59851. * @description 计算二次方贝塞尔方程根
  59852. * @param {number} p0 - 点p0。
  59853. * @param {number} p1 - 点p1。
  59854. * @param {number} p2 - 点p2。
  59855. * @param {number} val - 值。
  59856. * @param {Array.<number>} roots - 有效根数目。
  59857. * @returns {number} 有效根数目。
  59858. */
  59859. quadraticRootAt(p0, p1, p2, val, roots) {
  59860. var a = p0 - 2 * p1 + p2;
  59861. var b = 2 * (p1 - p0);
  59862. var c = p0 - val;
  59863. var n = 0;
  59864. if (this.isAroundZero(a)) {
  59865. if (this.isNotAroundZero(b)) {
  59866. var t1 = -c / b;
  59867. if (t1 >= 0 && t1 <= 1) {
  59868. roots[n++] = t1;
  59869. }
  59870. }
  59871. } else {
  59872. var disc = b * b - 4 * a * c;
  59873. if (this.isAroundZero(disc)) {
  59874. let t1 = -b / (2 * a);
  59875. if (t1 >= 0 && t1 <= 1) {
  59876. roots[n++] = t1;
  59877. }
  59878. } else if (disc > 0) {
  59879. let discSqrt = Math.sqrt(disc);
  59880. let t1 = (-b + discSqrt) / (2 * a);
  59881. let t2 = (-b - discSqrt) / (2 * a);
  59882. if (t1 >= 0 && t1 <= 1) {
  59883. roots[n++] = t1;
  59884. }
  59885. if (t2 >= 0 && t2 <= 1) {
  59886. roots[n++] = t2;
  59887. }
  59888. }
  59889. }
  59890. return n;
  59891. }
  59892. /**
  59893. * @function LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  59894. * @description 计算二次贝塞尔方程极限值
  59895. * @param {number} p0 - 点p0。
  59896. * @param {number} p1 - 点p1。
  59897. * @param {number} p2 - 点p2。
  59898. * @returns {number} 二次贝塞尔方程极限值。
  59899. */
  59900. quadraticExtremum(p0, p1, p2) {
  59901. var divider = p0 + p2 - 2 * p1;
  59902. if (divider === 0) {
  59903. // p1 is center of p0 and p2
  59904. return 0.5;
  59905. } else {
  59906. return (p0 - p1) / divider;
  59907. }
  59908. }
  59909. /**
  59910. * @function LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  59911. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  59912. * @param {number} x0 - 点p0横坐标。
  59913. * @param {number} y0 - 点p0纵坐标。
  59914. * @param {number} x1 - 点p1横坐标。
  59915. * @param {number} y1 - 点p1纵坐标。
  59916. * @param {number} x2 - 点p2横坐标。
  59917. * @param {number} y2 - 点p2纵坐标。
  59918. * @param {number} x - 点p横坐标。
  59919. * @param {number} y - 点p纵坐标。
  59920. * @param {Array.<number>} out - 投射点。
  59921. * @returns {number} 投射距离。
  59922. */
  59923. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  59924. // 临时变量
  59925. var _v0 = this.vector.create();
  59926. var _v1 = this.vector.create();
  59927. var _v2 = this.vector.create();
  59928. // http://pomax.github.io/bezierinfo/#projections
  59929. var t;
  59930. var interval = 0.005;
  59931. var d = Infinity;
  59932. _v0[0] = x;
  59933. _v0[1] = y;
  59934. // 先粗略估计一下可能的最小距离的 t 值
  59935. // PENDING
  59936. for (let _t = 0; _t < 1; _t += 0.05) {
  59937. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  59938. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  59939. let d1 = this.vector.distSquare(_v0, _v1);
  59940. if (d1 < d) {
  59941. t = _t;
  59942. d = d1;
  59943. }
  59944. }
  59945. d = Infinity;
  59946. // At most 32 iteration
  59947. for (let i = 0; i < 32; i++) {
  59948. if (interval < this.EPSILON) {
  59949. break;
  59950. }
  59951. let prev = t - interval;
  59952. let next = t + interval;
  59953. // t - interval
  59954. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  59955. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  59956. let d1 = this.vector.distSquare(_v1, _v0);
  59957. if (prev >= 0 && d1 < d) {
  59958. t = prev;
  59959. d = d1;
  59960. } else {
  59961. // t + interval
  59962. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  59963. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  59964. let d2 = this.vector.distSquare(_v2, _v0);
  59965. if (next <= 1 && d2 < d) {
  59966. t = next;
  59967. d = d2;
  59968. } else {
  59969. interval *= 0.5;
  59970. }
  59971. }
  59972. }
  59973. // t
  59974. if (out) {
  59975. out[0] = this.quadraticAt(x0, x1, x2, t);
  59976. out[1] = this.quadraticAt(y0, y1, y2, t);
  59977. }
  59978. // console.log(interval, i);
  59979. return Math.sqrt(d);
  59980. }
  59981. }
  59982. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  59983. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59984. * This program are made available under the terms of the Apache License, Version 2.0
  59985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59986. /**
  59987. * @class LevelRenderer.Tool.Area
  59988. * @category Visualization Theme
  59989. * @classdesc LevelRenderer 工具-图形范围判断
  59990. * @private
  59991. */
  59992. class Area {
  59993. constructor() {
  59994. /**
  59995. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Areal.prototype.util
  59996. * @description 基础工具对象。
  59997. */
  59998. this.util = new levelRenderer_Util_Util();
  59999. /**
  60000. * @member {LevelRenderer.Tool.Curve} LevelRenderer.Tool.Areal.prototype.curve
  60001. * @description 曲线工具对象
  60002. */
  60003. this.curve = new Curve_Curve();
  60004. /**
  60005. * @member {Object} LevelRenderer.Tool.Areal.prototype._ctx
  60006. * @description Cavans2D 渲染上下文
  60007. */
  60008. this._ctx = null;
  60009. /**
  60010. * @member {Object} LevelRenderer.Tool.Areal.prototype._textWidthCache
  60011. * @description 文本宽度缓存
  60012. */
  60013. this._textWidthCache = {};
  60014. /**
  60015. * @member {Object} LevelRenderer.Tool.Areal.prototype._textHeightCache
  60016. * @description 文本高度缓存
  60017. */
  60018. this._textHeightCache = {};
  60019. /**
  60020. * @member {number} LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  60021. * @description 文本宽度缓存数量
  60022. */
  60023. this._textWidthCacheCounter = 0;
  60024. /**
  60025. * @member {number} LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  60026. * @description 文本高度缓存数量
  60027. */
  60028. this._textHeightCacheCounter = 0;
  60029. /**
  60030. * @member {number} LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  60031. * @description 文本最大缓存数量
  60032. */
  60033. this.TEXT_CACHE_MAX = 5000;
  60034. /**
  60035. * @member {number} LevelRenderer.Tool.Areal.prototype.PI2
  60036. * @description 2*PI 的值
  60037. */
  60038. this.PI2 = Math.PI * 2;
  60039. /**
  60040. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.roots
  60041. * @description 临时数组
  60042. */
  60043. this.roots = [-1, -1, -1];
  60044. /**
  60045. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.extrema
  60046. * @description 临时数组
  60047. */
  60048. this.extrema = [-1, -1];
  60049. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  60050. }
  60051. /**
  60052. * @function LevelRenderer.Tool.Areal.prototype.normalizeRadian
  60053. * @description 弧度标准化函数。
  60054. * @param {number} angle - 弧度值。
  60055. * @returns {number} 标准化后的弧度值。
  60056. */
  60057. normalizeRadian(angle) {
  60058. angle %= this.PI2;
  60059. if (angle < 0) {
  60060. angle += this.PI2;
  60061. }
  60062. return angle;
  60063. }
  60064. /**
  60065. * @function LevelRenderer.Tool.Areal.prototype.isInside
  60066. * @description 包含判断。
  60067. * @param {Object} shape - 图形。
  60068. * @param {number} area - 目标区域。
  60069. * @param {number} x - 横坐标。
  60070. * @param {number} y - 纵坐标。
  60071. * @returns {boolean} 图形是否包含鼠标位置。
  60072. */
  60073. isInside(shape, area, x, y) {
  60074. if (!area || !shape) {
  60075. // 无参数或不支持类型
  60076. return false;
  60077. }
  60078. var zoneType = shape.type;
  60079. this._ctx = this._ctx || this.util.getContext();
  60080. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  60081. var _mathReturn = this._mathMethod(shape, area, x, y);
  60082. if (typeof _mathReturn != 'undefined') {
  60083. return _mathReturn;
  60084. }
  60085. if (shape.buildPath && this._ctx.isPointInPath) {
  60086. return this._buildPathMethod(shape, this._ctx, area, x, y);
  60087. }
  60088. // 上面的方法都行不通时
  60089. switch (zoneType) {
  60090. case 'ellipse': // Todo,不精确
  60091. case 'smicellipse': // Todo,不精确
  60092. return true;
  60093. // 旋轮曲线 不准确
  60094. case 'trochoid':
  60095. var _r = area.location == 'out'
  60096. ? area.r1 + area.r2 + area.d
  60097. : area.r1 - area.r2 + area.d;
  60098. return this.isInsideCircle(area, x, y, _r);
  60099. // 玫瑰线 不准确
  60100. case 'rose' :
  60101. return this.isInsideCircle(area, x, y, area.maxr);
  60102. // 路径,椭圆,曲线等-----------------13
  60103. default:
  60104. return false; // Todo,暂不支持
  60105. }
  60106. }
  60107. /**
  60108. * @function LevelRenderer.Tool.Areal.prototype._mathMethod
  60109. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  60110. * @param {Object} shape - 图形。
  60111. * @param {number} area - 目标区域。
  60112. * @param {number} x - 横坐标。
  60113. * @param {number} y - 纵坐标。
  60114. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  60115. */
  60116. _mathMethod(shape, area, x, y) {
  60117. var zoneType = shape.type;
  60118. // 在矩形内则部分图形需要进一步判断
  60119. switch (zoneType) {
  60120. // 贝塞尔曲线
  60121. case 'bezier-curve':
  60122. if (typeof(area.cpX2) === 'undefined') {
  60123. return this.isInsideQuadraticStroke(
  60124. area.xStart, area.yStart,
  60125. area.cpX1, area.cpY1,
  60126. area.xEnd, area.yEnd,
  60127. area.lineWidth, x, y
  60128. );
  60129. }
  60130. return this.isInsideCubicStroke(
  60131. area.xStart, area.yStart,
  60132. area.cpX1, area.cpY1,
  60133. area.cpX2, area.cpY2,
  60134. area.xEnd, area.yEnd,
  60135. area.lineWidth, x, y
  60136. );
  60137. // 线
  60138. case 'line':
  60139. return this.isInsideLine(
  60140. area.xStart, area.yStart,
  60141. area.xEnd, area.yEnd,
  60142. area.lineWidth, x, y
  60143. );
  60144. // 折线
  60145. case 'broken-line':
  60146. return this.isInsideBrokenLine(
  60147. area.pointList, area.lineWidth, x, y
  60148. );
  60149. // 扩展折线
  60150. case 'smicbroken-line': {
  60151. // SMIC-修改 - start
  60152. let icX = x;
  60153. let icY = y;
  60154. if (shape.refOriginalPosition) {
  60155. icX = x - shape.refOriginalPosition[0];
  60156. icY = y - shape.refOriginalPosition[1];
  60157. }
  60158. return this.isInsideBrokenLine(
  60159. area.pointList, area.lineWidth, icX, icY
  60160. );
  60161. }
  60162. //初始代码:
  60163. // return isInsideBrokenLine(
  60164. // area.pointList, area.lineWidth, x, y
  60165. // );
  60166. // SMIC-修改 - end
  60167. // 圆环
  60168. case 'ring':
  60169. return this.isInsideRing(
  60170. area.x, area.y, area.r0, area.r, x, y
  60171. );
  60172. case 'smicring': {
  60173. let areaX = area.x;
  60174. let areaY = area.y;
  60175. if (shape.refOriginalPosition) {
  60176. areaX = area.x + shape.refOriginalPosition[0];
  60177. areaY = area.y + shape.refOriginalPosition[1];
  60178. }
  60179. return this.isInsideRing(
  60180. areaX, areaY, area.r0, area.r, x, y
  60181. );
  60182. }
  60183. // 圆形
  60184. case 'circle':
  60185. return this.isInsideCircle(
  60186. area.x, area.y, area.r, x, y
  60187. );
  60188. // 扩展-点
  60189. case 'smicpoint': {
  60190. // SMIC-修改 - start
  60191. let icX = x;
  60192. let icY = y;
  60193. if (shape.refOriginalPosition) {
  60194. icX = x - shape.refOriginalPosition[0];
  60195. icY = y - shape.refOriginalPosition[1];
  60196. }
  60197. return this.isInsideCircle(
  60198. area.x, area.y, area.r, icX, icY
  60199. );
  60200. }
  60201. //初始代码:
  60202. // 无
  60203. // SMIC-修改 - end
  60204. // 扇形
  60205. case 'sector': {
  60206. let startAngle = area.startAngle * Math.PI / 180;
  60207. let endAngle = area.endAngle * Math.PI / 180;
  60208. if (!area.clockWise) {
  60209. startAngle = -startAngle;
  60210. endAngle = -endAngle;
  60211. }
  60212. return this.isInsideSector(
  60213. area.x, area.y, area.r0, area.r,
  60214. startAngle, endAngle,
  60215. !area.clockWise,
  60216. x, y
  60217. );
  60218. }
  60219. //初始代码:
  60220. // 无
  60221. // SMIC-增加 - end
  60222. // 扇形
  60223. case 'smicsector': {
  60224. let startAngle = area.startAngle * Math.PI / 180;
  60225. let endAngle = area.endAngle * Math.PI / 180;
  60226. if (!area.clockWise) {
  60227. startAngle = -startAngle;
  60228. endAngle = -endAngle;
  60229. }
  60230. let areaX = area.x;
  60231. let areaY = area.y;
  60232. if (shape.refOriginalPosition) {
  60233. areaX = area.x + shape.refOriginalPosition[0];
  60234. areaY = area.y + shape.refOriginalPosition[1];
  60235. }
  60236. return this.isInsideSector(
  60237. areaX, areaY, area.r0, area.r,
  60238. startAngle, endAngle,
  60239. !area.clockWise,
  60240. x, y
  60241. );
  60242. }
  60243. // 多边形
  60244. case 'path':
  60245. return this.isInsidePath(
  60246. area.pathArray, Math.max(area.lineWidth, 5),
  60247. area.brushType, x, y
  60248. );
  60249. case 'polygon':
  60250. case 'star':
  60251. case 'smicstar':
  60252. case 'isogon':
  60253. case 'smicisogon':
  60254. return this.isInsidePolygon(area.pointList, x, y);
  60255. // 扩展多边形
  60256. case 'smicpolygon': {
  60257. // SMIC-修改 - start
  60258. let icX = x;
  60259. let icY = y;
  60260. if (shape.refOriginalPosition) {
  60261. icX = x - shape.refOriginalPosition[0];
  60262. icY = y - shape.refOriginalPosition[1];
  60263. }
  60264. //岛洞面
  60265. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  60266. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  60267. // 遍历岛洞子面
  60268. var holePLS = shape.holePolygonPointLists;
  60269. var isOnHole = false;
  60270. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  60271. var holePL = holePLS[i];
  60272. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  60273. if (isOnSubHole === true) {
  60274. isOnHole = true;
  60275. }
  60276. }
  60277. // 捕获判断
  60278. return isOnBase === true && isOnHole === false;
  60279. } else {
  60280. return this.isInsidePolygon(area.pointList, icX, icY);
  60281. }
  60282. }
  60283. // 初始代码:
  60284. // 无
  60285. // SMIC-修改 - end
  60286. // 文本
  60287. case 'text':
  60288. var rect = area.__rect || shape.getRect(area);
  60289. return this.isInsideRect(
  60290. rect.x, rect.y, rect.width, rect.height, x, y
  60291. );
  60292. // 扩展文本
  60293. case 'smictext':
  60294. //用文本背景矩形判断
  60295. var textBg = shape.getTextBackground(area);
  60296. return this.isInsidePolygon(textBg, x, y);
  60297. //初始代码:
  60298. // 无
  60299. // SMIC-修改 - end
  60300. // 矩形
  60301. case 'rectangle':
  60302. case 'image':
  60303. // 图片
  60304. return this.isInsideRect(
  60305. area.x, area.y, area.width, area.height, x, y
  60306. );
  60307. case 'smicimage': {
  60308. let areaX = area.x;
  60309. let areaY = area.y;
  60310. if (shape.refOriginalPosition) {
  60311. areaX = area.x + shape.refOriginalPosition[0];
  60312. areaY = area.y + shape.refOriginalPosition[1];
  60313. }
  60314. return this.isInsideRect(
  60315. areaX, areaY, area.width, area.height, x, y
  60316. );
  60317. }
  60318. //// 扩展矩形
  60319. //case 'smicpolygon':
  60320. // // SMIC-修改 - start
  60321. // var icX = x;
  60322. // var icY = y;
  60323. // if(shape.refOriginalPosition) {
  60324. // icX = x - shape.refOriginalPosition[0];
  60325. // icY = y - shape.refOriginalPosition[1];
  60326. // }
  60327. // return this.isInsideRect(
  60328. // area.x, area.y, area.width, area.height, icX, icY
  60329. // );
  60330. //初始代码:
  60331. // 无
  60332. // SMIC-修改 - end
  60333. }
  60334. }
  60335. /**
  60336. * @function LevelRenderer.Tool.Areal.prototype._buildPathMethod
  60337. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  60338. * @param {Object} shape - 图形。
  60339. * @param {Object} context - 上下文。
  60340. * @param {number} area - 目标区域。
  60341. * @param {number} x - 横坐标。
  60342. * @param {number} y - 纵坐标。
  60343. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  60344. */
  60345. _buildPathMethod(shape, context, area, x, y) {
  60346. // 图形类实现路径创建了则用类的path
  60347. context.beginPath();
  60348. shape.buildPath(context, area);
  60349. context.closePath();
  60350. return context.isPointInPath(x, y);
  60351. }
  60352. /**
  60353. * @function LevelRenderer.Tool.Areal.prototype.isOutside
  60354. * @description 图形是否不包含鼠标位置。
  60355. * @param {Object} shape - 图形。
  60356. * @param {number} area - 目标区域。
  60357. * @param {number} x - 横坐标。
  60358. * @param {number} y - 纵坐标。
  60359. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  60360. */
  60361. isOutside(shape, area, x, y) {
  60362. return !this.isInside(shape, area, x, y);
  60363. }
  60364. /**
  60365. * @function LevelRenderer.Tool.Areal.prototype.isInsideLine
  60366. * @description 线段包含判断。
  60367. * @param {number} x0 - 线起始点横坐标。
  60368. * @param {number} y0 - 线起始点纵坐标。
  60369. * @param {number} x1 - 线终点横坐标。
  60370. * @param {number} y1 - 线终点纵坐标。
  60371. * @param {number} lineWidth - 线宽。
  60372. * @param {number} x - 鼠标位置横坐标。
  60373. * @param {number} y - 鼠标位置纵坐标。
  60374. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  60375. */
  60376. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  60377. if (lineWidth === 0) {
  60378. return false;
  60379. }
  60380. var _l = Math.max(lineWidth, 5);
  60381. var _a = 0;
  60382. var _b = 0;
  60383. // Quick reject
  60384. if (
  60385. (y > y0 + _l && y > y1 + _l)
  60386. || (y < y0 - _l && y < y1 - _l)
  60387. || (x > x0 + _l && x > x1 + _l)
  60388. || (x < x0 - _l && x < x1 - _l)
  60389. ) {
  60390. return false;
  60391. }
  60392. if (x0 !== x1) {
  60393. _a = (y0 - y1) / (x0 - x1);
  60394. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  60395. } else {
  60396. return Math.abs(x - x0) <= _l / 2;
  60397. }
  60398. var tmp = _a * x - y + _b;
  60399. var _s = tmp * tmp / (_a * _a + 1);
  60400. return _s <= _l / 2 * _l / 2;
  60401. }
  60402. /**
  60403. * @function LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  60404. * @description 三次贝塞尔曲线描边包含判断。
  60405. * @param {number} x0 - 点1横坐标。
  60406. * @param {number} y0 - 点1纵坐标。
  60407. * @param {number} x1 - 点2横坐标。
  60408. * @param {number} y1 - 点2纵坐标。
  60409. * @param {number} x2 - 点3纵坐标。
  60410. * @param {number} y2 - 点3纵坐标。
  60411. * @param {number} lineWidth - 线宽。
  60412. * @param {number} x - 鼠标位置横坐标。
  60413. * @param {number} y - 鼠标位置纵坐标。
  60414. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60415. */
  60416. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  60417. if (lineWidth === 0) {
  60418. return false;
  60419. }
  60420. var _l = Math.max(lineWidth, 5);
  60421. // Quick reject
  60422. if (
  60423. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  60424. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  60425. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  60426. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  60427. ) {
  60428. return false;
  60429. }
  60430. var d = this.curve.cubicProjectPoint(
  60431. x0, y0, x1, y1, x2, y2, x3, y3,
  60432. x, y, null
  60433. );
  60434. return d <= _l / 2;
  60435. }
  60436. /**
  60437. * @function LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  60438. * @description 二次贝塞尔曲线描边包含判断。
  60439. * @param {number} x0 - 点1横坐标。
  60440. * @param {number} y0 - 点1纵坐标。
  60441. * @param {number} x1 - 点2横坐标。
  60442. * @param {number} y1 - 点2纵坐标。
  60443. * @param {number} x2 - 点3纵坐标。
  60444. * @param {number} y2 - 点3纵坐标。
  60445. * @param {number} lineWidth - 线宽。
  60446. * @param {number} x - 鼠标位置横坐标。
  60447. * @param {number} y - 鼠标位置纵坐标。
  60448. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60449. */
  60450. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  60451. if (lineWidth === 0) {
  60452. return false;
  60453. }
  60454. var _l = Math.max(lineWidth, 5);
  60455. // Quick reject
  60456. if (
  60457. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  60458. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  60459. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  60460. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  60461. ) {
  60462. return false;
  60463. }
  60464. var d = this.curve.quadraticProjectPoint(
  60465. x0, y0, x1, y1, x2, y2,
  60466. x, y, null
  60467. );
  60468. return d <= _l / 2;
  60469. }
  60470. /**
  60471. * @function LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  60472. * @description 圆弧描边包含判断。
  60473. * @param {number} cx - 圆心横坐标。
  60474. * @param {number} cy - 圆心纵坐标。
  60475. * @param {number} r - 圆半径。
  60476. * @param {number} startAngle - 起始角度。
  60477. * @param {number} endAngle - 终止角度。
  60478. * @param {number} anticlockwise - 顺时针还是逆时针。
  60479. * @param {number} lineWidth - 线宽。
  60480. * @param {number} x - 鼠标位置横坐标。
  60481. * @param {number} y - 鼠标位置纵坐标。
  60482. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60483. */
  60484. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  60485. var PI2 = this.PI2;
  60486. if (lineWidth === 0) {
  60487. return false;
  60488. }
  60489. var _l = Math.max(lineWidth, 5);
  60490. x -= cx;
  60491. y -= cy;
  60492. var d = Math.sqrt(x * x + y * y);
  60493. if ((d - _l > r) || (d + _l < r)) {
  60494. return false;
  60495. }
  60496. if (Math.abs(startAngle - endAngle) >= PI2) {
  60497. // Is a circle
  60498. return true;
  60499. }
  60500. if (anticlockwise) {
  60501. var tmp = startAngle;
  60502. startAngle = this.normalizeRadian(endAngle);
  60503. endAngle = this.normalizeRadian(tmp);
  60504. } else {
  60505. startAngle = this.normalizeRadian(startAngle);
  60506. endAngle = this.normalizeRadian(endAngle);
  60507. }
  60508. if (startAngle > endAngle) {
  60509. endAngle += PI2;
  60510. }
  60511. var angle = Math.atan2(y, x);
  60512. if (angle < 0) {
  60513. angle += PI2;
  60514. }
  60515. return (angle >= startAngle && angle <= endAngle)
  60516. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  60517. }
  60518. /**
  60519. * @function LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  60520. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  60521. * @param {Array} points - 曲线点对象。
  60522. * @param {number} lineWidth - 线宽。
  60523. * @param {number} x - 鼠标位置横坐标。
  60524. * @param {number} y - 鼠标位置纵坐标。
  60525. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60526. */
  60527. isInsideBrokenLine(points, lineWidth, x, y) {
  60528. var _lineWidth = Math.max(lineWidth, 10);
  60529. for (var i = 0, l = points.length - 1; i < l; i++) {
  60530. var x0 = points[i][0];
  60531. var y0 = points[i][1];
  60532. var x1 = points[i + 1][0];
  60533. var y1 = points[i + 1][1];
  60534. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  60535. return true;
  60536. }
  60537. }
  60538. return false;
  60539. }
  60540. /**
  60541. * @function LevelRenderer.Tool.Areal.prototype.isInsideRing
  60542. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  60543. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60544. */
  60545. isInsideRing(cx, cy, r0, r, x, y) {
  60546. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  60547. return (d < r * r) && (d > r0 * r0);
  60548. }
  60549. /**
  60550. * @function LevelRenderer.Tool.Areal.prototype.isInsideRect
  60551. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  60552. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60553. */
  60554. isInsideRect(x0, y0, width, height, x, y) {
  60555. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  60556. }
  60557. /**
  60558. * @function LevelRenderer.Tool.Areal.prototype.isInsideCircle
  60559. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  60560. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60561. */
  60562. isInsideCircle(x0, y0, r, x, y) {
  60563. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  60564. }
  60565. /**
  60566. * @function LevelRenderer.Tool.Areal.prototype.isInsideSector
  60567. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  60568. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60569. */
  60570. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  60571. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  60572. }
  60573. /**
  60574. * @function LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  60575. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  60576. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  60577. */
  60578. isInsidePolygon(points, x, y) {
  60579. var N = points.length;
  60580. var w = 0;
  60581. for (var i = 0, j = N - 1; i < N; i++) {
  60582. var x0 = points[j][0];
  60583. var y0 = points[j][1];
  60584. var x1 = points[i][0];
  60585. var y1 = points[i][1];
  60586. w += this.windingLine(x0, y0, x1, y1, x, y);
  60587. j = i;
  60588. }
  60589. return w !== 0;
  60590. }
  60591. /**
  60592. * @function LevelRenderer.Tool.Areal.prototype.windingLine
  60593. */
  60594. windingLine(x0, y0, x1, y1, x, y) {
  60595. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  60596. return 0;
  60597. }
  60598. if (y1 == y0) {
  60599. return 0;
  60600. }
  60601. var dir = y1 < y0 ? 1 : -1;
  60602. var t = (y - y0) / (y1 - y0);
  60603. var x_ = t * (x1 - x0) + x0;
  60604. return x_ > x ? dir : 0;
  60605. }
  60606. /**
  60607. * @function LevelRenderer.Tool.Areal.prototype.swapExtrema
  60608. */
  60609. swapExtrema() {
  60610. var tmp = this.extrema[0];
  60611. this.extrema[0] = this.extrema[1];
  60612. this.extrema[1] = tmp;
  60613. }
  60614. /**
  60615. * @function LevelRenderer.Tool.Areal.prototype.windingCubic
  60616. */
  60617. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  60618. var curve = this.curve;
  60619. var roots = this.roots;
  60620. var extrema = this.extrema;
  60621. // Quick reject
  60622. if (
  60623. (y > y0 && y > y1 && y > y2 && y > y3)
  60624. || (y < y0 && y < y1 && y < y2 && y < y3)
  60625. ) {
  60626. return 0;
  60627. }
  60628. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  60629. if (nRoots === 0) {
  60630. return 0;
  60631. } else {
  60632. var w = 0;
  60633. var nExtrema = -1;
  60634. var y0_, y1_;
  60635. for (var i = 0; i < nRoots; i++) {
  60636. var t = roots[i];
  60637. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  60638. if (x_ < x) { // Quick reject
  60639. continue;
  60640. }
  60641. if (nExtrema < 0) {
  60642. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  60643. if (extrema[1] < extrema[0] && nExtrema > 1) {
  60644. this.swapExtrema();
  60645. }
  60646. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  60647. if (nExtrema > 1) {
  60648. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  60649. }
  60650. }
  60651. if (nExtrema == 2) {
  60652. // 分成三段单调函数
  60653. if (t < extrema[0]) {
  60654. w += y0_ < y0 ? 1 : -1;
  60655. } else if (t < extrema[1]) {
  60656. w += y1_ < y0_ ? 1 : -1;
  60657. } else {
  60658. w += y3 < y1_ ? 1 : -1;
  60659. }
  60660. } else {
  60661. // 分成两段单调函数
  60662. if (t < extrema[0]) {
  60663. w += y0_ < y0 ? 1 : -1;
  60664. } else {
  60665. w += y3 < y0_ ? 1 : -1;
  60666. }
  60667. }
  60668. }
  60669. return w;
  60670. }
  60671. }
  60672. /**
  60673. * @function LevelRenderer.Tool.Areal.prototype.windingQuadratic
  60674. */
  60675. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  60676. var curve = this.curve;
  60677. var roots = this.roots;
  60678. // Quick reject
  60679. if (
  60680. (y > y0 && y > y1 && y > y2)
  60681. || (y < y0 && y < y1 && y < y2)
  60682. ) {
  60683. return 0;
  60684. }
  60685. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  60686. if (nRoots === 0) {
  60687. return 0;
  60688. } else {
  60689. var t = curve.quadraticExtremum(y0, y1, y2);
  60690. if (t >= 0 && t <= 1) {
  60691. var w = 0;
  60692. var y_ = curve.quadraticAt(y0, y1, y2, t);
  60693. for (let i = 0; i < nRoots; i++) {
  60694. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  60695. if (x_ > x) {
  60696. continue;
  60697. }
  60698. if (roots[i] < t) {
  60699. w += y_ < y0 ? 1 : -1;
  60700. } else {
  60701. w += y2 < y_ ? 1 : -1;
  60702. }
  60703. }
  60704. return w;
  60705. } else {
  60706. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  60707. if (x_ > x) {
  60708. return 0;
  60709. }
  60710. return y2 < y0 ? 1 : -1;
  60711. }
  60712. }
  60713. }
  60714. /**
  60715. * @function LevelRenderer.Tool.Areal.prototype.windingArc
  60716. * // TODO Arc 旋转
  60717. */
  60718. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  60719. var roots = this.roots;
  60720. var PI2 = this.PI2;
  60721. y -= cy;
  60722. if (y > r || y < -r) {
  60723. return 0;
  60724. }
  60725. let tmp = Math.sqrt(r * r - y * y);
  60726. roots[0] = -tmp;
  60727. roots[1] = tmp;
  60728. if (Math.abs(startAngle - endAngle) >= PI2) {
  60729. // Is a circle
  60730. startAngle = 0;
  60731. endAngle = PI2;
  60732. var dir = anticlockwise ? 1 : -1;
  60733. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  60734. return dir;
  60735. } else {
  60736. return 0;
  60737. }
  60738. }
  60739. if (anticlockwise) {
  60740. let tmp = startAngle;
  60741. startAngle = this.normalizeRadian(endAngle);
  60742. endAngle = this.normalizeRadian(tmp);
  60743. } else {
  60744. startAngle = this.normalizeRadian(startAngle);
  60745. endAngle = this.normalizeRadian(endAngle);
  60746. }
  60747. if (startAngle > endAngle) {
  60748. endAngle += PI2;
  60749. }
  60750. var w = 0;
  60751. for (let i = 0; i < 2; i++) {
  60752. var x_ = roots[i];
  60753. if (x_ + cx > x) {
  60754. let angle = Math.atan2(y, x_);
  60755. let dir = anticlockwise ? 1 : -1;
  60756. if (angle < 0) {
  60757. angle = PI2 + angle;
  60758. }
  60759. if (
  60760. (angle >= startAngle && angle <= endAngle)
  60761. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  60762. ) {
  60763. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  60764. dir = -dir;
  60765. }
  60766. w += dir;
  60767. }
  60768. }
  60769. }
  60770. return w;
  60771. }
  60772. /**
  60773. * @function LevelRenderer.Tool.Areal.prototype.isInsidePath
  60774. * @description 与 canvas 一样采用 non-zero winding rule
  60775. */
  60776. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  60777. var w = 0;
  60778. var xi = 0;
  60779. var yi = 0;
  60780. var x0 = 0;
  60781. var y0 = 0;
  60782. var beginSubpath = true;
  60783. var firstCmd = true;
  60784. brushType = brushType || 'fill';
  60785. var hasStroke = brushType === 'stroke' || brushType === 'both';
  60786. var hasFill = brushType === 'fill' || brushType === 'both';
  60787. // var roots = [-1, -1, -1];
  60788. for (var i = 0; i < pathArray.length; i++) {
  60789. var seg = pathArray[i];
  60790. var p = seg.points;
  60791. // Begin a new subpath
  60792. if (beginSubpath || seg.command === 'M') {
  60793. if (i > 0) {
  60794. // Close previous subpath
  60795. if (hasFill) {
  60796. w += this.windingLine(xi, yi, x0, y0, x, y);
  60797. }
  60798. if (w !== 0) {
  60799. return true;
  60800. }
  60801. }
  60802. x0 = p[p.length - 2];
  60803. y0 = p[p.length - 1];
  60804. beginSubpath = false;
  60805. if (firstCmd && seg.command !== 'A') {
  60806. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  60807. // 等绘制命令的话,是会从该绘制的起点开始算的
  60808. // Arc 会在之后做单独处理所以这里忽略
  60809. firstCmd = false;
  60810. xi = x0;
  60811. yi = y0;
  60812. }
  60813. }
  60814. switch (seg.command) {
  60815. case 'M':
  60816. xi = p[0];
  60817. yi = p[1];
  60818. break;
  60819. case 'L':
  60820. if (hasStroke) {
  60821. if (this.isInsideLine(
  60822. xi, yi, p[0], p[1], lineWidth, x, y
  60823. )) {
  60824. return true;
  60825. }
  60826. }
  60827. if (hasFill) {
  60828. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  60829. }
  60830. xi = p[0];
  60831. yi = p[1];
  60832. break;
  60833. case 'C':
  60834. if (hasStroke) {
  60835. if (this.isInsideCubicStroke(
  60836. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  60837. lineWidth, x, y
  60838. )) {
  60839. return true;
  60840. }
  60841. }
  60842. if (hasFill) {
  60843. w += this.windingCubic(
  60844. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  60845. );
  60846. }
  60847. xi = p[4];
  60848. yi = p[5];
  60849. break;
  60850. case 'Q':
  60851. if (hasStroke) {
  60852. if (this.isInsideQuadraticStroke(
  60853. xi, yi, p[0], p[1], p[2], p[3],
  60854. lineWidth, x, y
  60855. )) {
  60856. return true;
  60857. }
  60858. }
  60859. if (hasFill) {
  60860. w += this.windingQuadratic(
  60861. xi, yi, p[0], p[1], p[2], p[3], x, y
  60862. );
  60863. }
  60864. xi = p[2];
  60865. yi = p[3];
  60866. break;
  60867. case 'A':
  60868. // TODO Arc 旋转
  60869. // TODO Arc 判断的开销比较大
  60870. var cx = p[0];
  60871. var cy = p[1];
  60872. var rx = p[2];
  60873. var ry = p[3];
  60874. var theta = p[4];
  60875. var dTheta = p[5];
  60876. var x1 = Math.cos(theta) * rx + cx;
  60877. var y1 = Math.sin(theta) * ry + cy;
  60878. // 不是直接使用 arc 命令
  60879. if (!firstCmd) {
  60880. w += this.windingLine(xi, yi, x1, y1);
  60881. } else {
  60882. firstCmd = false;
  60883. // 第一个命令起点还未定义
  60884. x0 = x1;
  60885. y0 = y1;
  60886. }
  60887. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  60888. var _x = (x - cx) * ry / rx + cx;
  60889. if (hasStroke) {
  60890. if (this.isInsideArcStroke(
  60891. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  60892. lineWidth, _x, y
  60893. )) {
  60894. return true;
  60895. }
  60896. }
  60897. if (hasFill) {
  60898. w += this.windingArc(
  60899. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  60900. _x, y
  60901. );
  60902. }
  60903. xi = Math.cos(theta + dTheta) * rx + cx;
  60904. yi = Math.sin(theta + dTheta) * ry + cy;
  60905. break;
  60906. case 'z':
  60907. if (hasStroke) {
  60908. if (this.isInsideLine(
  60909. xi, yi, x0, y0, lineWidth, x, y
  60910. )) {
  60911. return true;
  60912. }
  60913. }
  60914. beginSubpath = true;
  60915. break;
  60916. }
  60917. }
  60918. if (hasFill) {
  60919. w += this.windingLine(xi, yi, x0, y0, x, y);
  60920. }
  60921. return w !== 0;
  60922. }
  60923. /**
  60924. * @function LevelRenderer.Tool.Areal.prototype.getTextWidth
  60925. * @description 测算多行文本宽度
  60926. */
  60927. getTextWidth(text, textFont) {
  60928. var key = text + ':' + textFont;
  60929. if (this._textWidthCache[key]) {
  60930. return this._textWidthCache[key];
  60931. }
  60932. this._ctx = this._ctx || this.util.getContext();
  60933. this._ctx.save();
  60934. if (textFont) {
  60935. this._ctx.font = textFont;
  60936. }
  60937. text = (text + '').split('\n');
  60938. var width = 0;
  60939. for (var i = 0, l = text.length; i < l; i++) {
  60940. width = Math.max(
  60941. this._ctx.measureText(text[i]).width,
  60942. width
  60943. );
  60944. }
  60945. this._ctx.restore();
  60946. this._textWidthCache[key] = width;
  60947. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  60948. // 内存释放
  60949. this._textWidthCacheCounter = 0;
  60950. this._textWidthCache = {};
  60951. }
  60952. return width;
  60953. }
  60954. /**
  60955. * @function LevelRenderer.Tool.Areal.prototype.getTextHeight
  60956. * @description 测算多行文本高度
  60957. */
  60958. getTextHeight(text, textFont) {
  60959. var key = text + ':' + textFont;
  60960. if (this._textHeightCache[key]) {
  60961. return this._textHeightCache[key];
  60962. }
  60963. this._ctx = this._ctx || this.util.getContext();
  60964. this._ctx.save();
  60965. if (textFont) {
  60966. this._ctx.font = textFont;
  60967. }
  60968. text = (text + '').split('\n');
  60969. // 比较粗暴
  60970. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  60971. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  60972. this._ctx.restore();
  60973. this._textHeightCache[key] = height;
  60974. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  60975. // 内存释放
  60976. this._textHeightCacheCounter = 0;
  60977. this._textHeightCache = {};
  60978. }
  60979. return height;
  60980. }
  60981. }
  60982. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  60983. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60984. * This program are made available under the terms of the Apache License, Version 2.0
  60985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60986. /**
  60987. * @class LevelRenderer.Tool.ComputeBoundingBox
  60988. * @category Visualization Theme
  60989. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  60990. * @private
  60991. */
  60992. class ComputeBoundingBox {
  60993. constructor() {
  60994. if (arguments.length === 3) {
  60995. this.computeBoundingBox(arguments);
  60996. }
  60997. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  60998. }
  60999. /**
  61000. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  61001. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  61002. * @param {Array.<Object>} points - 顶点数组。
  61003. * @param {Array.<number>} min - 最小
  61004. * @param {Array.<number>} max - 最大
  61005. */
  61006. computeBoundingBox(points, min, max) {
  61007. if (points.length === 0) {
  61008. return;
  61009. }
  61010. var left = points[0][0];
  61011. var right = points[0][0];
  61012. var top = points[0][1];
  61013. var bottom = points[0][1];
  61014. for (var i = 1; i < points.length; i++) {
  61015. var p = points[i];
  61016. if (p[0] < left) {
  61017. left = p[0];
  61018. }
  61019. if (p[0] > right) {
  61020. right = p[0];
  61021. }
  61022. if (p[1] < top) {
  61023. top = p[1];
  61024. }
  61025. if (p[1] > bottom) {
  61026. bottom = p[1];
  61027. }
  61028. }
  61029. min[0] = left;
  61030. min[1] = top;
  61031. max[0] = right;
  61032. max[1] = bottom;
  61033. }
  61034. /**
  61035. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  61036. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  61037. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  61038. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  61039. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  61040. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  61041. * @param {Array.<number>} min - 最小
  61042. * @param {Array.<number>} max - 最大
  61043. */
  61044. cubeBezier(p0, p1, p2, p3, min, max) {
  61045. var curve = new Curve_Curve();
  61046. var xDim = [];
  61047. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  61048. for (let i = 0; i < xDim.length; i++) {
  61049. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  61050. }
  61051. var yDim = [];
  61052. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  61053. for (let i = 0; i < yDim.length; i++) {
  61054. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  61055. }
  61056. xDim.push(p0[0], p3[0]);
  61057. yDim.push(p0[1], p3[1]);
  61058. var left = Math.min.apply(null, xDim);
  61059. var right = Math.max.apply(null, xDim);
  61060. var top = Math.min.apply(null, yDim);
  61061. var bottom = Math.max.apply(null, yDim);
  61062. min[0] = left;
  61063. min[1] = top;
  61064. max[0] = right;
  61065. max[1] = bottom;
  61066. }
  61067. /**
  61068. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  61069. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  61070. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  61071. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  61072. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  61073. * @param {Array.<number>} min - 最小
  61074. * @param {Array.<number>} max - 最大
  61075. */
  61076. quadraticBezier(p0, p1, p2, min, max) {
  61077. var curve = new Curve_Curve();
  61078. // Find extremities, where derivative in x dim or y dim is zero
  61079. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  61080. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  61081. t1 = Math.max(Math.min(t1, 1), 0);
  61082. t2 = Math.max(Math.min(t2, 1), 0);
  61083. var ct1 = 1 - t1;
  61084. var ct2 = 1 - t2;
  61085. var x1 = ct1 * ct1 * p0[0]
  61086. + 2 * ct1 * t1 * p1[0]
  61087. + t1 * t1 * p2[0];
  61088. var y1 = ct1 * ct1 * p0[1]
  61089. + 2 * ct1 * t1 * p1[1]
  61090. + t1 * t1 * p2[1];
  61091. var x2 = ct2 * ct2 * p0[0]
  61092. + 2 * ct2 * t2 * p1[0]
  61093. + t2 * t2 * p2[0];
  61094. var y2 = ct2 * ct2 * p0[1]
  61095. + 2 * ct2 * t2 * p1[1]
  61096. + t2 * t2 * p2[1];
  61097. min[0] = Math.min(p0[0], p2[0], x1, x2);
  61098. min[1] = Math.min(p0[1], p2[1], y1, y2);
  61099. max[0] = Math.max(p0[0], p2[0], x1, x2);
  61100. max[1] = Math.max(p0[1], p2[1], y1, y2);
  61101. }
  61102. /**
  61103. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  61104. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  61105. * @param {number} x - 圆弧中心点 x
  61106. * @param {number} y - 圆弧中心点 y
  61107. * @param {number} r - 圆弧半径
  61108. * @param {number} startAngle - 圆弧开始角度
  61109. * @param {number} endAngle - 圆弧结束角度
  61110. * @param {number} anticlockwise - 是否是顺时针
  61111. * @param {number} min - 最小
  61112. * @param {number} max - 最大
  61113. */
  61114. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  61115. var vec2 = new levelRenderer_Vector_Vector();
  61116. var start = vec2.create();
  61117. var end = vec2.create();
  61118. var extremity = vec2.create();
  61119. start[0] = Math.cos(startAngle) * r + x;
  61120. start[1] = Math.sin(startAngle) * r + y;
  61121. end[0] = Math.cos(endAngle) * r + x;
  61122. end[1] = Math.sin(endAngle) * r + y;
  61123. vec2.min(min, start, end);
  61124. vec2.max(max, start, end);
  61125. // Thresh to [0, Math.PI * 2]
  61126. startAngle = startAngle % (Math.PI * 2);
  61127. if (startAngle < 0) {
  61128. startAngle = startAngle + Math.PI * 2;
  61129. }
  61130. endAngle = endAngle % (Math.PI * 2);
  61131. if (endAngle < 0) {
  61132. endAngle = endAngle + Math.PI * 2;
  61133. }
  61134. if (startAngle > endAngle && !anticlockwise) {
  61135. endAngle += Math.PI * 2;
  61136. } else if (startAngle < endAngle && anticlockwise) {
  61137. startAngle += Math.PI * 2;
  61138. }
  61139. if (anticlockwise) {
  61140. var tmp = endAngle;
  61141. endAngle = startAngle;
  61142. startAngle = tmp;
  61143. }
  61144. // var number = 0;
  61145. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  61146. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  61147. if (angle > startAngle) {
  61148. extremity[0] = Math.cos(angle) * r + x;
  61149. extremity[1] = Math.sin(angle) * r + y;
  61150. vec2.min(min, extremity, min);
  61151. vec2.max(max, extremity, max);
  61152. }
  61153. }
  61154. }
  61155. }
  61156. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  61157. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61158. * This program are made available under the terms of the Apache License, Version 2.0
  61159. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61160. /**
  61161. * @class LevelRenderer.Tool.Env
  61162. * @category Visualization Theme
  61163. * @classdesc 环境识别
  61164. * @private
  61165. */
  61166. class Env {
  61167. constructor() {
  61168. // Zepto.js
  61169. // (c) 2010-2013 Thomas Fuchs
  61170. // Zepto.js may be freely distributed under the MIT license.
  61171. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  61172. var me = this;
  61173. function detect(ua) {
  61174. var os = me.os = {};
  61175. var browser = me.browser = {};
  61176. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  61177. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  61178. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  61179. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  61180. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  61181. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  61182. var touchpad = webos && ua.match(/TouchPad/);
  61183. var kindle = ua.match(/Kindle\/([\d.]+)/);
  61184. var silk = ua.match(/Silk\/([\d._]+)/);
  61185. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  61186. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  61187. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  61188. var playbook = ua.match(/PlayBook/);
  61189. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  61190. var firefox = ua.match(/Firefox\/([\d.]+)/);
  61191. var ie = ua.match(/MSIE ([\d.]+)/);
  61192. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  61193. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  61194. // Todo: clean this up with a better OS/browser seperation:
  61195. // - discern (more) between multiple browsers on android
  61196. // - decide if kindle fire in silk mode is android or not
  61197. // - Firefox on Android doesn't specify the Android version
  61198. // - possibly devide in os, device and browser hashes
  61199. /*eslint-disable*/
  61200. if (browser.webkit = !!webkit) {
  61201. browser.version = webkit[1];
  61202. }
  61203. if (android) {
  61204. os.android = true;
  61205. os.version = android[2];
  61206. }
  61207. if (iphone && !ipod) {
  61208. os.ios = os.iphone = true;
  61209. os.version = iphone[2].replace(/_/g, '.');
  61210. }
  61211. if (ipad) {
  61212. os.ios = os.ipad = true;
  61213. os.version = ipad[2].replace(/_/g, '.');
  61214. }
  61215. if (ipod) {
  61216. os.ios = os.ipod = true;
  61217. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  61218. }
  61219. if (webos) {
  61220. os.webos = true;
  61221. os.version = webos[2];
  61222. }
  61223. if (touchpad) {
  61224. os.touchpad = true;
  61225. }
  61226. if (blackberry) {
  61227. os.blackberry = true;
  61228. os.version = blackberry[2];
  61229. }
  61230. if (bb10) {
  61231. os.bb10 = true;
  61232. os.version = bb10[2];
  61233. }
  61234. if (rimtabletos) {
  61235. os.rimtabletos = true;
  61236. os.version = rimtabletos[2];
  61237. }
  61238. if (playbook) {
  61239. browser.playbook = true;
  61240. }
  61241. if (kindle) {
  61242. os.kindle = true;
  61243. os.version = kindle[1];
  61244. }
  61245. if (silk) {
  61246. browser.silk = true;
  61247. browser.version = silk[1];
  61248. }
  61249. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  61250. browser.silk = true;
  61251. }
  61252. if (chrome) {
  61253. browser.chrome = true;
  61254. browser.version = chrome[1];
  61255. }
  61256. if (firefox) {
  61257. browser.firefox = true;
  61258. browser.version = firefox[1];
  61259. }
  61260. if (ie) {
  61261. browser.ie = true;
  61262. browser.version = ie[1];
  61263. }
  61264. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  61265. browser.safari = true;
  61266. }
  61267. if (webview) {
  61268. browser.webview = true;
  61269. }
  61270. if (ie) {
  61271. browser.ie = true;
  61272. browser.version = ie[1];
  61273. }
  61274. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  61275. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  61276. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  61277. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  61278. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  61279. return {
  61280. browser: browser,
  61281. os: os,
  61282. // 原生canvas支持
  61283. canvasSupported: document.createElement('canvas').getContext ? true : false
  61284. };
  61285. }
  61286. return detect(navigator.userAgent);
  61287. }
  61288. destory() {
  61289. return true;
  61290. }
  61291. }
  61292. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  61293. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61294. * This program are made available under the terms of the Apache License, Version 2.0
  61295. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61296. /**
  61297. * @class LevelRenderer.Tool.Event
  61298. * @category Visualization Theme
  61299. * @classdesc LevelRenderer 工具-事件辅助类
  61300. * @private
  61301. */
  61302. class Event_Event {
  61303. constructor() {
  61304. /**
  61305. * @member {function} LevelRenderer.Tool.Event.prototype.stop
  61306. * @description 停止冒泡和阻止默认行为
  61307. */
  61308. this.stop = typeof window.addEventListener === 'function'
  61309. ? function (e) {
  61310. e.preventDefault();
  61311. e.stopPropagation();
  61312. e.cancelBubble = true;
  61313. }
  61314. : function (e) {
  61315. e.returnValue = false;
  61316. e.cancelBubble = true;
  61317. };
  61318. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  61319. }
  61320. /**
  61321. * @function LevelRenderer.Tool.Event.prototype.getX
  61322. * @description 提取鼠标(手指)x坐标。
  61323. * @param {Event} e - 事件。
  61324. * @returns {number} 鼠标(手指)x坐标。
  61325. */
  61326. getX(e) {
  61327. return typeof e.zrenderX != 'undefined' && e.zrenderX
  61328. || typeof e.offsetX != 'undefined' && e.offsetX
  61329. || typeof e.layerX != 'undefined' && e.layerX
  61330. || typeof e.clientX != 'undefined' && e.clientX;
  61331. }
  61332. /**
  61333. * @function LevelRenderer.Tool.Event.prototype.getY
  61334. * @description 提取鼠标(手指)y坐标。
  61335. * @param {Event} e - 事件。
  61336. * @returns {number} 鼠标(手指)y坐标。
  61337. */
  61338. getY(e) {
  61339. return typeof e.zrenderY != 'undefined' && e.zrenderY
  61340. || typeof e.offsetY != 'undefined' && e.offsetY
  61341. || typeof e.layerY != 'undefined' && e.layerY
  61342. || typeof e.clientY != 'undefined' && e.clientY;
  61343. }
  61344. /**
  61345. * @function LevelRenderer.Tool.Event.prototype.getDelta
  61346. * @description 提取鼠标滚轮变化。
  61347. * @param {Event} e - 事件。
  61348. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  61349. */
  61350. getDelta(e) {
  61351. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  61352. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  61353. || typeof e.detail != 'undefined' && -e.detail;
  61354. }
  61355. }
  61356. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  61357. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61358. * This program are made available under the terms of the Apache License, Version 2.0
  61359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61360. /**
  61361. * @private
  61362. * @class LevelRenderer.Tool.Http
  61363. * @category Visualization Theme
  61364. * @classdesc LevelRenderer 工具-Http
  61365. */
  61366. class Http {
  61367. constructor() {
  61368. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  61369. }
  61370. /**
  61371. * @function LevelRenderer.Tool.Http.prototype.get
  61372. * @description get请求。
  61373. * @param {(string|IHTTPGetOption)} url - 请求url
  61374. * @param {function} onsuccess - 请求成功函数
  61375. * @param {function} onerror - 请求失败函数
  61376. * @param {Object} opts - 额外参数
  61377. * @returns {number} cos值
  61378. */
  61379. get(url, onsuccess, onerror) {
  61380. if (typeof(url) === 'object') {
  61381. var obj = url;
  61382. url = obj.url;
  61383. onsuccess = obj.onsuccess;
  61384. onerror = obj.onerror;
  61385. }
  61386. var xhr = window.XMLHttpRequest
  61387. ? new XMLHttpRequest()
  61388. : new window.ActiveXObject('Microsoft.XMLHTTP');
  61389. xhr.open('GET', url, true);
  61390. xhr.onreadystatechange = function () {
  61391. if (xhr.readyState == 4) {
  61392. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  61393. onsuccess && onsuccess(xhr.responseText);
  61394. } else {
  61395. onerror && onerror();
  61396. }
  61397. xhr.onreadystatechange = new Function();
  61398. xhr = null;
  61399. }
  61400. };
  61401. xhr.send(null);
  61402. }
  61403. }
  61404. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  61405. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61406. * This program are made available under the terms of the Apache License, Version 2.0
  61407. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61408. class Config {
  61409. }
  61410. /**
  61411. * @enum EVENT
  61412. * @description 事件
  61413. * @type {Object}
  61414. * @private
  61415. */
  61416. Config.EVENT = {
  61417. //窗口大小变化
  61418. RESIZE: 'resize',
  61419. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  61420. CLICK: 'click',
  61421. //双击事件
  61422. DBLCLICK: 'dblclick',
  61423. //鼠标滚轮变化,事件对象是:目标图形元素或空
  61424. MOUSEWHEEL: 'mousewheel',
  61425. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  61426. MOUSEMOVE: 'mousemove',
  61427. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  61428. MOUSEOVER: 'mouseover',
  61429. //鼠标从某图形元素移开,事件对象是:目标图形元素
  61430. MOUSEOUT: 'mouseout',
  61431. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  61432. MOUSEDOWN: 'mousedown',
  61433. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  61434. MOUSEUP: 'mouseup',
  61435. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  61436. GLOBALOUT: 'globalout',
  61437. // 一次成功元素拖拽的行为事件过程是:
  61438. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  61439. //开始拖拽时触发,事件对象是:被拖拽图形元素
  61440. DRAGSTART: 'dragstart',
  61441. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  61442. DRAGEND: 'dragend',
  61443. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  61444. DRAGENTER: 'dragenter',
  61445. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  61446. DRAGOVER: 'dragover',
  61447. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  61448. DRAGLEAVE: 'dragleave',
  61449. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  61450. DROP: 'drop',
  61451. //touch end - start < delay is click
  61452. touchClickDelay: 300
  61453. };
  61454. /**
  61455. * @enum catchBrushException
  61456. * @description 是否异常捕获
  61457. * @type {boolean}
  61458. * @private
  61459. */
  61460. Config.catchBrushException = false;
  61461. /**
  61462. * @enum debugMode
  61463. * @description debug 日志选项:catchBrushException 为 true 下有效。
  61464. * 0 : 不生成debug数据,发布用
  61465. * 1 : 异常抛出,调试用
  61466. * 2 : 控制台输出,调试用
  61467. * @type {boolean}
  61468. * @private
  61469. */
  61470. Config.debugMode = 0;
  61471. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  61472. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61473. * This program are made available under the terms of the Apache License, Version 2.0
  61474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61475. /**
  61476. * @private
  61477. * @class LevelRenderer.Tool.Log
  61478. * @category Visualization Theme
  61479. * @classdesc LevelRenderer 工具-日志
  61480. */
  61481. class Log {
  61482. constructor() {
  61483. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  61484. return function () {
  61485. if (+Config.debugMode === 0) {
  61486. return;
  61487. } else if (+Config.debugMode === 1) {
  61488. for (let k in arguments) {
  61489. throw new Error(arguments[k]);
  61490. }
  61491. } else if (+Config.debugMode > 1) {
  61492. for (let k in arguments) {
  61493. console.log(arguments[k]);
  61494. }
  61495. }
  61496. };
  61497. /* for debug
  61498. return function(mes) {
  61499. document.getElementById('wrong-message').innerHTML =
  61500. mes + ' ' + (new Date() - 0)
  61501. + '<br/>'
  61502. + document.getElementById('wrong-message').innerHTML;
  61503. };
  61504. */
  61505. }
  61506. destory() {
  61507. return true;
  61508. }
  61509. }
  61510. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  61511. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61512. * This program are made available under the terms of the Apache License, Version 2.0
  61513. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61514. /**
  61515. * @private
  61516. * @class LevelRenderer.Tool.Math
  61517. * @category Visualization Theme
  61518. * @classdesc LevelRenderer 工具-数学辅助类
  61519. */
  61520. class MathTool {
  61521. constructor() {
  61522. /**
  61523. * @member {number} LevelRenderer.Tool.Math._radians
  61524. * @description 角度与弧度转化参数
  61525. */
  61526. this._radians = window.Math.PI / 180;
  61527. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  61528. }
  61529. /**
  61530. * @function LevelRenderer.Tool.Math.prototype.sin
  61531. * @description 正弦函数。
  61532. * @param {number} angle - 弧度(角度)参数。
  61533. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  61534. * @returns {number} sin 值。
  61535. */
  61536. sin(angle, isDegrees) {
  61537. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  61538. }
  61539. /**
  61540. * @function LevelRenderer.Tool.Math.prototype.cos
  61541. * @description 余弦函数。
  61542. * @param {number} angle - 弧度(角度)参数。
  61543. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  61544. * @returns {number} cos 值。
  61545. */
  61546. cos(angle, isDegrees) {
  61547. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  61548. }
  61549. /**
  61550. * @function LevelRenderer.Tool.Math.prototype.degreeToRadian
  61551. * @description 角度转弧度。
  61552. * @param {number} angle - 弧度(角度)参数。
  61553. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  61554. * @returns {number} 弧度值。
  61555. */
  61556. degreeToRadian(angle) {
  61557. return angle * this._radians;
  61558. }
  61559. /**
  61560. * @function LevelRenderer.Tool.Math.prototype.radianToDegree
  61561. * @description 弧度转角度。
  61562. * @param {number} angle - 弧度(角度)参数。
  61563. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  61564. * @returns {number} 角度。
  61565. */
  61566. radianToDegree(angle) {
  61567. return angle / this._radians;
  61568. }
  61569. }
  61570. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  61571. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61572. * This program are made available under the terms of the Apache License, Version 2.0
  61573. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61574. /**
  61575. * @private
  61576. * @class LevelRenderer.Tool.Matrix
  61577. * @category Visualization Theme
  61578. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  61579. */
  61580. class Matrix {
  61581. constructor() {
  61582. /**
  61583. * @member {Object} LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  61584. * @description 数组类型控制
  61585. */
  61586. this.ArrayCtor = typeof Float32Array === 'undefined'
  61587. ? Array
  61588. : Float32Array;
  61589. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  61590. }
  61591. /**
  61592. * @function LevelRenderer.Tool.Matrix.prototype.create
  61593. * @description 创建一个单位矩阵。
  61594. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  61595. */
  61596. create() {
  61597. var ArrayCtor = this.ArrayCtor;
  61598. var out = new ArrayCtor(6);
  61599. this.identity(out);
  61600. return out;
  61601. }
  61602. /**
  61603. * @function LevelRenderer.Tool.Matrix.prototype.identity
  61604. * @description 设置矩阵为单位矩阵。
  61605. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61606. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  61607. */
  61608. identity(out) {
  61609. out[0] = 1;
  61610. out[1] = 0;
  61611. out[2] = 0;
  61612. out[3] = 1;
  61613. out[4] = 0;
  61614. out[5] = 0;
  61615. return out;
  61616. }
  61617. /**
  61618. * @function LevelRenderer.Tool.Matrix.prototype.copy
  61619. * @description 复制矩阵。
  61620. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61621. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  61622. */
  61623. copy(out, m) {
  61624. out[0] = m[0];
  61625. out[1] = m[1];
  61626. out[2] = m[2];
  61627. out[3] = m[3];
  61628. out[4] = m[4];
  61629. out[5] = m[5];
  61630. return out;
  61631. }
  61632. /**
  61633. * @function LevelRenderer.Tool.Matrix.prototype.mul
  61634. * @description 矩阵相乘。
  61635. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61636. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  61637. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  61638. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61639. */
  61640. mul(out, m1, m2) {
  61641. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  61642. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  61643. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  61644. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  61645. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  61646. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  61647. return out;
  61648. }
  61649. /**
  61650. * @function LevelRenderer.Tool.Matrix.prototype.mul
  61651. * @description 平移变换。
  61652. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61653. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  61654. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  61655. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61656. */
  61657. translate(out, a, v) {
  61658. out[0] = a[0];
  61659. out[1] = a[1];
  61660. out[2] = a[2];
  61661. out[3] = a[3];
  61662. out[4] = a[4] + v[0];
  61663. out[5] = a[5] + v[1];
  61664. return out;
  61665. }
  61666. /**
  61667. * @function LevelRenderer.Tool.Matrix.prototype.rotate
  61668. * @description 平移变换。
  61669. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61670. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  61671. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  61672. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61673. */
  61674. rotate(out, a, rad) {
  61675. var aa = a[0];
  61676. var ac = a[2];
  61677. var atx = a[4];
  61678. var ab = a[1];
  61679. var ad = a[3];
  61680. var aty = a[5];
  61681. var st = Math.sin(rad);
  61682. var ct = Math.cos(rad);
  61683. out[0] = aa * ct + ab * st;
  61684. out[1] = -aa * st + ab * ct;
  61685. out[2] = ac * ct + ad * st;
  61686. out[3] = -ac * st + ct * ad;
  61687. out[4] = ct * atx + st * aty;
  61688. out[5] = ct * aty - st * atx;
  61689. return out;
  61690. }
  61691. /**
  61692. * @function LevelRenderer.Tool.Matrix.prototype.scale
  61693. * @description 缩放变换。
  61694. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61695. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  61696. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  61697. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61698. */
  61699. scale(out, a, v) {
  61700. var vx = v[0];
  61701. var vy = v[1];
  61702. out[0] = a[0] * vx;
  61703. out[1] = a[1] * vy;
  61704. out[2] = a[2] * vx;
  61705. out[3] = a[3] * vy;
  61706. out[4] = a[4] * vx;
  61707. out[5] = a[5] * vy;
  61708. return out;
  61709. }
  61710. /**
  61711. * @function LevelRenderer.Tool.Matrix.prototype.invert
  61712. * @description 求逆矩阵。
  61713. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61714. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  61715. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61716. */
  61717. invert(out, a) {
  61718. var aa = a[0];
  61719. var ac = a[2];
  61720. var atx = a[4];
  61721. var ab = a[1];
  61722. var ad = a[3];
  61723. var aty = a[5];
  61724. var det = aa * ad - ab * ac;
  61725. if (!det) {
  61726. return null;
  61727. }
  61728. det = 1.0 / det;
  61729. out[0] = ad * det;
  61730. out[1] = -ab * det;
  61731. out[2] = -ac * det;
  61732. out[3] = aa * det;
  61733. out[4] = (ac * aty - ad * atx) * det;
  61734. out[5] = (ab * atx - aa * aty) * det;
  61735. return out;
  61736. }
  61737. /**
  61738. * @function LevelRenderer.Tool.Matrix.prototype.mulVector
  61739. * @description 矩阵左乘向量。
  61740. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  61741. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  61742. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  61743. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  61744. */
  61745. mulVector(out, a, v) {
  61746. var aa = a[0];
  61747. var ac = a[2];
  61748. var atx = a[4];
  61749. var ab = a[1];
  61750. var ad = a[3];
  61751. var aty = a[5];
  61752. out[0] = v[0] * aa + v[1] * ac + atx;
  61753. out[1] = v[0] * ab + v[1] * ad + aty;
  61754. return out;
  61755. }
  61756. }
  61757. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  61758. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61759. * This program are made available under the terms of the Apache License, Version 2.0
  61760. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61761. class SUtil_SUtil {
  61762. /**
  61763. * @function LevelRenderer.SUtil.SUtil_smoothBezier
  61764. * @description 贝塞尔平滑曲线。
  61765. * @private
  61766. * @param {Array} points - 线段顶点数组。
  61767. * @param {number} smooth - 平滑等级, 0-1。
  61768. * @param {boolean} isLoop - isLoop。
  61769. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  61770. * @param {Array.<number>} [originalPosition=[0, 0]] - 参考原点。
  61771. * @return {Array} 生成的平滑节点数组。
  61772. */
  61773. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  61774. if (!originalPosition || originalPosition.length !== 2) {
  61775. originalPosition = [0, 0];
  61776. }
  61777. var __OP = originalPosition;
  61778. var cps = [];
  61779. var v = [];
  61780. var v1 = [];
  61781. var v2 = [];
  61782. var hasConstraint = !!constraint;
  61783. var min, max;
  61784. if (hasConstraint) {
  61785. min = [Infinity, Infinity];
  61786. max = [-Infinity, -Infinity];
  61787. let len = points.length;
  61788. for (let i = 0; i < len; i++) {
  61789. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  61790. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  61791. }
  61792. // 与指定的包围盒做并集
  61793. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  61794. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  61795. }
  61796. let len = points.length;
  61797. for (let i = 0; i < len; i++) {
  61798. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  61799. let prevPoint;
  61800. let nextPoint;
  61801. if (isLoop) {
  61802. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  61803. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  61804. } else {
  61805. if (i === 0 || i === len - 1) {
  61806. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  61807. continue;
  61808. } else {
  61809. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  61810. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  61811. }
  61812. }
  61813. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  61814. // use degree to scale the handle length
  61815. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  61816. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  61817. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  61818. let sum = d0 + d1;
  61819. if (sum !== 0) {
  61820. d0 /= sum;
  61821. d1 /= sum;
  61822. }
  61823. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  61824. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  61825. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  61826. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  61827. if (hasConstraint) {
  61828. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  61829. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  61830. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  61831. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  61832. }
  61833. cps.push(cp0);
  61834. cps.push(cp1);
  61835. }
  61836. if (isLoop) {
  61837. cps.push(cps.shift());
  61838. }
  61839. return cps;
  61840. }
  61841. /**
  61842. * @function LevelRenderer.SUtil.SUtil_smoothSpline
  61843. * @description 插值折线。
  61844. * @private
  61845. * @param {Array} points - 线段顶点数组。
  61846. * @param {boolean} isLoop - isLoop。
  61847. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  61848. * @param {Array.<number>} originalPosition - 参考原点。默认值:[0, 0]。
  61849. * @return {Array} 生成的平滑节点数组。
  61850. */
  61851. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  61852. if (!originalPosition || originalPosition.length !== 2) {
  61853. originalPosition = [0, 0];
  61854. }
  61855. var __OP = originalPosition;
  61856. var len = points.length;
  61857. var ret = [];
  61858. var distance = 0;
  61859. for (let i = 1; i < len; i++) {
  61860. distance += SUtil_SUtil.Util_vector.distance([points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]], [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  61861. }
  61862. var segs = distance / 5;
  61863. segs = segs < len ? len : segs;
  61864. for (let i = 0; i < segs; i++) {
  61865. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  61866. let idx = Math.floor(pos);
  61867. let w = pos - idx;
  61868. let p0;
  61869. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  61870. let p2;
  61871. let p3;
  61872. if (!isLoop) {
  61873. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  61874. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  61875. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  61876. } else {
  61877. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  61878. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  61879. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  61880. }
  61881. let w2 = w * w;
  61882. let w3 = w * w2;
  61883. ret.push([
  61884. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  61885. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  61886. ]);
  61887. }
  61888. return ret;
  61889. // inner Function
  61890. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  61891. var v0 = (p2 - p0) * 0.5;
  61892. var v1 = (p3 - p1) * 0.5;
  61893. return (2 * (p1 - p2) + v0 + v1) * t3
  61894. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  61895. + v0 * t + p1;
  61896. }
  61897. }
  61898. /**
  61899. * @function LevelRenderer.SUtil.SUtil_dashedLineTo
  61900. * @description 虚线 lineTo。
  61901. */
  61902. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  61903. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  61904. var dashPattern = [5, 5];
  61905. dashLength = typeof dashLength != 'number'
  61906. ? 5
  61907. : dashLength;
  61908. if (ctx.setLineDash) {
  61909. dashPattern[0] = dashLength;
  61910. dashPattern[1] = dashLength;
  61911. if (customDashPattern && (customDashPattern instanceof Array)) {
  61912. ctx.setLineDash(customDashPattern);
  61913. } else {
  61914. ctx.setLineDash(dashPattern);
  61915. }
  61916. // ctx.setLineDash(dashPattern);
  61917. ctx.moveTo(x1, y1);
  61918. ctx.lineTo(x2, y2);
  61919. return;
  61920. }
  61921. var dx = x2 - x1;
  61922. var dy = y2 - y1;
  61923. var numDashes = Math.floor(
  61924. Math.sqrt(dx * dx + dy * dy) / dashLength
  61925. );
  61926. dx = dx / numDashes;
  61927. dy = dy / numDashes;
  61928. var flag = true;
  61929. for (var i = 0; i < numDashes; ++i) {
  61930. if (flag) {
  61931. ctx.moveTo(x1, y1);
  61932. } else {
  61933. ctx.lineTo(x1, y1);
  61934. }
  61935. flag = !flag;
  61936. x1 += dx;
  61937. y1 += dy;
  61938. }
  61939. ctx.lineTo(x2, y2);
  61940. }
  61941. }
  61942. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  61943. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  61944. SUtil_SUtil.Util_area = new Area();
  61945. SUtil_SUtil.Util_color = new Color();
  61946. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  61947. SUtil_SUtil.Util_curve = new Curve_Curve();
  61948. SUtil_SUtil.Util_env = new Env();
  61949. SUtil_SUtil.Util_event = new Event_Event();
  61950. SUtil_SUtil.Util_http = new Http();
  61951. SUtil_SUtil.Util_log = new Log();
  61952. SUtil_SUtil.Util_math = new MathTool();
  61953. SUtil_SUtil.Util_matrix = new Matrix();
  61954. SUtil_SUtil.Util = new levelRenderer_Util_Util();
  61955. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  61956. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  61957. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61958. * This program are made available under the terms of the Apache License, Version 2.0
  61959. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61960. /**
  61961. * @private
  61962. * @class LevelRenderer.Transformable
  61963. * @category Visualization Theme
  61964. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  61965. */
  61966. class Transformable {
  61967. constructor() {
  61968. /**
  61969. * @member {Array.<number>} LevelRenderer.Transformable.prototype.position
  61970. * @description 平移,默认值:[0, 0]。
  61971. */
  61972. this.position = [0, 0];
  61973. /**
  61974. * @member {Array.<number>} LevelRenderer.Transformable.prototype.rotation
  61975. * @description 旋转,可以通过数组二三项指定旋转的原点,默认值:[0, 0, 0]。
  61976. */
  61977. this.rotation = [0, 0, 0];
  61978. /**
  61979. * @member {Array.<number>} LevelRenderer.Transformable.prototype.scale
  61980. * @description 缩放,可以通过数组三四项指定缩放的原点,默认值:[1, 1, 0, 0]。
  61981. */
  61982. this.scale = [1, 1, 0, 0];
  61983. /**
  61984. * @member {boolean} LevelRenderer.Transformable.prototype.needLocalTransform
  61985. * @description 是否变换。默认值:false。
  61986. */
  61987. this.needLocalTransform = false;
  61988. /**
  61989. * @member {boolean} LevelRenderer.Transformable.prototype.needTransform
  61990. * @description 是否有坐标变换。默认值:false。
  61991. */
  61992. this.needTransform = false;
  61993. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  61994. /**
  61995. * @function LevelRenderer.Transformable.prototype.lookAt
  61996. * @description 设置图形的朝向。
  61997. */
  61998. this.lookAt = (function () {
  61999. var v = SUtil_SUtil.Util_vector.create();
  62000. // {Array.<Number>|Float32Array} target
  62001. return function (target) {
  62002. if (!this.transform) {
  62003. this.transform = SUtil_SUtil.Util_matrix.create();
  62004. }
  62005. var m = this.transform;
  62006. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  62007. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  62008. return;
  62009. }
  62010. SUtil_SUtil.Util_vector.normalize(v, v);
  62011. // Y Axis
  62012. // TODO Scale origin ?
  62013. m[2] = v[0] * this.scale[1];
  62014. m[3] = v[1] * this.scale[1];
  62015. // X Axis
  62016. m[0] = v[1] * this.scale[0];
  62017. m[1] = -v[0] * this.scale[0];
  62018. // Position
  62019. m[4] = this.position[0];
  62020. m[5] = this.position[1];
  62021. this.decomposeTransform();
  62022. function isAroundZero(val) {
  62023. var EPSILON = 5e-5;
  62024. return val > -EPSILON && val < EPSILON;
  62025. }
  62026. };
  62027. })();
  62028. }
  62029. /**
  62030. * @function LevelRenderer.Transformable.prototype.destroy
  62031. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  62032. */
  62033. destroy() {
  62034. this.position = null;
  62035. this.rotation = null;
  62036. this.scale = null;
  62037. this.needLocalTransform = null;
  62038. this.needTransform = null;
  62039. }
  62040. /**
  62041. * @function LevelRenderer.Transformable.prototype.updateNeedTransform
  62042. * @description 更新 needLocalTransform
  62043. */
  62044. updateNeedTransform() {
  62045. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  62046. || isNotAroundZero(this.position[0])
  62047. || isNotAroundZero(this.position[1])
  62048. || isNotAroundZero(this.scale[0] - 1)
  62049. || isNotAroundZero(this.scale[1] - 1);
  62050. function isNotAroundZero(val) {
  62051. var EPSILON = 5e-5;
  62052. return val > EPSILON || val < -EPSILON;
  62053. }
  62054. }
  62055. /**
  62056. * @function LevelRenderer.Transformable.prototype.updateTransform
  62057. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换,则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵。
  62058. */
  62059. updateTransform() {
  62060. this.updateNeedTransform();
  62061. if (this.parent) {
  62062. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  62063. } else {
  62064. this.needTransform = this.needLocalTransform;
  62065. }
  62066. if (!this.needTransform) {
  62067. return;
  62068. }
  62069. var origin = [0, 0];
  62070. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  62071. SUtil_SUtil.Util_matrix.identity(m);
  62072. if (this.needLocalTransform) {
  62073. if (
  62074. isNotAroundZero(this.scale[0])
  62075. || isNotAroundZero(this.scale[1])
  62076. ) {
  62077. origin[0] = -this.scale[2] || 0;
  62078. origin[1] = -this.scale[3] || 0;
  62079. let haveOrigin = isNotAroundZero(origin[0])
  62080. || isNotAroundZero(origin[1]);
  62081. if (haveOrigin) {
  62082. SUtil_SUtil.Util_matrix.translate(
  62083. m, m, origin
  62084. );
  62085. }
  62086. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  62087. if (haveOrigin) {
  62088. origin[0] = -origin[0];
  62089. origin[1] = -origin[1];
  62090. SUtil_SUtil.Util_matrix.translate(
  62091. m, m, origin
  62092. );
  62093. }
  62094. }
  62095. if (this.rotation instanceof Array) {
  62096. if (this.rotation[0] !== 0) {
  62097. origin[0] = -this.rotation[1] || 0;
  62098. origin[1] = -this.rotation[2] || 0;
  62099. let haveOrigin = isNotAroundZero(origin[0])
  62100. || isNotAroundZero(origin[1]);
  62101. if (haveOrigin) {
  62102. SUtil_SUtil.Util_matrix.translate(
  62103. m, m, origin
  62104. );
  62105. }
  62106. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  62107. if (haveOrigin) {
  62108. origin[0] = -origin[0];
  62109. origin[1] = -origin[1];
  62110. SUtil_SUtil.Util_matrix.translate(
  62111. m, m, origin
  62112. );
  62113. }
  62114. }
  62115. } else {
  62116. if (+this.rotation !== 0) {
  62117. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  62118. }
  62119. }
  62120. if (
  62121. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  62122. ) {
  62123. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  62124. }
  62125. }
  62126. // 保存这个变换矩阵
  62127. this.transform = m;
  62128. // 应用父节点变换
  62129. if (this.parent && this.parent.needTransform) {
  62130. if (this.needLocalTransform) {
  62131. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  62132. } else {
  62133. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  62134. }
  62135. }
  62136. function isNotAroundZero(val) {
  62137. var EPSILON = 5e-5;
  62138. return val > EPSILON || val < -EPSILON;
  62139. }
  62140. }
  62141. /**
  62142. * @function LevelRenderer.Transformable.prototype.setTransform
  62143. * @description 将自己的 transform 应用到 context 上。
  62144. *
  62145. * @param {Context2D} ctx - Context2D 上下文。
  62146. */
  62147. setTransform(ctx) {
  62148. if (this.needTransform) {
  62149. var m = this.transform;
  62150. ctx.transform(
  62151. m[0], m[1],
  62152. m[2], m[3],
  62153. m[4], m[5]
  62154. );
  62155. }
  62156. }
  62157. /**
  62158. * @function LevelRenderer.Transformable.prototype.decomposeTransform
  62159. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  62160. */
  62161. decomposeTransform() {
  62162. if (!this.transform) {
  62163. return;
  62164. }
  62165. var m = this.transform;
  62166. var sx = m[0] * m[0] + m[1] * m[1];
  62167. var position = this.position;
  62168. var scale = this.scale;
  62169. var rotation = this.rotation;
  62170. if (isNotAroundZero(sx - 1)) {
  62171. sx = Math.sqrt(sx);
  62172. }
  62173. var sy = m[2] * m[2] + m[3] * m[3];
  62174. if (isNotAroundZero(sy - 1)) {
  62175. sy = Math.sqrt(sy);
  62176. }
  62177. position[0] = m[4];
  62178. position[1] = m[5];
  62179. scale[0] = sx;
  62180. scale[1] = sy;
  62181. scale[2] = scale[3] = 0;
  62182. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  62183. rotation[1] = rotation[2] = 0;
  62184. function isNotAroundZero(val) {
  62185. var EPSILON = 5e-5;
  62186. return val > EPSILON || val < -EPSILON;
  62187. }
  62188. }
  62189. }
  62190. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  62191. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62192. * This program are made available under the terms of the Apache License, Version 2.0
  62193. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62194. /**
  62195. * @private
  62196. * @class LevelRenderer.Shape
  62197. * @category Visualization Theme
  62198. * @classdesc 图形(shape)基类。
  62199. * @extends LevelRenderer.Eventful
  62200. * @extends LevelRenderer.Transformable
  62201. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  62202. */
  62203. class Shape_Shape extends mixinExt(Eventful, Transformable) {
  62204. constructor(options) {
  62205. super(options);
  62206. options = options || {};
  62207. /**
  62208. * @member {string} LevelRenderer.Shape.prototype.id
  62209. * @description 唯一标识。
  62210. */
  62211. this.id = null;
  62212. /**
  62213. * @member {Object} LevelRenderer.Shape.prototype.style
  62214. * @description 基础绘制样式。
  62215. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  62216. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  62217. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  62218. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  62219. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  62220. * @param {number} style.opacity - 绘制透明度。默认值:1。
  62221. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  62222. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  62223. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  62224. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  62225. * @param {string} style.text - 图形中的附加文本。默认值:""。
  62226. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  62227. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  62228. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  62229. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  62230. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  62231. *
  62232. */
  62233. this.style = {};
  62234. /**
  62235. * @member {Object} LevelRenderer.Shape.prototype.style.__rect
  62236. * @description 包围图形的最小矩形盒子。
  62237. *
  62238. * @param {number} x - 左上角顶点x轴坐标。
  62239. * @param {number} y - 左上角顶点y轴坐标。
  62240. * @param {number} width - 包围盒矩形宽度。
  62241. * @param {number} height - 包围盒矩形高度。
  62242. */
  62243. /**
  62244. * @member {Object} LevelRenderer.Shape.prototype.highlightStyle
  62245. * @description 高亮样式。
  62246. *
  62247. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  62248. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  62249. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  62250. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  62251. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  62252. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  62253. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  62254. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  62255. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  62256. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  62257. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  62258. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  62259. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  62260. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  62261. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  62262. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  62263. */
  62264. this.highlightStyle = null;
  62265. /**
  62266. * @member {Object} LevelRenderer.Shape.prototype.parent
  62267. * @description 父节点,只读属性。<LevelRenderer.Group>
  62268. */
  62269. this.parent = null;
  62270. /**
  62271. * @member {boolean} LevelRenderer.Shape.prototype.__dirty
  62272. * @description {boolean}
  62273. */
  62274. this.__dirty = true;
  62275. /**
  62276. * @member {Array} LevelRenderer.Shape.prototype.__clipShapes
  62277. * @description {Array}
  62278. *
  62279. */
  62280. this.__clipShapes = [];
  62281. /**
  62282. * @member {boolean} LevelRenderer.Shape.prototype.invisible
  62283. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  62284. */
  62285. this.invisible = false;
  62286. /**
  62287. * @member {boolean} LevelRenderer.Shape.prototype.ignore
  62288. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  62289. */
  62290. this.ignore = false;
  62291. /**
  62292. * @member {boolean} LevelRenderer.Shape.prototype.zlevel
  62293. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  62294. */
  62295. this.zlevel = 0;
  62296. /**
  62297. * @member {boolean} LevelRenderer.Shape.prototype.draggable
  62298. * @description 是否可拖拽。默认值:false。
  62299. */
  62300. this.draggable = false;
  62301. /**
  62302. * @member {boolean} LevelRenderer.Shape.prototype.clickable
  62303. * @description 是否可点击。默认值:false。
  62304. */
  62305. this.clickable = false;
  62306. /**
  62307. * @member {boolean} LevelRenderer.Shape.prototype.hoverable
  62308. * @description 是否可以 hover。默认值:true。
  62309. */
  62310. this.hoverable = true;
  62311. /**
  62312. * @member {number} LevelRenderer.Shape.prototype.z
  62313. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  62314. */
  62315. this.z = 0;
  62316. //地理扩展
  62317. /**
  62318. * @member {Array.<number>} LevelRenderer.Shape.prototype.refOriginalPosition
  62319. * @description 图形参考原点位置,图形的参考中心位置。
  62320. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  62321. *
  62322. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  62323. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  62324. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  62325. *
  62326. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  62327. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  62328. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  62329. *
  62330. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  62331. *
  62332. * refOriginalPosition。默认值是: [0, 0]。
  62333. */
  62334. this.refOriginalPosition = [0, 0];
  62335. /**
  62336. * @member {string} LevelRenderer.Shape.prototype.refDataID
  62337. * @description 图形所关联数据的 ID。
  62338. *
  62339. */
  62340. this.refDataID = null;
  62341. /**
  62342. * @member {boolean} LevelRenderer.Shape.prototype.isHoverByRefDataID
  62343. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  62344. *
  62345. */
  62346. this.isHoverByRefDataID = false;
  62347. /**
  62348. * @member {string} LevelRenderer.Shape.prototype.refDataHoverGroup
  62349. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  62350. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  62351. *
  62352. */
  62353. this.refDataHoverGroup = null;
  62354. /**
  62355. * @member {Object} LevelRenderer.Shape.prototype.dataInfo
  62356. * @description 图形的数据信息。
  62357. *
  62358. */
  62359. this.dataInfo = null;
  62360. Util_Util.extend(this, options);
  62361. this.id = this.id || Util_Util.createUniqueID("smShape_");
  62362. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  62363. /**
  62364. * @function LevelRenderer.Shape.prototype.getTansform
  62365. * @description 变换鼠标位置到 shape 的局部坐标空间
  62366. *
  62367. */
  62368. this.getTansform = (function () {
  62369. var invTransform = [];
  62370. return function (x, y) {
  62371. var originPos = [x, y];
  62372. // 对鼠标的坐标也做相同的变换
  62373. if (this.needTransform && this.transform) {
  62374. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  62375. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  62376. if (x == originPos[0] && y == originPos[1]) {
  62377. // 避免外部修改导致的 needTransform 不准确
  62378. this.updateNeedTransform();
  62379. }
  62380. }
  62381. return originPos;
  62382. };
  62383. })();
  62384. }
  62385. /**
  62386. * @function LevelRenderer.Shape.prototype.destroy
  62387. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  62388. */
  62389. destroy() {
  62390. this.id = null;
  62391. this.style = null;
  62392. this.highlightStyle = null;
  62393. this.parent = null;
  62394. this.__dirty = null;
  62395. this.__clipShapes = null;
  62396. this.invisible = null;
  62397. this.ignore = null;
  62398. this.zlevel = null;
  62399. this.draggable = null;
  62400. this.clickable = null;
  62401. this.hoverable = null;
  62402. this.z = null;
  62403. this.refOriginalPosition = null;
  62404. this.refDataID = null;
  62405. this.refDataHoverGroup = null;
  62406. this.isHoverByRefDataID = null;
  62407. this.dataInfo = null;
  62408. super.destroy();
  62409. }
  62410. /**
  62411. * @function LevelRenderer.Shape.prototype.brush
  62412. * @description 绘制图形。
  62413. *
  62414. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62415. * @param {boolean} isHighlight - 是否使用高亮属性。
  62416. * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  62417. */
  62418. brush(ctx, isHighlight) {
  62419. var style = this.beforeBrush(ctx, isHighlight);
  62420. ctx.beginPath();
  62421. this.buildPath(ctx, style);
  62422. switch (style.brushType) {
  62423. /* jshint ignore:start */
  62424. case 'both':
  62425. this.setCtxGlobalAlpha(ctx, "fill", style);
  62426. ctx.fill();
  62427. if (style.lineWidth > 0) {
  62428. this.setCtxGlobalAlpha(ctx, "stroke", style);
  62429. ctx.stroke();
  62430. }
  62431. this.setCtxGlobalAlpha(ctx, "reset", style);
  62432. break;
  62433. case 'stroke':
  62434. this.setCtxGlobalAlpha(ctx, "stroke", style);
  62435. style.lineWidth > 0 && ctx.stroke();
  62436. this.setCtxGlobalAlpha(ctx, "reset", style);
  62437. break;
  62438. /* jshint ignore:end */
  62439. default:
  62440. this.setCtxGlobalAlpha(ctx, "fill", style);
  62441. ctx.fill();
  62442. this.setCtxGlobalAlpha(ctx, "reset", style);
  62443. break;
  62444. }
  62445. this.drawText(ctx, style, this.style);
  62446. this.afterBrush(ctx);
  62447. }
  62448. /**
  62449. * @function LevelRenderer.Shape.prototype.beforeBrush
  62450. * @description 具体绘制操作前的一些公共操作。
  62451. *
  62452. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62453. * @param {boolean} isHighlight - 是否使用高亮属性。
  62454. * @return {Object} 处理后的样式。
  62455. */
  62456. beforeBrush(ctx, isHighlight) {
  62457. var style = this.style;
  62458. if (this.brushTypeOnly) {
  62459. style.brushType = this.brushTypeOnly;
  62460. }
  62461. if (isHighlight) {
  62462. // 根据style扩展默认高亮样式
  62463. style = this.getHighlightStyle(
  62464. style,
  62465. this.highlightStyle || {},
  62466. this.brushTypeOnly
  62467. );
  62468. }
  62469. if (this.brushTypeOnly == 'stroke') {
  62470. style.strokeColor = style.strokeColor || style.color;
  62471. }
  62472. ctx.save();
  62473. this.doClip(ctx);
  62474. this.setContext(ctx, style);
  62475. // 设置transform
  62476. this.setTransform(ctx);
  62477. return style;
  62478. }
  62479. /**
  62480. * @function LevelRenderer.Shape.prototype.afterBrush
  62481. * @description 绘制后的处理。
  62482. *
  62483. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62484. *
  62485. */
  62486. afterBrush(ctx) {
  62487. ctx.restore();
  62488. }
  62489. /**
  62490. * @function LevelRenderer.Shape.prototype.setContext
  62491. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  62492. *
  62493. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62494. * @param {Object} style - 样式。
  62495. *
  62496. */
  62497. setContext(ctx, style) {
  62498. var STYLE_CTX_MAP = [
  62499. ['color', 'fillStyle'],
  62500. ['strokeColor', 'strokeStyle'],
  62501. ['opacity', 'globalAlpha'],
  62502. ['lineCap', 'lineCap'],
  62503. ['lineJoin', 'lineJoin'],
  62504. ['miterLimit', 'miterLimit'],
  62505. ['lineWidth', 'lineWidth'],
  62506. ['shadowBlur', 'shadowBlur'],
  62507. ['shadowColor', 'shadowColor'],
  62508. ['shadowOffsetX', 'shadowOffsetX'],
  62509. ['shadowOffsetY', 'shadowOffsetY']
  62510. ];
  62511. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  62512. var styleProp = STYLE_CTX_MAP[i][0];
  62513. var styleValue = style[styleProp];
  62514. var ctxProp = STYLE_CTX_MAP[i][1];
  62515. if (typeof styleValue != 'undefined') {
  62516. ctx[ctxProp] = styleValue;
  62517. }
  62518. }
  62519. }
  62520. /**
  62521. * @function LevelRenderer.Shape.prototype.doClip
  62522. *
  62523. */
  62524. doClip(ctx) {
  62525. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  62526. if (this.__clipShapes) {
  62527. for (var i = 0; i < this.__clipShapes.length; i++) {
  62528. var clipShape = this.__clipShapes[i];
  62529. if (clipShape.needTransform) {
  62530. let m = clipShape.transform;
  62531. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  62532. ctx.transform(
  62533. m[0], m[1],
  62534. m[2], m[3],
  62535. m[4], m[5]
  62536. );
  62537. }
  62538. ctx.beginPath();
  62539. clipShape.buildPath(ctx, clipShape.style);
  62540. ctx.clip();
  62541. // Transform back
  62542. if (clipShape.needTransform) {
  62543. let m = clipShapeInvTransform;
  62544. ctx.transform(
  62545. m[0], m[1],
  62546. m[2], m[3],
  62547. m[4], m[5]
  62548. );
  62549. }
  62550. }
  62551. }
  62552. }
  62553. /**
  62554. * @function LevelRenderer.Shape.prototype.getHighlightStyle
  62555. * @description 根据默认样式扩展高亮样式
  62556. *
  62557. * @param {Object} style - 样式。
  62558. * @param {Object} highlightStyle - 高亮样式。
  62559. * @param {string} brushTypeOnly - brushTypeOnly。
  62560. *
  62561. */
  62562. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  62563. var newStyle = {};
  62564. for (let k in style) {
  62565. newStyle[k] = style[k];
  62566. }
  62567. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  62568. // 根据highlightStyle扩展
  62569. if (style.brushType != 'stroke') {
  62570. // 带填充则用高亮色加粗边线
  62571. newStyle.strokeColor = highlightColor;
  62572. // SMIC-方法修改 - start
  62573. newStyle.lineWidth = (style.lineWidth || 1);
  62574. // 原始代码
  62575. // newStyle.lineWidth = (style.lineWidth || 1)
  62576. // + this.getHighlightZoom();
  62577. // 修改代码1
  62578. // if(!style.lineType || style.lineType === "solid"){
  62579. // newStyle.lineWidth = (style.lineWidth || 1)
  62580. // + this.getHighlightZoom();
  62581. // }
  62582. // else{
  62583. // newStyle.lineWidth = (style.lineWidth || 1);
  62584. // }
  62585. // SMIC-方法修改 - end
  62586. newStyle.brushType = 'both';
  62587. } else {
  62588. if (brushTypeOnly != 'stroke') {
  62589. // 描边型的则用原色加工高亮
  62590. newStyle.strokeColor = highlightColor;
  62591. // SMIC-方法修改 - start
  62592. newStyle.lineWidth = (style.lineWidth || 1);
  62593. // 原始代码
  62594. // newStyle.lineWidth = (style.lineWidth || 1)
  62595. // + this.getHighlightZoom();
  62596. // 修改代码1
  62597. // if(!style.lineType || style.lineType === "solid"){
  62598. // newStyle.lineWidth = (style.lineWidth || 1)
  62599. // + this.getHighlightZoom();
  62600. // }
  62601. // else{
  62602. // newStyle.lineWidth = (style.lineWidth || 1);
  62603. // }
  62604. // SMIC-方法修改 - end
  62605. } else {
  62606. // 线型的则用原色加工高亮
  62607. newStyle.strokeColor = highlightStyle.strokeColor
  62608. || SUtil_SUtil.Util_color.mix(
  62609. style.strokeColor,
  62610. SUtil_SUtil.Util_color.toRGB(highlightColor)
  62611. );
  62612. }
  62613. }
  62614. // 可自定义覆盖默认值
  62615. for (let k in highlightStyle) {
  62616. if (typeof highlightStyle[k] != 'undefined') {
  62617. newStyle[k] = highlightStyle[k];
  62618. }
  62619. }
  62620. return newStyle;
  62621. }
  62622. /**
  62623. * @function LevelRenderer.Shape.prototype.getHighlightZoom
  62624. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  62625. *
  62626. */
  62627. getHighlightZoom() {
  62628. return this.type != 'text' ? 6 : 2;
  62629. }
  62630. /**
  62631. * @function LevelRenderer.Shape.prototype.drift
  62632. * @description 移动位置
  62633. *
  62634. * @param {Object} dx - 横坐标变化。
  62635. * @param {Object} dy - 纵坐标变化。
  62636. *
  62637. */
  62638. drift(dx, dy) {
  62639. this.position[0] += dx;
  62640. this.position[1] += dy;
  62641. }
  62642. /**
  62643. * @function LevelRenderer.Shape.prototype.buildPath
  62644. * @description 构建绘制的Path。子类必须重新实现此方法。
  62645. *
  62646. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62647. * @param {Object} style - 样式。
  62648. */
  62649. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  62650. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  62651. }
  62652. /**
  62653. * @function LevelRenderer.Shape.prototype.getRect
  62654. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  62655. *
  62656. * @param {Object} style - 样式。
  62657. */
  62658. getRect(style) { // eslint-disable-line no-unused-vars
  62659. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  62660. }
  62661. /**
  62662. * @function LevelRenderer.Shape.prototype.isCover
  62663. * @description 判断鼠标位置是否在图形内。
  62664. *
  62665. * @param {number} x - x。
  62666. * @param {number} y - y。
  62667. */
  62668. isCover(x, y) {
  62669. var originPos = this.getTansform(x, y);
  62670. x = originPos[0];
  62671. y = originPos[1];
  62672. // 快速预判并保留判断矩形
  62673. var rect = this.style.__rect;
  62674. if (!rect) {
  62675. rect = this.style.__rect = this.getRect(this.style);
  62676. }
  62677. if (x >= rect.x
  62678. && x <= (rect.x + rect.width)
  62679. && y >= rect.y
  62680. && y <= (rect.y + rect.height)
  62681. ) {
  62682. // 矩形内
  62683. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  62684. }
  62685. return false;
  62686. }
  62687. /**
  62688. * @function LevelRenderer.Shape.prototype.drawText
  62689. * @description 绘制附加文本。
  62690. *
  62691. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  62692. * @param {string} style - 样式。
  62693. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  62694. */
  62695. drawText(ctx, style, normalStyle) {
  62696. if (typeof(style.text) == 'undefined' || style.text === false) {
  62697. return;
  62698. }
  62699. // 字体颜色策略
  62700. var textColor = style.textColor || style.color || style.strokeColor;
  62701. ctx.fillStyle = textColor;
  62702. // 文本与图形间空白间隙
  62703. var dd = 10;
  62704. var al; // 文本水平对齐
  62705. var bl; // 文本垂直对齐
  62706. var tx; // 文本横坐标
  62707. var ty; // 文本纵坐标
  62708. var textPosition = style.textPosition // 用户定义
  62709. || this.textPosition // shape默认
  62710. || 'top'; // 全局默认
  62711. // Smic 方法修改 -start
  62712. var __OP = [];
  62713. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  62714. __OP = [0, 0];
  62715. } else {
  62716. __OP = this.refOriginalPosition;
  62717. }
  62718. //原代码:
  62719. // Smic 方法修改 -end
  62720. switch (textPosition) {
  62721. case 'inside':
  62722. case 'top':
  62723. case 'bottom':
  62724. case 'left':
  62725. case 'right':
  62726. if (this.getRect) {
  62727. var rect = (normalStyle || style).__rect
  62728. || this.getRect(normalStyle || style);
  62729. switch (textPosition) {
  62730. case 'inside':
  62731. tx = rect.x + rect.width / 2;
  62732. ty = rect.y + rect.height / 2;
  62733. al = 'center';
  62734. bl = 'middle';
  62735. if (style.brushType != 'stroke'
  62736. && textColor == style.color
  62737. ) {
  62738. ctx.fillStyle = '#fff';
  62739. }
  62740. break;
  62741. case 'left':
  62742. tx = rect.x - dd;
  62743. ty = rect.y + rect.height / 2;
  62744. al = 'end';
  62745. bl = 'middle';
  62746. break;
  62747. case 'right':
  62748. tx = rect.x + rect.width + dd;
  62749. ty = rect.y + rect.height / 2;
  62750. al = 'start';
  62751. bl = 'middle';
  62752. break;
  62753. case 'top':
  62754. tx = rect.x + rect.width / 2;
  62755. ty = rect.y - dd;
  62756. al = 'center';
  62757. bl = 'bottom';
  62758. break;
  62759. case 'bottom':
  62760. tx = rect.x + rect.width / 2;
  62761. ty = rect.y + rect.height + dd;
  62762. al = 'center';
  62763. bl = 'top';
  62764. break;
  62765. }
  62766. }
  62767. break;
  62768. case 'start':
  62769. case 'end':
  62770. var xStart = 0;
  62771. var xEnd = 0;
  62772. var yStart = 0;
  62773. var yEnd = 0;
  62774. if (typeof style.pointList != 'undefined') {
  62775. var pointList = style.pointList;
  62776. if (pointList.length < 2) {
  62777. // 少于2个点就不画了~
  62778. return;
  62779. }
  62780. var length = pointList.length;
  62781. switch (textPosition) {
  62782. // Smic 方法修改 -start
  62783. case 'start':
  62784. xStart = pointList[0][0] + __OP[0];
  62785. xEnd = pointList[1][0] + __OP[0];
  62786. yStart = pointList[0][1] + __OP[1];
  62787. yEnd = pointList[1][1] + __OP[1];
  62788. break;
  62789. case 'end':
  62790. xStart = pointList[length - 2][0] + __OP[0];
  62791. xEnd = pointList[length - 1][0] + __OP[0];
  62792. yStart = pointList[length - 2][1] + __OP[1];
  62793. yEnd = pointList[length - 1][1] + __OP[1];
  62794. break;
  62795. //原代码:
  62796. /*
  62797. case 'start':
  62798. xStart = pointList[0][0];
  62799. xEnd = pointList[1][0];
  62800. yStart = pointList[0][1];
  62801. yEnd = pointList[1][1];
  62802. break;
  62803. case 'end':
  62804. xStart = pointList[length - 2][0];
  62805. xEnd = pointList[length - 1][0];
  62806. yStart = pointList[length - 2][1];
  62807. yEnd = pointList[length - 1][1];
  62808. break;
  62809. */
  62810. // Smic 方法修改 -end
  62811. }
  62812. } else {
  62813. // Smic 方法修改 -start
  62814. xStart = (style.xStart + __OP[0]) || 0;
  62815. xEnd = (style.xEnd + __OP[0]) || 0;
  62816. yStart = (style.yStart + __OP[1]) || 0;
  62817. yEnd = (style.yEnd + __OP[1]) || 0;
  62818. //原代码:
  62819. /*
  62820. xStart = style.xStart || 0;
  62821. xEnd = style.xEnd || 0;
  62822. yStart = style.yStart || 0;
  62823. yEnd = style.yEnd || 0;
  62824. */
  62825. // Smic 方法修改 -end
  62826. }
  62827. switch (textPosition) {
  62828. case 'start':
  62829. al = xStart < xEnd ? 'end' : 'start';
  62830. bl = yStart < yEnd ? 'bottom' : 'top';
  62831. tx = xStart;
  62832. ty = yStart;
  62833. break;
  62834. case 'end':
  62835. al = xStart < xEnd ? 'start' : 'end';
  62836. bl = yStart < yEnd ? 'top' : 'bottom';
  62837. tx = xEnd;
  62838. ty = yEnd;
  62839. break;
  62840. }
  62841. dd -= 4;
  62842. if (xStart && xEnd && xStart != xEnd) {
  62843. tx -= (al == 'end' ? dd : -dd);
  62844. } else {
  62845. al = 'center';
  62846. }
  62847. if (yStart != yEnd) {
  62848. ty -= (bl == 'bottom' ? dd : -dd);
  62849. } else {
  62850. bl = 'middle';
  62851. }
  62852. break;
  62853. case 'specific':
  62854. tx = style.textX || 0;
  62855. ty = style.textY || 0;
  62856. al = 'start';
  62857. bl = 'middle';
  62858. break;
  62859. }
  62860. // Smic 方法修改 -start
  62861. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  62862. tx += style.labelXOffset;
  62863. }
  62864. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  62865. ty += style.labelYOffset;
  62866. }
  62867. //原代码:
  62868. // Smic 方法修改 -end
  62869. if (tx != null && ty != null) {
  62870. Shape_Shape._fillText(
  62871. ctx,
  62872. style.text,
  62873. tx, ty,
  62874. style.textFont,
  62875. style.textAlign || al,
  62876. style.textBaseline || bl
  62877. );
  62878. }
  62879. }
  62880. /**
  62881. * @function LevelRenderer.Shape.prototype.modSelf
  62882. * @description 图形发生改变
  62883. */
  62884. modSelf() {
  62885. this.__dirty = true;
  62886. if (this.style) {
  62887. this.style.__rect = null;
  62888. }
  62889. if (this.highlightStyle) {
  62890. this.highlightStyle.__rect = null;
  62891. }
  62892. }
  62893. /**
  62894. * @function LevelRenderer.Shape.prototype.isSilent
  62895. * @description 图形是否会触发事件,通过 bind 绑定的事件
  62896. */
  62897. isSilent() {
  62898. return !(
  62899. this.hoverable || this.draggable || this.clickable
  62900. || this.onmousemove || this.onmouseover || this.onmouseout
  62901. || this.onmousedown || this.onmouseup || this.onclick
  62902. || this.ondragenter || this.ondragover || this.ondragleave
  62903. || this.ondrop
  62904. );
  62905. }
  62906. /**
  62907. * @function LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  62908. * @description 设置 Cavans 上下文全局透明度
  62909. *
  62910. * @param {Object} _ctx - Cavans 上下文
  62911. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  62912. * @param {Object} style - Symbolizer hash
  62913. */
  62914. setCtxGlobalAlpha(_ctx, type, style) {
  62915. if (type === "fill") {
  62916. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  62917. } else if (type === "stroke") {
  62918. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  62919. } else {
  62920. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  62921. }
  62922. }
  62923. /**
  62924. * @function LevelRenderer.Shape.prototype._fillText
  62925. * @description 填充文本
  62926. */
  62927. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  62928. if (textFont) {
  62929. ctx.font = textFont;
  62930. }
  62931. ctx.textAlign = textAlign;
  62932. ctx.textBaseline = textBaseline;
  62933. var rect = Shape_Shape._getTextRect(
  62934. text, x, y, textFont, textAlign, textBaseline
  62935. );
  62936. text = (text + '').split('\n');
  62937. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  62938. switch (textBaseline) {
  62939. case 'top':
  62940. y = rect.y;
  62941. break;
  62942. case 'bottom':
  62943. y = rect.y + lineHeight;
  62944. break;
  62945. default:
  62946. y = rect.y + lineHeight / 2;
  62947. }
  62948. for (var i = 0, l = text.length; i < l; i++) {
  62949. ctx.fillText(text[i], x, y);
  62950. y += lineHeight;
  62951. }
  62952. }
  62953. /**
  62954. * @function LevelRenderer.Shape._getTextRect
  62955. * @description 返回矩形区域,用于局部刷新和文字定位
  62956. *
  62957. * @param {string} text - text。
  62958. * @param {number} x - x。
  62959. * @param {number} y - y。
  62960. * @param {string} textFont - textFont。
  62961. * @param {string} textAlign - textAlign。
  62962. * @param {string} textBaseline - textBaseline。
  62963. * @return {Object} 矩形区域。
  62964. */
  62965. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  62966. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  62967. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  62968. text = (text + '').split('\n');
  62969. switch (textAlign) {
  62970. case 'end':
  62971. case 'right':
  62972. x -= width;
  62973. break;
  62974. case 'center':
  62975. x -= (width / 2);
  62976. break;
  62977. }
  62978. switch (textBaseline) {
  62979. case 'top':
  62980. break;
  62981. case 'bottom':
  62982. y -= lineHeight * text.length;
  62983. break;
  62984. default:
  62985. y -= lineHeight * text.length / 2;
  62986. }
  62987. return {
  62988. x: x,
  62989. y: y,
  62990. width: width,
  62991. height: lineHeight * text.length
  62992. };
  62993. }
  62994. }
  62995. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  62996. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62997. * This program are made available under the terms of the Apache License, Version 2.0
  62998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62999. /**
  63000. * @private
  63001. * @class LevelRenderer.Shape.SmicPoint
  63002. * @category Visualization Theme
  63003. * @classdesc 点。
  63004. * @extends LevelRenderer.Shape
  63005. * @example
  63006. * var shape = new LevelRenderer.Shape.SmicPoint({
  63007. * style: {
  63008. * x: 100,
  63009. * y: 100,
  63010. * r: 40,
  63011. * brushType: 'both',
  63012. * color: 'blue',
  63013. * strokeColor: 'red',
  63014. * lineWidth: 3,
  63015. * text: 'point'
  63016. * }
  63017. * });
  63018. * levelRenderer.addShape(shape);
  63019. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  63020. *
  63021. */
  63022. class SmicPoint extends Shape_Shape {
  63023. constructor(options) {
  63024. super(options);
  63025. /**
  63026. * @member {string} LevelRenderer.Shape.SmicPoint.prototype.type
  63027. * @description 图形类型。
  63028. */
  63029. this.type = 'smicpoint';
  63030. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63031. this.refOriginalPosition = [0, 0];
  63032. }
  63033. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  63034. }
  63035. /**
  63036. * @function cdestroy
  63037. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63038. */
  63039. destroy() {
  63040. this.type = null;
  63041. super.destroy();
  63042. }
  63043. /**
  63044. * @function LevelRenderer.Shape.SmicPoint.prototype.buildPath
  63045. * @description 创建点触。
  63046. *
  63047. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63048. * @param {Object} style - style。
  63049. *
  63050. */
  63051. buildPath(ctx, style) {
  63052. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63053. this.refOriginalPosition = [0, 0];
  63054. }
  63055. var __OP = this.refOriginalPosition;
  63056. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  63057. return;
  63058. }
  63059. /**
  63060. * @function LevelRenderer.Shape.SmicPoint.prototype.getRect
  63061. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  63062. *
  63063. * @param {Object} style - style
  63064. * @return {Object} 边框对象。包含属性:x,y,width,height。
  63065. */
  63066. getRect(style) {
  63067. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63068. this.refOriginalPosition = [0, 0];
  63069. }
  63070. var __OP = this.refOriginalPosition;
  63071. if (style.__rect) {
  63072. return style.__rect;
  63073. }
  63074. var lineWidth;
  63075. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  63076. lineWidth = style.lineWidth || 1;
  63077. } else {
  63078. lineWidth = 0;
  63079. }
  63080. style.__rect = {
  63081. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  63082. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  63083. width: style.r * 2 + lineWidth,
  63084. height: style.r * 2 + lineWidth
  63085. };
  63086. return style.__rect;
  63087. }
  63088. }
  63089. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  63090. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63091. * This program are made available under the terms of the Apache License, Version 2.0
  63092. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63093. /**
  63094. * @private
  63095. * @class LevelRenderer.Shape.SmicText
  63096. * @category Visualization Theme
  63097. * @extends {LevelRenderer.Shape}
  63098. * @example
  63099. * var shape = new LevelRenderer.Shape.SmicText({
  63100. * style: {
  63101. * text: 'Label',
  63102. * x: 100,
  63103. * y: 100,
  63104. * textFont: '14px Arial'
  63105. * }
  63106. * });
  63107. * levelRenderer.addShape(shape);
  63108. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  63109. */
  63110. class SmicText extends Shape_Shape {
  63111. constructor(options) {
  63112. super(options);
  63113. /**
  63114. * @member {string} LevelRenderer.Shape.SmicText.prototype.type
  63115. * @description 图形类型.
  63116. */
  63117. this.type = 'smictext';
  63118. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63119. this.refOriginalPosition = [0, 0];
  63120. }
  63121. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  63122. }
  63123. /**
  63124. * @function LevelRenderer.Shape.SmicText.prototype.destroy
  63125. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63126. */
  63127. destroy() {
  63128. this.type = null;
  63129. super.destroy();
  63130. }
  63131. /**
  63132. * @function LevelRenderer.Shape.SmicText.prototype.brush
  63133. * @description 笔触。
  63134. *
  63135. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63136. * @param {boolean} isHighlight - 是否使用高亮属性。
  63137. *
  63138. */
  63139. brush(ctx, isHighlight) {
  63140. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63141. this.refOriginalPosition = [0, 0];
  63142. }
  63143. var __OP = this.refOriginalPosition;
  63144. var style = this.style;
  63145. if (isHighlight) {
  63146. // 根据style扩展默认高亮样式
  63147. style = this.getHighlightStyle(
  63148. style, this.highlightStyle || {}
  63149. );
  63150. }
  63151. if (typeof(style.text) == 'undefined' || style.text === false) {
  63152. return;
  63153. }
  63154. ctx.save();
  63155. this.doClip(ctx);
  63156. this.setContext(ctx, style);
  63157. // 设置transform
  63158. this.setTransform(ctx);
  63159. if (style.textFont) {
  63160. ctx.font = style.textFont;
  63161. }
  63162. ctx.textAlign = style.textAlign || 'start';
  63163. ctx.textBaseline = style.textBaseline || 'middle';
  63164. var text = (style.text + '').split('\n');
  63165. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  63166. var rect = this.getRectNoRotation(style);
  63167. // var x = style.x;
  63168. var x = style.x + __OP[0];
  63169. var y;
  63170. if (style.textBaseline == 'top') {
  63171. y = rect.y;
  63172. } else if (style.textBaseline == 'bottom') {
  63173. y = rect.y + lineHeight;
  63174. } else {
  63175. y = rect.y + lineHeight / 2;
  63176. }
  63177. var ox = style.x + __OP[0];
  63178. var oy = style.y + __OP[1];
  63179. //文本绘制
  63180. for (var i = 0, l = text.length; i < l; i++) {
  63181. //是否渲染矩形背景及颜色
  63182. if (style.labelRect) {
  63183. //+4,-2是为了让文字距边框左右边缘有点间隔
  63184. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  63185. ctx.fillStyle = style.strokeColor;
  63186. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  63187. ctx.fillStyle = style.textColor;
  63188. }
  63189. switch (style.brushType) {
  63190. case 'stroke':
  63191. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63192. if (style.textRotation && style.textRotation !== 0) {
  63193. ctx.save();
  63194. ctx.translate(ox, oy);
  63195. ctx.rotate(style.textRotation * Math.PI / 180);
  63196. if (style.textBaseline == 'top') {
  63197. if (style.maxWidth) {
  63198. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  63199. } else {
  63200. ctx.strokeText(text[i], 0, lineHeight * i);
  63201. }
  63202. } else if (style.textBaseline == 'bottom') {
  63203. if (style.maxWidth) {
  63204. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  63205. } else {
  63206. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  63207. }
  63208. } else {
  63209. if (style.maxWidth) {
  63210. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  63211. } else {
  63212. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  63213. }
  63214. }
  63215. ctx.restore();
  63216. } else {
  63217. if (style.maxWidth) {
  63218. ctx.strokeText(text[i], x, y, style.maxWidth);
  63219. } else {
  63220. ctx.strokeText(text[i], x, y);
  63221. }
  63222. }
  63223. this.setCtxGlobalAlpha(ctx, "reset", style);
  63224. break;
  63225. case 'both':
  63226. if (style.textRotation && style.textRotation !== 0) {
  63227. ctx.save();
  63228. ctx.translate(ox, oy);
  63229. ctx.rotate(style.textRotation * Math.PI / 180);
  63230. if (style.textBaseline == 'top') {
  63231. if (style.maxWidth) {
  63232. this.setCtxGlobalAlpha(ctx, "fill", style);
  63233. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  63234. this.setCtxGlobalAlpha(ctx, "reset", style);
  63235. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63236. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  63237. this.setCtxGlobalAlpha(ctx, "reset", style);
  63238. } else {
  63239. this.setCtxGlobalAlpha(ctx, "fill", style);
  63240. ctx.fillText(text[i], 0, lineHeight * i);
  63241. this.setCtxGlobalAlpha(ctx, "reset", style);
  63242. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63243. ctx.strokeText(text[i], 0, lineHeight * i);
  63244. this.setCtxGlobalAlpha(ctx, "reset", style);
  63245. }
  63246. } else if (style.textBaseline == 'bottom') {
  63247. if (style.maxWidth) {
  63248. this.setCtxGlobalAlpha(ctx, "fill", style);
  63249. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  63250. this.setCtxGlobalAlpha(ctx, "reset", style);
  63251. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63252. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  63253. this.setCtxGlobalAlpha(ctx, "reset", style);
  63254. } else {
  63255. this.setCtxGlobalAlpha(ctx, "fill", style);
  63256. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  63257. this.setCtxGlobalAlpha(ctx, "reset", style);
  63258. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63259. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  63260. this.setCtxGlobalAlpha(ctx, "reset", style);
  63261. }
  63262. } else {
  63263. if (style.maxWidth) {
  63264. this.setCtxGlobalAlpha(ctx, "fill", style);
  63265. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  63266. this.setCtxGlobalAlpha(ctx, "reset", style);
  63267. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63268. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  63269. this.setCtxGlobalAlpha(ctx, "reset", style);
  63270. } else {
  63271. this.setCtxGlobalAlpha(ctx, "fill", style);
  63272. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  63273. this.setCtxGlobalAlpha(ctx, "reset", style);
  63274. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63275. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  63276. this.setCtxGlobalAlpha(ctx, "reset", style);
  63277. }
  63278. }
  63279. ctx.restore();
  63280. } else {
  63281. if (style.maxWidth) {
  63282. this.setCtxGlobalAlpha(ctx, "fill", style);
  63283. ctx.fillText(text[i], x, y, style.maxWidth);
  63284. this.setCtxGlobalAlpha(ctx, "reset", style);
  63285. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63286. ctx.strokeText(text[i], x, y, style.maxWidth);
  63287. this.setCtxGlobalAlpha(ctx, "reset", style);
  63288. } else {
  63289. this.setCtxGlobalAlpha(ctx, "fill", style);
  63290. ctx.fillText(text[i], x, y);
  63291. this.setCtxGlobalAlpha(ctx, "reset", style);
  63292. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63293. ctx.strokeText(text[i], x, y);
  63294. this.setCtxGlobalAlpha(ctx, "reset", style);
  63295. }
  63296. }
  63297. break;
  63298. default:
  63299. //fill or others
  63300. this.setCtxGlobalAlpha(ctx, "fill", style);
  63301. if (style.textRotation && style.textRotation !== 0) {
  63302. ctx.save();
  63303. ctx.translate(ox, oy);
  63304. ctx.rotate(style.textRotation * Math.PI / 180);
  63305. if (style.textBaseline == 'top') {
  63306. if (style.maxWidth) {
  63307. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  63308. } else {
  63309. ctx.fillText(text[i], 0, lineHeight * i);
  63310. }
  63311. } else if (style.textBaseline == 'bottom') {
  63312. if (style.maxWidth) {
  63313. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  63314. } else {
  63315. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  63316. }
  63317. } else {
  63318. if (style.maxWidth) {
  63319. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  63320. } else {
  63321. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  63322. }
  63323. }
  63324. ctx.restore();
  63325. } else {
  63326. if (style.maxWidth) {
  63327. ctx.fillText(text[i], x, y, style.maxWidth);
  63328. } else {
  63329. ctx.fillText(text[i], x, y);
  63330. }
  63331. }
  63332. this.setCtxGlobalAlpha(ctx, "reset", style);
  63333. }
  63334. y += lineHeight;
  63335. }
  63336. ctx.restore();
  63337. return;
  63338. }
  63339. /**
  63340. * @function LevelRenderer.Shape.SmicText.prototype.getRect
  63341. * @description 返回文字包围盒矩形
  63342. */
  63343. getRect(style) {
  63344. if (style.__rect) {
  63345. return style.__rect;
  63346. }
  63347. var left, top, right, bottom
  63348. var tbg = this.getTextBackground(style, true);
  63349. for (var i = 0, len = tbg.length; i < len; i++) {
  63350. var poi = tbg[i];
  63351. //用第一个点初始化
  63352. if (i == 0) {
  63353. left = poi[0];
  63354. right = poi[0];
  63355. top = poi[1];
  63356. bottom = poi[1];
  63357. } else {
  63358. if (poi[0] < left) {
  63359. left = poi[0]
  63360. }
  63361. if (poi[0] > right) {
  63362. right = poi[0]
  63363. }
  63364. if (poi[1] < top) {
  63365. top = poi[1]
  63366. }
  63367. if (poi[1] > bottom) {
  63368. bottom = poi[1]
  63369. }
  63370. }
  63371. }
  63372. style.__rect = {
  63373. x: left,
  63374. y: top,
  63375. width: right - left,
  63376. height: bottom - top
  63377. };
  63378. return style.__rect;
  63379. }
  63380. /**
  63381. * @function LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  63382. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  63383. */
  63384. getRectNoRotation(style) {
  63385. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63386. this.refOriginalPosition = [0, 0];
  63387. }
  63388. var __OP = this.refOriginalPosition;
  63389. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  63390. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  63391. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  63392. //处理文字位置,注:文本的绘制是由此 rect 决定
  63393. var textX = style.x + __OP[0]; // 默认start == left
  63394. if (style.textAlign == 'end' || style.textAlign == 'right') {
  63395. textX -= width;
  63396. } else if (style.textAlign == 'center') {
  63397. textX -= (width / 2);
  63398. }
  63399. var textY;
  63400. if (style.textBaseline == 'top') {
  63401. // textY = style.y;
  63402. textY = style.y + __OP[1];
  63403. } else if (style.textBaseline == 'bottom') {
  63404. textY = (style.y + __OP[1]) - height;
  63405. } else {
  63406. // middle
  63407. textY = (style.y + __OP[1]) - height / 2;
  63408. }
  63409. var isWidthChangeByMaxWidth = false;
  63410. var widthBeforeChangeByMaxWidth;
  63411. //处理 maxWidth
  63412. if (style.maxWidth) {
  63413. var maxWidth = parseInt(style.maxWidth);
  63414. if (maxWidth < width) {
  63415. widthBeforeChangeByMaxWidth = width;
  63416. isWidthChangeByMaxWidth = true;
  63417. width = maxWidth;
  63418. }
  63419. textX = style.x + __OP[0];
  63420. if (style.textAlign == 'end' || style.textAlign == 'right') {
  63421. textX -= width;
  63422. } else if (style.textAlign == 'center') {
  63423. textX -= (width / 2);
  63424. }
  63425. }
  63426. //处理斜体字
  63427. if (style.textFont) {
  63428. var textFont = style.textFont;
  63429. var textFontStr = textFont.toLowerCase()
  63430. if (textFontStr.indexOf("italic") > -1) {
  63431. if (isWidthChangeByMaxWidth === true) {
  63432. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  63433. } else {
  63434. width += lineHeight / 3;
  63435. }
  63436. }
  63437. }
  63438. var rect = {
  63439. x: textX,
  63440. y: textY,
  63441. width: width,
  63442. height: height
  63443. };
  63444. return rect;
  63445. }
  63446. /**
  63447. * @function LevelRenderer.Shape.SmicText.prototype.getTextBackground
  63448. * @description 获取文本背景框范围
  63449. *
  63450. * @param {Object} style - 样式。
  63451. * @param {boolean} redo - 是否强制重新计算 textBackground。
  63452. */
  63453. getTextBackground(style, redo) {
  63454. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63455. this.refOriginalPosition = [0, 0];
  63456. }
  63457. var __OP = this.refOriginalPosition;
  63458. if ((!redo) && style.__textBackground) {
  63459. return style.__textBackground;
  63460. }
  63461. //不旋转时矩形框
  63462. var rect = this.getRectNoRotation(style);
  63463. //旋转中心点
  63464. var ox = style.x + __OP[0];
  63465. var oy = style.y + __OP[1];
  63466. //背景框
  63467. var background = [];
  63468. if (style.textRotation && style.textRotation !== 0) {
  63469. let textRotation = style.textRotation;
  63470. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  63471. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  63472. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  63473. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  63474. background.push(ltPoi);
  63475. background.push(rtPoi);
  63476. background.push(rbPoi);
  63477. background.push(lbPoi);
  63478. } else {
  63479. let ltPoi = [rect.x, rect.y];
  63480. let rtPoi = [rect.x + rect.width, rect.y];
  63481. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  63482. let lbPoi = [rect.x, rect.y + rect.height];
  63483. background.push(ltPoi);
  63484. background.push(rtPoi);
  63485. background.push(rbPoi);
  63486. background.push(lbPoi);
  63487. }
  63488. style.__textBackground = background;
  63489. return style.__textBackground;
  63490. }
  63491. /**
  63492. * @function LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  63493. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  63494. *
  63495. * @param {number} x - 旋转点横坐标。
  63496. * @param {number} y - 旋转点纵坐标。
  63497. * @param {number} rx - 旋转中心点横坐标。
  63498. * @param {number} ry - 旋转中心点纵坐标。
  63499. * @param {number} angle - 旋转角度(度)。
  63500. * @return {Array.<number>} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  63501. */
  63502. getRotatedLocation(x, y, rx, ry, angle) {
  63503. var loc = new Array(), x0, y0;
  63504. y = -y;
  63505. ry = -ry;
  63506. angle = -angle;//顺时针旋转
  63507. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  63508. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  63509. loc[0] = x0;
  63510. loc[1] = -y0;
  63511. return loc;
  63512. }
  63513. }
  63514. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  63515. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63516. * This program are made available under the terms of the Apache License, Version 2.0
  63517. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63518. /**
  63519. * @private
  63520. * @class LevelRenderer.Shape.SmicCircle
  63521. * @category Visualization Theme
  63522. * @classdesc 圆形
  63523. * @extends LevelRenderer.Shape
  63524. * @example
  63525. * var shape = new LevelRenderer.Shape.SmicCircle({
  63526. * style: {
  63527. * x: 100,
  63528. * y: 100,
  63529. * r: 60,
  63530. * brushType: "both",
  63531. * color: "blue",
  63532. * strokeColor: "red",
  63533. * lineWidth: 3,
  63534. * text: "Circle"
  63535. * }
  63536. * });
  63537. * levelRenderer.addShape(shape);
  63538. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  63539. *
  63540. */
  63541. class SmicCircle extends Shape_Shape {
  63542. constructor(options) {
  63543. super(options);
  63544. /**
  63545. * @member {string} LevelRenderer.Shape.SmicCircle.prototype.type
  63546. * @description 图形类型。
  63547. */
  63548. this.type = 'smiccircle';
  63549. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63550. this.refOriginalPosition = [0, 0];
  63551. }
  63552. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  63553. }
  63554. /**
  63555. * @function LevelRenderer.Shape.SmicCircle.prototype.destroy
  63556. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63557. */
  63558. destroy() {
  63559. this.type = null;
  63560. super.destroy();
  63561. }
  63562. /**
  63563. * @function LevelRenderer.Shape.SmicCircle.prototype.buildPath
  63564. * @description 创建图形路径。
  63565. *
  63566. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63567. * @param {Object} style - style。
  63568. *
  63569. */
  63570. buildPath(ctx, style) {
  63571. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63572. this.refOriginalPosition = [0, 0];
  63573. }
  63574. var __OP = this.refOriginalPosition;
  63575. var x = style.x + __OP[0]; // 圆心x
  63576. var y = style.y + __OP[1]; // 圆心y
  63577. ctx.moveTo(x + style.r, y);
  63578. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  63579. return true;
  63580. }
  63581. /**
  63582. * @function LevelRenderer.Shape.SmicCircle.prototype.getRect
  63583. * @description 返回圆形包围盒矩形
  63584. *
  63585. * @param {Object} style - style
  63586. * @return {Object} 边框对象。包含属性:x,y,width,height。
  63587. *
  63588. */
  63589. getRect(style) {
  63590. if (style.__rect) {
  63591. return style.__rect;
  63592. }
  63593. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63594. this.refOriginalPosition = [0, 0];
  63595. }
  63596. var __OP = this.refOriginalPosition;
  63597. var x = style.x + __OP[0]; // 圆心x
  63598. var y = style.y + __OP[1]; // 圆心y
  63599. var r = style.r; // 圆r
  63600. var lineWidth;
  63601. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  63602. lineWidth = style.lineWidth || 1;
  63603. } else {
  63604. lineWidth = 0;
  63605. }
  63606. style.__rect = {
  63607. x: Math.round(x - r - lineWidth / 2),
  63608. y: Math.round(y - r - lineWidth / 2),
  63609. width: r * 2 + lineWidth,
  63610. height: r * 2 + lineWidth
  63611. };
  63612. return style.__rect;
  63613. }
  63614. }
  63615. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  63616. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63617. * This program are made available under the terms of the Apache License, Version 2.0
  63618. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63619. /**
  63620. * @private
  63621. * @class LevelRenderer.Shape.SmicPolygon
  63622. * @category Visualization Theme
  63623. * @classdesc 多边形。
  63624. * @extends LevelRenderer.Shape
  63625. * @example
  63626. * var shape = new LevelRenderer.Shape.SmicPolygon({
  63627. * style: {
  63628. * // 100x100 的正方形
  63629. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  63630. * color: 'blue'
  63631. * }
  63632. * });
  63633. * levelRenderer.addShape(shape);
  63634. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  63635. */
  63636. class SmicPolygon extends Shape_Shape {
  63637. constructor(options) {
  63638. super(options);
  63639. /**
  63640. * @member {string} LevelRenderer.Shape.SmicPolygon.prototype.type
  63641. * @description 图形类型.
  63642. */
  63643. this.type = 'smicpolygon';
  63644. /**
  63645. * @member {Array} LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  63646. * @description 岛洞面多边形顶点数组(三维数组)
  63647. *
  63648. */
  63649. this.holePolygonPointLists = null;
  63650. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63651. this.refOriginalPosition = [0, 0];
  63652. }
  63653. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  63654. }
  63655. /**
  63656. * @function LevelRenderer.Shape.SmicPolygon.prototype.destroy
  63657. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63658. */
  63659. destroy() {
  63660. this.type = null;
  63661. this.holePolygonPointLists = null;
  63662. super.destroy();
  63663. }
  63664. /**
  63665. * @function LevelRenderer.Shape.SmicPolygon.prototype.brush
  63666. * @description 笔触。
  63667. *
  63668. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63669. * @param {boolean} isHighlight - 是否使用高亮属性。
  63670. *
  63671. */
  63672. brush(ctx, isHighlight) {
  63673. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63674. this.refOriginalPosition = [0, 0];
  63675. }
  63676. var style = this.style;
  63677. if (isHighlight) {
  63678. // 根据style扩展默认高亮样式
  63679. style = this.getHighlightStyle(
  63680. style,
  63681. this.highlightStyle || {}
  63682. );
  63683. }
  63684. ctx.save();
  63685. this.setContext(ctx, style);
  63686. // 设置 transform
  63687. this.setTransform(ctx);
  63688. // 先 fill 再stroke
  63689. var hasPath = false;
  63690. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  63691. ctx.beginPath();
  63692. if (style.lineType == 'dashed'
  63693. || style.lineType == 'dotted'
  63694. || style.lineType == 'dot'
  63695. || style.lineType == 'dash'
  63696. || style.lineType == 'dashdot'
  63697. || style.lineType == 'longdash'
  63698. || style.lineType == 'longdashdot'
  63699. ) {
  63700. // 特殊处理,虚线围不成path,实线再build一次
  63701. this.buildPath(ctx, {
  63702. lineType: 'solid',
  63703. lineWidth: style.lineWidth,
  63704. pointList: style.pointList
  63705. }
  63706. );
  63707. } else {
  63708. this.buildPath(ctx, style);
  63709. hasPath = true; // 这个path能用
  63710. }
  63711. ctx.closePath();
  63712. this.setCtxGlobalAlpha(ctx, "fill", style);
  63713. ctx.fill();
  63714. this.setCtxGlobalAlpha(ctx, "reset", style);
  63715. }
  63716. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  63717. if (!hasPath) {
  63718. ctx.beginPath();
  63719. this.buildPath(ctx, style);
  63720. }
  63721. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63722. ctx.stroke();
  63723. this.setCtxGlobalAlpha(ctx, "reset", style);
  63724. }
  63725. this.drawText(ctx, style, this.style);
  63726. //岛洞
  63727. var hpStyle = Util_Util.cloneObject(style);
  63728. if (hpStyle.pointList) {
  63729. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  63730. var holePLS = this.holePolygonPointLists;
  63731. var holePLSen = holePLS.length;
  63732. for (var i = 0; i < holePLSen; i++) {
  63733. var holePL = holePLS[i];
  63734. //岛洞面
  63735. hpStyle.pointList = holePL;
  63736. ctx.globalCompositeOperation = "destination-out";
  63737. // 先 fill 再stroke
  63738. hasPath = false;
  63739. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  63740. ctx.beginPath();
  63741. if (hpStyle.lineType == 'dashed'
  63742. || hpStyle.lineType == 'dotted'
  63743. || hpStyle.lineType == 'dot'
  63744. || hpStyle.lineType == 'dash'
  63745. || hpStyle.lineType == 'dashdot'
  63746. || hpStyle.lineType == 'longdash'
  63747. || hpStyle.lineType == 'longdashdot'
  63748. ) {
  63749. // 特殊处理,虚线围不成path,实线再build一次
  63750. this.buildPath(ctx, {
  63751. lineType: 'solid',
  63752. lineWidth: hpStyle.lineWidth,
  63753. pointList: hpStyle.pointList
  63754. }
  63755. );
  63756. } else {
  63757. this.buildPath(ctx, hpStyle);
  63758. hasPath = true; // 这个path能用
  63759. }
  63760. ctx.closePath();
  63761. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  63762. ctx.fill();
  63763. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  63764. }
  63765. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  63766. if (!hasPath) {
  63767. ctx.beginPath();
  63768. this.buildPath(ctx, hpStyle);
  63769. }
  63770. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  63771. ctx.globalCompositeOperation = "source-over";
  63772. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  63773. ctx.stroke();
  63774. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  63775. } else {
  63776. ctx.globalCompositeOperation = "source-over";
  63777. }
  63778. }
  63779. }
  63780. }
  63781. ctx.restore();
  63782. return;
  63783. }
  63784. /**
  63785. * @function LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  63786. * @description 创建多边形路径。
  63787. *
  63788. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63789. * @param {Object} style - style。
  63790. *
  63791. */
  63792. buildPath(ctx, style) {
  63793. if (style.showShadow) {
  63794. ctx.shadowBlur = style.shadowBlur;
  63795. ctx.shadowColor = style.shadowColor;
  63796. ctx.shadowOffsetX = style.shadowOffsetX;
  63797. ctx.shadowOffsetY = style.shadowOffsetY;
  63798. }
  63799. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63800. this.refOriginalPosition = [0, 0];
  63801. }
  63802. var __OP = this.refOriginalPosition;
  63803. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  63804. var pointList = style.pointList;
  63805. if (pointList.length < 2) {
  63806. // 少于2个点就不画了~
  63807. return;
  63808. }
  63809. if (style.smooth && style.smooth !== 'spline') {
  63810. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  63811. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  63812. var cp1;
  63813. var cp2;
  63814. var p;
  63815. var len = pointList.length;
  63816. for (var i = 0; i < len; i++) {
  63817. cp1 = controlPoints[i * 2];
  63818. cp2 = controlPoints[i * 2 + 1];
  63819. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  63820. ctx.bezierCurveTo(
  63821. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  63822. );
  63823. }
  63824. } else {
  63825. if (style.smooth === 'spline') {
  63826. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  63827. }
  63828. if (!style.lineType || style.lineType == 'solid') {
  63829. // 默认为实线
  63830. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  63831. for (let i = 1; i < pointList.length; i++) {
  63832. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  63833. }
  63834. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  63835. } else if (style.lineType === 'dashed'
  63836. || style.lineType === 'dotted'
  63837. || style.lineType === 'dot'
  63838. || style.lineType === 'dash'
  63839. || style.lineType === 'longdash'
  63840. ) {
  63841. // SMIC-方法修改 - start
  63842. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  63843. style._dashLength = dashLengthForStyle;
  63844. let dashLength = (style.lineWidth || 1);
  63845. let pattern1 = dashLength;
  63846. let pattern2 = dashLength;
  63847. //dashed
  63848. if (style.lineType === 'dashed') {
  63849. pattern1 *= 5;
  63850. pattern2 *= 5;
  63851. if (style.lineCap && style.lineCap !== "butt") {
  63852. pattern1 -= dashLength;
  63853. pattern2 += dashLength;
  63854. }
  63855. }
  63856. //dotted
  63857. if (style.lineType === 'dotted') {
  63858. if (style.lineCap && style.lineCap !== "butt") {
  63859. pattern1 = 1;
  63860. pattern2 += dashLength;
  63861. }
  63862. }
  63863. //dot
  63864. if (style.lineType === 'dot') {
  63865. pattern2 *= 4;
  63866. if (style.lineCap && style.lineCap !== "butt") {
  63867. pattern1 = 1;
  63868. pattern2 += dashLength;
  63869. }
  63870. }
  63871. //dash
  63872. if (style.lineType === 'dash') {
  63873. pattern1 *= 4;
  63874. pattern2 *= 4;
  63875. if (style.lineCap && style.lineCap !== "butt") {
  63876. pattern1 -= dashLength;
  63877. pattern2 += dashLength;
  63878. }
  63879. }
  63880. //longdash
  63881. if (style.lineType === 'longdash') {
  63882. pattern1 *= 8;
  63883. pattern2 *= 4;
  63884. if (style.lineCap && style.lineCap !== "butt") {
  63885. pattern1 -= dashLength;
  63886. pattern2 += dashLength;
  63887. }
  63888. }
  63889. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  63890. for (let i = 1; i < pointList.length; i++) {
  63891. SUtil_SUtil.SUtil_dashedLineTo(
  63892. ctx,
  63893. pointList[i - 1][0] + __OP[0],
  63894. pointList[i - 1][1] + __OP[1],
  63895. pointList[i][0] + __OP[0],
  63896. pointList[i][1] + __OP[1],
  63897. dashLength,
  63898. [pattern1, pattern2]
  63899. );
  63900. }
  63901. SUtil_SUtil.SUtil_dashedLineTo(
  63902. ctx,
  63903. pointList[pointList.length - 1][0] + __OP[0],
  63904. pointList[pointList.length - 1][1] + __OP[1],
  63905. pointList[0][0] + __OP[0],
  63906. pointList[0][1] + __OP[1],
  63907. dashLength,
  63908. [pattern1, pattern2]
  63909. );
  63910. } else if (style.lineType === 'dashdot'
  63911. || style.lineType === 'longdashdot'
  63912. ) {
  63913. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  63914. style._dashLength = dashLengthForStyle;
  63915. let dashLength = (style.lineWidth || 1);
  63916. let pattern1 = dashLength;
  63917. let pattern2 = dashLength;
  63918. let pattern3 = dashLength;
  63919. let pattern4 = dashLength;
  63920. //dashdot
  63921. if (style.lineType === 'dashdot') {
  63922. pattern1 *= 4;
  63923. pattern2 *= 4;
  63924. pattern4 *= 4;
  63925. if (style.lineCap && style.lineCap !== "butt") {
  63926. pattern1 -= dashLength;
  63927. pattern2 += dashLength;
  63928. pattern3 = 1;
  63929. pattern4 += dashLength;
  63930. }
  63931. }
  63932. //longdashdot
  63933. if (style.lineType === 'longdashdot') {
  63934. pattern1 *= 8;
  63935. pattern2 *= 4;
  63936. pattern4 *= 4;
  63937. if (style.lineCap && style.lineCap !== "butt") {
  63938. pattern1 -= dashLength;
  63939. pattern2 += dashLength;
  63940. pattern3 = 1;
  63941. pattern4 += dashLength;
  63942. }
  63943. }
  63944. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  63945. for (let i = 1; i < pointList.length; i++) {
  63946. SUtil_SUtil.SUtil_dashedLineTo(
  63947. ctx,
  63948. pointList[i - 1][0] + __OP[0],
  63949. pointList[i - 1][1] + __OP[1],
  63950. pointList[i][0] + __OP[0],
  63951. pointList[i][1] + __OP[1],
  63952. dashLength,
  63953. [pattern1, pattern2, pattern3, pattern4]
  63954. );
  63955. }
  63956. SUtil_SUtil.SUtil_dashedLineTo(
  63957. ctx,
  63958. pointList[pointList.length - 1][0] + __OP[0],
  63959. pointList[pointList.length - 1][1] + __OP[1],
  63960. pointList[0][0] + __OP[0],
  63961. pointList[0][1] + __OP[1],
  63962. dashLength,
  63963. [pattern1, pattern2, pattern3, pattern4]
  63964. );
  63965. }
  63966. }
  63967. return;
  63968. }
  63969. /**
  63970. * @function LevelRenderer.Shape.SmicPolygon.prototype.getRect
  63971. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  63972. *
  63973. * @param {Object} style - style
  63974. * @return {Object} 边框对象。包含属性:x,y,width,height。
  63975. *
  63976. */
  63977. getRect(style, refOriginalPosition) {
  63978. var __OP;
  63979. if (!refOriginalPosition) {
  63980. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63981. this.refOriginalPosition = [0, 0];
  63982. }
  63983. __OP = this.refOriginalPosition;
  63984. } else {
  63985. __OP = refOriginalPosition;
  63986. }
  63987. if (style.__rect) {
  63988. return style.__rect;
  63989. }
  63990. var minX = Number.MAX_VALUE;
  63991. var maxX = Number.MIN_VALUE;
  63992. var minY = Number.MAX_VALUE;
  63993. var maxY = Number.MIN_VALUE;
  63994. var pointList = style.pointList;
  63995. for (var i = 0, l = pointList.length; i < l; i++) {
  63996. if (pointList[i][0] + __OP[0] < minX) {
  63997. minX = pointList[i][0] + __OP[0];
  63998. }
  63999. if (pointList[i][0] + __OP[0] > maxX) {
  64000. maxX = pointList[i][0] + __OP[0];
  64001. }
  64002. if (pointList[i][1] + __OP[1] < minY) {
  64003. minY = pointList[i][1] + __OP[1];
  64004. }
  64005. if (pointList[i][1] + __OP[1] > maxY) {
  64006. maxY = pointList[i][1] + __OP[1];
  64007. }
  64008. }
  64009. var lineWidth;
  64010. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  64011. lineWidth = style.lineWidth || 1;
  64012. } else {
  64013. lineWidth = 0;
  64014. }
  64015. style.__rect = {
  64016. x: Math.round(minX - lineWidth / 2),
  64017. y: Math.round(minY - lineWidth / 2),
  64018. width: maxX - minX + lineWidth,
  64019. height: maxY - minY + lineWidth
  64020. };
  64021. return style.__rect;
  64022. }
  64023. }
  64024. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  64025. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64026. * This program are made available under the terms of the Apache License, Version 2.0
  64027. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64028. /**
  64029. * @private
  64030. * @class LevelRenderer.Shape.SmicBrokenLine
  64031. * @category Visualization Theme
  64032. * @classdesc 折线(ic)。
  64033. * @extends LevelRenderer.Shape
  64034. * @example
  64035. * var shape = new LevelRenderer.Shape.SmicBrokenLine({
  64036. * style: {
  64037. * pointList: [[0, 0], [100, 100], [100, 0]],
  64038. * smooth: 'bezier',
  64039. * strokeColor: 'purple'
  64040. * }
  64041. * });
  64042. * levelRenderer.addShape(shape);
  64043. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64044. *
  64045. */
  64046. class SmicBrokenLine extends Shape_Shape {
  64047. constructor(options) {
  64048. super(options);
  64049. /**
  64050. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  64051. * @description 线条只能描边。
  64052. */
  64053. this.brushTypeOnly = 'stroke';
  64054. /**
  64055. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  64056. * @description 文本位置。
  64057. */
  64058. this.textPosition = 'end';
  64059. /**
  64060. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.type
  64061. * @description 图形类型.
  64062. */
  64063. this.type = 'smicbroken-line';
  64064. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64065. this.refOriginalPosition = [0, 0];
  64066. }
  64067. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  64068. }
  64069. /**
  64070. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  64071. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64072. */
  64073. destroy() {
  64074. this.brushTypeOnly = null;
  64075. this.textPosition = null;
  64076. this.type = null;
  64077. super.destroy();
  64078. }
  64079. /**
  64080. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  64081. * @description 创建折线路径。
  64082. *
  64083. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64084. * @param {Object} style - style。
  64085. *
  64086. */
  64087. buildPath(ctx, style) {
  64088. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64089. this.refOriginalPosition = [0, 0];
  64090. }
  64091. var __OP = this.refOriginalPosition;
  64092. var pointList = style.pointList;
  64093. if (pointList.length < 2) {
  64094. // 少于2个点就不画了~
  64095. return;
  64096. }
  64097. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  64098. if (style.smooth && style.smooth !== 'spline') {
  64099. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  64100. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  64101. var cp1;
  64102. var cp2;
  64103. var p;
  64104. for (let i = 0; i < len - 1; i++) {
  64105. cp1 = controlPoints[i * 2];
  64106. cp2 = controlPoints[i * 2 + 1];
  64107. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  64108. ctx.bezierCurveTo(
  64109. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  64110. );
  64111. }
  64112. } else {
  64113. if (style.smooth === 'spline') {
  64114. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  64115. len = pointList.length;
  64116. }
  64117. if (!style.lineType || style.lineType === 'solid') {
  64118. // 默认为实线
  64119. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  64120. for (let i = 1; i < len; i++) {
  64121. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  64122. }
  64123. } else if (style.lineType === 'dashed'
  64124. || style.lineType === 'dotted'
  64125. || style.lineType === 'dot'
  64126. || style.lineType === 'dash'
  64127. || style.lineType === 'longdash'
  64128. ) {
  64129. let dashLength = (style.lineWidth || 1);
  64130. let pattern1 = dashLength;
  64131. let pattern2 = dashLength;
  64132. //dashed
  64133. if (style.lineType === 'dashed') {
  64134. pattern1 *= 5;
  64135. pattern2 *= 5;
  64136. if (style.lineCap && style.lineCap !== "butt") {
  64137. pattern1 -= dashLength;
  64138. pattern2 += dashLength;
  64139. }
  64140. }
  64141. //dotted
  64142. if (style.lineType === 'dotted') {
  64143. if (style.lineCap && style.lineCap !== "butt") {
  64144. pattern1 = 1;
  64145. pattern2 += dashLength;
  64146. }
  64147. }
  64148. //dot
  64149. if (style.lineType === 'dot') {
  64150. pattern2 *= 4;
  64151. if (style.lineCap && style.lineCap !== "butt") {
  64152. pattern1 = 1;
  64153. pattern2 += dashLength;
  64154. }
  64155. }
  64156. //dash
  64157. if (style.lineType === 'dash') {
  64158. pattern1 *= 4;
  64159. pattern2 *= 4;
  64160. if (style.lineCap && style.lineCap !== "butt") {
  64161. pattern1 -= dashLength;
  64162. pattern2 += dashLength;
  64163. }
  64164. }
  64165. //longdash
  64166. if (style.lineType === 'longdash') {
  64167. pattern1 *= 8;
  64168. pattern2 *= 4;
  64169. if (style.lineCap && style.lineCap !== "butt") {
  64170. pattern1 -= dashLength;
  64171. pattern2 += dashLength;
  64172. }
  64173. }
  64174. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  64175. for (var i = 1; i < len; i++) {
  64176. SUtil_SUtil.SUtil_dashedLineTo(
  64177. ctx,
  64178. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  64179. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  64180. dashLength,
  64181. [pattern1, pattern2]
  64182. );
  64183. }
  64184. } else if (style.lineType === 'dashdot'
  64185. || style.lineType === 'longdashdot'
  64186. ) {
  64187. let dashLength = (style.lineWidth || 1);
  64188. let pattern1 = dashLength;
  64189. let pattern2 = dashLength;
  64190. let pattern3 = dashLength;
  64191. let pattern4 = dashLength;
  64192. //dashdot
  64193. if (style.lineType === 'dashdot') {
  64194. pattern1 *= 4;
  64195. pattern2 *= 4;
  64196. pattern4 *= 4;
  64197. if (style.lineCap && style.lineCap !== "butt") {
  64198. pattern1 -= dashLength;
  64199. pattern2 += dashLength;
  64200. pattern3 = 1;
  64201. pattern4 += dashLength;
  64202. }
  64203. }
  64204. //longdashdot
  64205. if (style.lineType === 'longdashdot') {
  64206. pattern1 *= 8;
  64207. pattern2 *= 4;
  64208. pattern4 *= 4;
  64209. if (style.lineCap && style.lineCap !== "butt") {
  64210. pattern1 -= dashLength;
  64211. pattern2 += dashLength;
  64212. pattern3 = 1;
  64213. pattern4 += dashLength;
  64214. }
  64215. }
  64216. dashLength = (style.lineWidth || 1)
  64217. * (style.lineType === 'dashed' ? 5 : 1);
  64218. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  64219. for (let i = 1; i < len; i++) {
  64220. SUtil_SUtil.SUtil_dashedLineTo(
  64221. ctx,
  64222. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  64223. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  64224. dashLength,
  64225. [pattern1, pattern2, pattern3, pattern4]
  64226. );
  64227. }
  64228. }
  64229. }
  64230. return;
  64231. }
  64232. /**
  64233. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  64234. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  64235. *
  64236. * @param {Object} style - style
  64237. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64238. */
  64239. getRect(style) {
  64240. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64241. this.refOriginalPosition = [0, 0];
  64242. }
  64243. var __OP = this.refOriginalPosition;
  64244. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  64245. }
  64246. }
  64247. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  64248. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64249. * This program are made available under the terms of the Apache License, Version 2.0
  64250. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64251. /**
  64252. * @private
  64253. * @class LevelRenderer.Shape.SmicImage
  64254. * @category Visualization Theme
  64255. * @classdesc 图片绘制。
  64256. * @extends LevelRenderer.Shape
  64257. * @example
  64258. * var shape = new LevelRenderer.Shape.SmicImage({
  64259. * style: {
  64260. * image: 'test.jpg',
  64261. * x: 100,
  64262. * y: 100
  64263. * }
  64264. * });
  64265. * levelRenderer.addShape(shape);
  64266. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64267. *
  64268. */
  64269. class SmicImage extends Shape_Shape {
  64270. constructor(options) {
  64271. super(options);
  64272. /**
  64273. * @member {string} LevelRenderer.Shape.SmicImage.prototype.type
  64274. * @description 图形类型。
  64275. */
  64276. this.type = 'smicimage';
  64277. /**
  64278. * @member {string} LevelRenderer.Shape.SmicImage.prototype._imageCache
  64279. * @description 图片缓存。
  64280. */
  64281. this._imageCache = {};
  64282. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64283. this.refOriginalPosition = [0, 0];
  64284. }
  64285. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  64286. }
  64287. /**
  64288. * @function LevelRenderer.Shape.SmicImage.prototype.destroy
  64289. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64290. */
  64291. destroy() {
  64292. this.type = null;
  64293. this._imageCache = null;
  64294. super.destroy();
  64295. }
  64296. /**
  64297. * @function LevelRenderer.Shape.SmicImage.prototype.buildPath
  64298. * @description 创建图片。
  64299. *
  64300. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64301. * @param {Object} style - style。
  64302. *
  64303. */
  64304. brush(ctx, isHighlight, refresh) {
  64305. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64306. this.refOriginalPosition = [0, 0];
  64307. }
  64308. var __OP = this.refOriginalPosition;
  64309. var style = this.style || {};
  64310. if (isHighlight) {
  64311. // 根据style扩展默认高亮样式
  64312. style = this.getHighlightStyle(
  64313. style, this.highlightStyle || {}
  64314. );
  64315. }
  64316. var image = style.image;
  64317. var me = this;
  64318. if (typeof(image) === 'string') {
  64319. var src = image;
  64320. if (this._imageCache[src]) {
  64321. image = this._imageCache[src];
  64322. } else {
  64323. image = new Image();
  64324. image.onload = function () {
  64325. image.onload = null;
  64326. clearTimeout(SmicImage._refreshTimeout);
  64327. SmicImage._needsRefresh.push(me);
  64328. // 防止因为缓存短时间内触发多次onload事件
  64329. SmicImage._refreshTimeout = setTimeout(function () {
  64330. refresh && refresh(SmicImage._needsRefresh);
  64331. // 清空 needsRefresh
  64332. SmicImage._needsRefresh = [];
  64333. }, 10);
  64334. };
  64335. image.src = src;
  64336. this._imageCache[src] = image;
  64337. }
  64338. }
  64339. if (image) {
  64340. // 图片已经加载完成
  64341. if (image.nodeName.toUpperCase() == 'IMG') {
  64342. if (window.ActiveXObject) {
  64343. if (image.readyState != 'complete') {
  64344. return;
  64345. }
  64346. } else {
  64347. if (!image.complete) {
  64348. return;
  64349. }
  64350. }
  64351. }
  64352. // Else is canvas
  64353. var width = style.width || image.width;
  64354. var height = style.height || image.height;
  64355. var x = style.x + __OP[0];
  64356. var y = style.y + __OP[1];
  64357. // 图片加载失败
  64358. if (!image.width || !image.height) {
  64359. return;
  64360. }
  64361. ctx.save();
  64362. this.doClip(ctx);
  64363. this.setContext(ctx, style);
  64364. // 设置transform
  64365. this.setTransform(ctx);
  64366. if (style.sWidth && style.sHeight) {
  64367. let sx = (style.sx + __OP[0]) || 0;
  64368. let sy = (style.sy + __OP[1]) || 0;
  64369. ctx.drawImage(
  64370. image,
  64371. sx, sy, style.sWidth, style.sHeight,
  64372. x, y, width, height
  64373. );
  64374. } else if (style.sx && style.sy) {
  64375. let sx = style.sx + __OP[0];
  64376. let sy = style.sy + __OP[1];
  64377. var sWidth = width - sx;
  64378. var sHeight = height - sy;
  64379. ctx.drawImage(
  64380. image,
  64381. sx, sy, sWidth, sHeight,
  64382. x, y, width, height
  64383. );
  64384. } else {
  64385. ctx.drawImage(image, x, y, width, height);
  64386. }
  64387. // 如果没设置宽和高的话自动根据图片宽高设置
  64388. if (!style.width) {
  64389. style.width = width;
  64390. }
  64391. if (!style.height) {
  64392. style.height = height;
  64393. }
  64394. if (!this.style.width) {
  64395. this.style.width = width;
  64396. }
  64397. if (!this.style.height) {
  64398. this.style.height = height;
  64399. }
  64400. this.drawText(ctx, style, this.style);
  64401. ctx.restore();
  64402. }
  64403. }
  64404. /**
  64405. * @function LevelRenderer.Shape.SmicImage.prototype.getRect
  64406. * @description 计算返回图片的包围盒矩形。
  64407. *
  64408. * @param {Object} style - style
  64409. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64410. */
  64411. getRect(style) {
  64412. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64413. this.refOriginalPosition = [0, 0];
  64414. }
  64415. var __OP = this.refOriginalPosition;
  64416. return {
  64417. x: style.x + __OP[0],
  64418. y: style.y + __OP[1],
  64419. width: style.width,
  64420. height: style.height
  64421. };
  64422. }
  64423. /**
  64424. * @function LevelRenderer.Shape.SmicImage.prototype.clearCache
  64425. * @description 清除图片缓存。
  64426. *
  64427. * @param {Object} style - style
  64428. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64429. *
  64430. */
  64431. clearCache() {
  64432. this._imageCache = {};
  64433. }
  64434. }
  64435. SmicImage._needsRefresh = [];
  64436. SmicImage._refreshTimeout = null;
  64437. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  64438. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64439. * This program are made available under the terms of the Apache License, Version 2.0
  64440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64441. /**
  64442. * @private
  64443. * @class LevelRenderer.Shape.SmicRectangle
  64444. * @category Visualization Theme
  64445. * @classdesc 矩形。
  64446. * @extends LevelRenderer.Shape
  64447. * @example
  64448. * var shape = new LevelRenderer.Shape.SmicRectangle({
  64449. * style: {
  64450. * x: 0,
  64451. * y: 0,
  64452. * width: 100,
  64453. * height: 100,
  64454. * radius: 20
  64455. * }
  64456. * });
  64457. * levelRenderer.addShape(shape);
  64458. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64459. */
  64460. class SmicRectangle extends Shape_Shape {
  64461. constructor(options) {
  64462. super(options);
  64463. /**
  64464. * @member {string} LevelRenderer.Shape.SmicRectangle.prototype.type
  64465. * @description 图形类型.
  64466. */
  64467. this.type = 'smicrectangle';
  64468. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64469. this.refOriginalPosition = [0, 0];
  64470. }
  64471. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  64472. }
  64473. /**
  64474. * @function LevelRenderer.Shape.SmicRectangle.prototype.destroy
  64475. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64476. */
  64477. destroy() {
  64478. this.type = null;
  64479. super.destroy();
  64480. }
  64481. /**
  64482. * APIMethod: _buildRadiusPath
  64483. * 创建矩形的圆角路径。
  64484. *
  64485. * Parameters:
  64486. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  64487. * style - {Object} style。
  64488. *
  64489. */
  64490. _buildRadiusPath(ctx, style) {
  64491. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64492. this.refOriginalPosition = [0, 0];
  64493. }
  64494. var __OP = this.refOriginalPosition;
  64495. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  64496. // r缩写为1 相当于 [1, 1, 1, 1]
  64497. // r缩写为[1] 相当于 [1, 1, 1, 1]
  64498. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  64499. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  64500. var x = style.x + __OP[0];
  64501. var y = style.y + __OP[1];
  64502. var width = style.width;
  64503. var height = style.height;
  64504. var r = style.radius;
  64505. var r1;
  64506. var r2;
  64507. var r3;
  64508. var r4;
  64509. if (typeof r === 'number') {
  64510. r1 = r2 = r3 = r4 = r;
  64511. } else if (r instanceof Array) {
  64512. if (r.length === 1) {
  64513. r1 = r2 = r3 = r4 = r[0];
  64514. } else if (r.length === 2) {
  64515. r1 = r3 = r[0];
  64516. r2 = r4 = r[1];
  64517. } else if (r.length === 3) {
  64518. r1 = r[0];
  64519. r2 = r4 = r[1];
  64520. r3 = r[2];
  64521. } else {
  64522. r1 = r[0];
  64523. r2 = r[1];
  64524. r3 = r[2];
  64525. r4 = r[3];
  64526. }
  64527. } else {
  64528. r1 = r2 = r3 = r4 = 0;
  64529. }
  64530. var total;
  64531. if (r1 + r2 > width) {
  64532. total = r1 + r2;
  64533. r1 *= width / total;
  64534. r2 *= width / total;
  64535. }
  64536. if (r3 + r4 > width) {
  64537. total = r3 + r4;
  64538. r3 *= width / total;
  64539. r4 *= width / total;
  64540. }
  64541. if (r2 + r3 > height) {
  64542. total = r2 + r3;
  64543. r2 *= height / total;
  64544. r3 *= height / total;
  64545. }
  64546. if (r1 + r4 > height) {
  64547. total = r1 + r4;
  64548. r1 *= height / total;
  64549. r4 *= height / total;
  64550. }
  64551. ctx.moveTo(x + r1, y);
  64552. ctx.lineTo(x + width - r2, y);
  64553. r2 !== 0 && ctx.quadraticCurveTo(
  64554. x + width, y, x + width, y + r2
  64555. );
  64556. ctx.lineTo(x + width, y + height - r3);
  64557. r3 !== 0 && ctx.quadraticCurveTo(
  64558. x + width, y + height, x + width - r3, y + height
  64559. );
  64560. ctx.lineTo(x + r4, y + height);
  64561. r4 !== 0 && ctx.quadraticCurveTo(
  64562. x, y + height, x, y + height - r4
  64563. );
  64564. ctx.lineTo(x, y + r1);
  64565. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  64566. }
  64567. /**
  64568. * @function LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  64569. * @description 创建矩形路径。
  64570. *
  64571. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64572. * @param {Object} style - style。
  64573. *
  64574. */
  64575. buildPath(ctx, style) {
  64576. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64577. this.refOriginalPosition = [0, 0];
  64578. }
  64579. var __OP = this.refOriginalPosition;
  64580. if (!style.radius) {
  64581. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  64582. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  64583. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  64584. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  64585. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  64586. // ctx.rect(style.x, style.y, style.width, style.height);
  64587. } else {
  64588. this._buildRadiusPath(ctx, style);
  64589. }
  64590. ctx.closePath();
  64591. return;
  64592. }
  64593. /**
  64594. * @function LevelRenderer.Shape.SmicRectangle.prototype.getRect
  64595. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  64596. *
  64597. * @param {Object} style - style
  64598. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64599. */
  64600. getRect(style) {
  64601. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64602. this.refOriginalPosition = [0, 0];
  64603. }
  64604. var __OP = this.refOriginalPosition;
  64605. if (style.__rect) {
  64606. return style.__rect;
  64607. }
  64608. var lineWidth;
  64609. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  64610. lineWidth = style.lineWidth || 1;
  64611. } else {
  64612. lineWidth = 0;
  64613. }
  64614. style.__rect = {
  64615. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  64616. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  64617. width: style.width + lineWidth,
  64618. height: style.height + lineWidth
  64619. };
  64620. return style.__rect;
  64621. }
  64622. }
  64623. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  64624. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64625. * This program are made available under the terms of the Apache License, Version 2.0
  64626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64627. /**
  64628. * @private
  64629. * @class LevelRenderer.Shape.SmicSector
  64630. * @category Visualization Theme
  64631. * @classdesc 扇形。
  64632. * @extends LevelRenderer.Shape
  64633. * @example
  64634. * var shape = new LevelRenderer.Shape.SmicSector({
  64635. * style: {
  64636. * x: 100,
  64637. * y: 100,
  64638. * r: 60,
  64639. * r0: 30,
  64640. * startAngle: 0,
  64641. * endEngle: 180
  64642. * }
  64643. * });
  64644. * levelRenderer.addShape(shape);
  64645. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64646. *
  64647. */
  64648. class SmicSector extends Shape_Shape {
  64649. constructor(options) {
  64650. super(options);
  64651. /**
  64652. * @member {string} LevelRenderer.Shape.SmicSector.protptype.type
  64653. * @description 图形类型。
  64654. */
  64655. this.type = 'smicsector';
  64656. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64657. this.refOriginalPosition = [0, 0];
  64658. }
  64659. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  64660. }
  64661. /**
  64662. * @function LevelRenderer.Shape.SmicSector.prototype.destroy
  64663. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64664. */
  64665. destroy() {
  64666. this.type = null;
  64667. super.destroy();
  64668. }
  64669. /**
  64670. * @function LevelRenderer.Shape.SmicSector.prototype.buildPath
  64671. * @description 创建扇形路径。
  64672. *
  64673. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64674. * @param {Object} style - style。
  64675. *
  64676. */
  64677. buildPath(ctx, style) {
  64678. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64679. this.refOriginalPosition = [0, 0];
  64680. }
  64681. var __OP = this.refOriginalPosition;
  64682. var x = style.x + __OP[0]; // 圆心x
  64683. var y = style.y + __OP[1]; // 圆心y
  64684. var r0 = style.r0 || 0; // 形内半径[0,r)
  64685. var r = style.r; // 扇形外半径(0,r]
  64686. var startAngle = style.startAngle; // 起始角度[0,360)
  64687. var endAngle = style.endAngle; // 结束角度(0,360]
  64688. var clockWise = style.clockWise || false;
  64689. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  64690. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  64691. if (!clockWise) {
  64692. // 扇形默认是逆时针方向,Y轴向上
  64693. // 这个跟arc的标准不一样,为了兼容echarts
  64694. startAngle = -startAngle;
  64695. endAngle = -endAngle;
  64696. }
  64697. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  64698. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  64699. ctx.moveTo(
  64700. unitX * r0 + x,
  64701. unitY * r0 + y
  64702. );
  64703. ctx.lineTo(
  64704. unitX * r + x,
  64705. unitY * r + y
  64706. );
  64707. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  64708. ctx.lineTo(
  64709. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  64710. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  64711. );
  64712. if (r0 !== 0) {
  64713. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  64714. }
  64715. ctx.closePath();
  64716. return;
  64717. }
  64718. /**
  64719. * @function LevelRenderer.Shape.SmicSector.prototype.getRect
  64720. * @description 返回扇形包围盒矩形
  64721. *
  64722. * @param {Object} style - style
  64723. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64724. *
  64725. */
  64726. getRect(style) {
  64727. if (style.__rect) {
  64728. return style.__rect;
  64729. }
  64730. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64731. this.refOriginalPosition = [0, 0];
  64732. }
  64733. var __OP = this.refOriginalPosition;
  64734. var min0 = SUtil_SUtil.Util_vector.create();
  64735. var min1 = SUtil_SUtil.Util_vector.create();
  64736. var max0 = SUtil_SUtil.Util_vector.create();
  64737. var max1 = SUtil_SUtil.Util_vector.create();
  64738. var x = style.x + __OP[0]; // 圆心x
  64739. var y = style.y + __OP[1]; // 圆心y
  64740. var r0 = style.r0 || 0; // 形内半径[0,r)
  64741. var r = style.r; // 扇形外半径(0,r]
  64742. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  64743. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  64744. var clockWise = style.clockWise;
  64745. if (!clockWise) {
  64746. startAngle = -startAngle;
  64747. endAngle = -endAngle;
  64748. }
  64749. if (r0 > 1) {
  64750. SUtil_SUtil.Util_computeBoundingBox.arc(
  64751. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  64752. );
  64753. } else {
  64754. min0[0] = max0[0] = x;
  64755. min0[1] = max0[1] = y;
  64756. }
  64757. SUtil_SUtil.Util_computeBoundingBox.arc(
  64758. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  64759. );
  64760. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  64761. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  64762. style.__rect = {
  64763. x: min0[0],
  64764. y: min0[1],
  64765. width: max0[0] - min0[0],
  64766. height: max0[1] - min0[1]
  64767. };
  64768. return style.__rect;
  64769. }
  64770. }
  64771. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  64772. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64773. * This program are made available under the terms of the Apache License, Version 2.0
  64774. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64775. /**
  64776. * @class FeatureShapeFactory
  64777. * @aliasclass Feature.ShapeFactory
  64778. * @deprecatedclass SuperMap.Feature.ShapeFactory
  64779. * @category Visualization Theme
  64780. * @classdesc 图形工厂类。
  64781. * 目前支持创建的图形有:<br>
  64782. * 用于统计专题图:<br>
  64783. * 点 - 参数对象 <{@link ShapeParametersPoint}> <br>
  64784. * 线 - 参数对象 <{@link ShapeParametersLine}> <br>
  64785. * 面 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  64786. * 矩形 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  64787. * 扇形 - 参数对象 <{@link ShapeParametersSector}> <br>
  64788. * 标签 - 参数对象 <{@link ShapeParametersLabel}> <br>
  64789. * 图片 - 参数对象 <{@link ShapeParametersImage}> <br>
  64790. * 用于符号专题图:<br>
  64791. * 圆形 - 参数对象:<{@link ShapeParametersCircle}>
  64792. * @param {Object} [shapeParameters] - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  64793. * @usage
  64794. */
  64795. class ShapeFactory {
  64796. constructor(shapeParameters) {
  64797. /**
  64798. * @member {Object} FeatureShapeFactory.prototype.shapeParameters
  64799. * @description 图形参数对象,<{@link ShapeParameters}> 子类对象。必设参数,默认值 null。
  64800. */
  64801. this.shapeParameters = shapeParameters;
  64802. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  64803. }
  64804. /**
  64805. * @function FeatureShapeFactory.prototype.destroy
  64806. * @description 销毁图形工厂类对象。
  64807. */
  64808. destroy() {
  64809. this.shapeParameters = null;
  64810. }
  64811. /**
  64812. * @function FeatureShapeFactory.prototype.createShape
  64813. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  64814. * @param {Object} shapeParameters - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  64815. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  64816. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  64817. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  64818. */
  64819. createShape(shapeParameters) {
  64820. if (shapeParameters) {
  64821. this.shapeParameters = shapeParameters;
  64822. }
  64823. if (!this.shapeParameters) {
  64824. return null;
  64825. }
  64826. var sps = this.shapeParameters;
  64827. if (sps instanceof Point_Point) { // 点
  64828. //设置style
  64829. let style = new Object();
  64830. style["x"] = sps.x;
  64831. style["y"] = sps.y;
  64832. style["r"] = sps.r;
  64833. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  64834. //创建图形
  64835. let shape = new SmicPoint();
  64836. shape.style = ShapeFactory.transformStyle(style);
  64837. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64838. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  64839. return shape;
  64840. } else if (sps instanceof Line_Line) { // 线
  64841. //检查参数 pointList 是否存在
  64842. if (!sps.pointList) {
  64843. return null;
  64844. }
  64845. // 设置style
  64846. let style = new Object();
  64847. style["pointList"] = sps.pointList;
  64848. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  64849. // 创建图形
  64850. let shape = new SmicBrokenLine();
  64851. shape.style = ShapeFactory.transformStyle(style);
  64852. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64853. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  64854. return shape;
  64855. } else if (sps instanceof feature_Polygon_Polygon) { // 面
  64856. //检查参数 pointList 是否存在
  64857. if (!sps.pointList) {
  64858. return null;
  64859. }
  64860. //设置style
  64861. let style = new Object();
  64862. style["pointList"] = sps.pointList;
  64863. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  64864. //创建图形
  64865. let shape = new SmicPolygon();
  64866. shape.style = ShapeFactory.transformStyle(style);
  64867. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64868. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  64869. return shape;
  64870. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  64871. //检查参数 pointList 是否存在
  64872. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  64873. return null;
  64874. }
  64875. //设置style
  64876. let style = new Object();
  64877. style["x"] = sps.x;
  64878. style["y"] = sps.y;
  64879. style["width"] = sps.width;
  64880. style["height"] = sps.height;
  64881. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  64882. //创建图形
  64883. let shape = new SmicRectangle();
  64884. shape.style = ShapeFactory.transformStyle(style);
  64885. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64886. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  64887. return shape;
  64888. } else if (sps instanceof Sector) { // 扇形
  64889. //设置style
  64890. let style = new Object();
  64891. style["x"] = sps.x;
  64892. style["y"] = sps.y;
  64893. style["r"] = sps.r;
  64894. style["startAngle"] = sps.startAngle;
  64895. style["endAngle"] = sps.endAngle;
  64896. if (sps["r0"]) {
  64897. style["r0"] = sps.r0
  64898. }
  64899. if (sps["clockWise"]) {
  64900. style["clockWise"] = sps.clockWise
  64901. }
  64902. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  64903. //创建图形
  64904. let shape = new SmicSector();
  64905. shape.style = ShapeFactory.transformStyle(style);
  64906. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64907. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  64908. return shape;
  64909. } else if (sps instanceof Label) { // 标签
  64910. //设置style
  64911. let style = new Object();
  64912. style["x"] = sps.x;
  64913. style["y"] = sps.y;
  64914. style["text"] = sps.text;
  64915. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  64916. //创建图形
  64917. let shape = new SmicText();
  64918. shape.style = ShapeFactory.transformStyle(style);
  64919. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64920. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  64921. return shape;
  64922. } else if (sps instanceof Image_Image) { // 图片
  64923. //设置style
  64924. let style = new Object();
  64925. style["x"] = sps.x;
  64926. style["y"] = sps.y;
  64927. if (sps["image"]) {
  64928. style["image"] = sps.image;
  64929. }
  64930. if (sps["width"]) {
  64931. style["width"] = sps.width;
  64932. }
  64933. if (sps["height"]) {
  64934. style["height"] = sps.height;
  64935. }
  64936. if (sps["sx"]) {
  64937. style["sx"] = sps.sx;
  64938. }
  64939. if (sps["sy"]) {
  64940. style["sy"] = sps.sy;
  64941. }
  64942. if (sps["sWidth"]) {
  64943. style["sWidth"] = sps.sWidth
  64944. }
  64945. if (sps["sHeight"]) {
  64946. style["sHeight"] = sps.sHeight
  64947. }
  64948. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  64949. //创建图形
  64950. let shape = new SmicImage();
  64951. shape.style = ShapeFactory.transformStyle(style);
  64952. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64953. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  64954. return shape;
  64955. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  64956. //设置stytle
  64957. let style = new Object();
  64958. style["x"] = sps.x;
  64959. style["r"] = sps.r;
  64960. style["y"] = sps.y;
  64961. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  64962. //创建图形
  64963. let shape = new SmicCircle();
  64964. shape.style = ShapeFactory.transformStyle(style);
  64965. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  64966. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  64967. return shape;
  64968. }
  64969. return null
  64970. }
  64971. /**
  64972. * @function FeatureShapeFactory.prototype.transformStyle
  64973. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  64974. * @param {Object} style - 用户 style。
  64975. * @returns {Object} 符合 levelRenderer 的 style。
  64976. */
  64977. static transformStyle(style) {
  64978. var newStyle = {};
  64979. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  64980. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  64981. //画笔类型 ["fill", "stroke"];
  64982. var brushType = [true, false];
  64983. for (var ss in style) {
  64984. switch (ss) {
  64985. case "fill":
  64986. brushType[0] = style[ss];
  64987. break;
  64988. case "fillColor":
  64989. newStyle["color"] = style[ss];
  64990. break;
  64991. case "stroke":
  64992. brushType[1] = style[ss];
  64993. break;
  64994. case "strokeWidth":
  64995. newStyle["lineWidth"] = style[ss];
  64996. break;
  64997. case "strokeLinecap":
  64998. newStyle["lineCap"] = style[ss];
  64999. break;
  65000. case "strokeLineJoin":
  65001. newStyle["lineJoin"] = style[ss];
  65002. break;
  65003. case "strokeDashstyle":
  65004. newStyle["lineType"] = style[ss];
  65005. break;
  65006. case "pointRadius":
  65007. newStyle["r"] = style[ss];
  65008. break;
  65009. case "label":
  65010. newStyle["text"] = style[ss];
  65011. break;
  65012. case "labelRect":
  65013. newStyle["labelRect"] = style[ss];
  65014. break;
  65015. case "fontColor":
  65016. newStyle["textColor"] = style[ss];
  65017. break;
  65018. case "fontStyle":
  65019. fontStr[0] = style[ss];
  65020. break;
  65021. case "fontVariant":
  65022. fontStr[1] = style[ss];
  65023. break;
  65024. case "fontWeight":
  65025. fontStr[2] = style[ss];
  65026. break;
  65027. case "fontSize":
  65028. var unit = "";
  65029. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  65030. unit = "px";
  65031. }
  65032. fontStr[3] = style[ss] + unit;
  65033. break;
  65034. case "fontFamily":
  65035. fontStr[4] = style[ss];
  65036. break;
  65037. case "fontOpacity":
  65038. newStyle["opacity"] = style[ss];
  65039. break;
  65040. case "labelPosition":
  65041. newStyle["textPosition"] = style[ss];
  65042. break;
  65043. case "labelAlign":
  65044. newStyle["textAlign"] = style[ss];
  65045. break;
  65046. case "labelBaseline":
  65047. newStyle["textBaseline"] = style[ss];
  65048. break;
  65049. case "labelRotation":
  65050. newStyle["textRotation"] = style[ss];
  65051. break;
  65052. default:
  65053. newStyle[ss] = style[ss];
  65054. break;
  65055. }
  65056. }
  65057. //拼接字体字符串
  65058. newStyle["textFont"] = fontStr.join(" ");
  65059. //画笔类型
  65060. if (brushType[0] === true && brushType[1] === false) {
  65061. newStyle["brushType"] = "fill";
  65062. } else if (brushType[0] === false && brushType[1] === true) {
  65063. newStyle["brushType"] = "stroke";
  65064. } else if (brushType[0] === true && brushType[1] === true) {
  65065. newStyle["brushType"] = "both";
  65066. } else {
  65067. newStyle["brushType"] = "fill";
  65068. }
  65069. //默认线宽 1
  65070. if (newStyle["lineWidth"] == null) {
  65071. newStyle["lineWidth"] = 1;
  65072. }
  65073. return newStyle;
  65074. }
  65075. /**
  65076. * @function FeatureShapeFactory.prototype.Background
  65077. * @description 创建一个矩形背景框图形对象。
  65078. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  65079. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  65080. * @param {Object} setting - 图表配置参数。本函数中图形配置对象 setting 可设属性:
  65081. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<ShapeParametersRectangle#style>。
  65082. * @param {Array.<number>} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  65083. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  65084. */
  65085. static Background(shapeFactory, box, setting) {
  65086. var sets = setting ? setting : {};
  65087. // 背景框图形参数对象
  65088. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  65089. // 默认样式
  65090. bgSP.style = {
  65091. fillColor: "#f3f3f3"
  65092. };
  65093. // 设置用户 style
  65094. if (sets.backgroundStyle) {
  65095. Util_Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  65096. }
  65097. // 设置背景框圆角参数
  65098. if (sets.backgroundRadius) {
  65099. bgSP.style["radius"] = sets.backgroundRadius;
  65100. }
  65101. // 禁止背景框响应事件
  65102. bgSP.clickable = false;
  65103. bgSP.hoverable = false;
  65104. return shapeFactory.createShape(bgSP);
  65105. }
  65106. /**
  65107. * @function FeatureShapeFactory.prototype.GraphAxis
  65108. * @description 创建一个统计图表坐标轴图形对象组。
  65109. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  65110. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  65111. * @param {Object} setting - 图表配置参数。
  65112. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  65113. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  65114. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  65115. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  65116. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  65117. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  65118. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  65119. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  65120. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  65121. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  65122. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  65123. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  65124. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  65125. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  65126. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  65127. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  65128. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  65129. */
  65130. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  65131. var dvb = dataViewBox;
  65132. var sets = setting ? setting : {};
  65133. // 参考线图形对象组
  65134. var refLines = [];
  65135. //坐标轴箭头对象组
  65136. var arrows = [];
  65137. // 是否使用参水平考线,默认不使用
  65138. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  65139. // y 轴上的刻度
  65140. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  65141. // 坐标轴节点数组
  65142. var pois = [];
  65143. //z 轴箭头数组
  65144. var zArrowPois = [];
  65145. // x,y 轴主干节点数组
  65146. var xMainPois = [];
  65147. if (axisytick == 0) {
  65148. xMainPois.push([dvb[0], dvb[3] - 5]);
  65149. xMainPois.push([dvb[0], dvb[1]]);
  65150. // 3D 坐标轴 第三象限平分线
  65151. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  65152. let axis3DParameter = parseInt(sets.axis3DParameter);
  65153. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  65154. // 添加 3D 轴节点
  65155. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  65156. //箭头坐标
  65157. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  65158. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  65159. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  65160. //3D轴
  65161. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65162. } else {
  65163. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65164. }
  65165. xMainPois.push([dvb[0], dvb[1]]);
  65166. }
  65167. xMainPois.push([dvb[2] + 5, dvb[1]]);
  65168. } else {
  65169. // 单位刻度长度
  65170. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  65171. // 刻度 y 坐标
  65172. var thckY = dvb[3];
  65173. xMainPois.push([dvb[0], thckY - 5]);
  65174. for (var i = 0; i < axisytick; i++) {
  65175. xMainPois.push([dvb[0], thckY]);
  65176. xMainPois.push([dvb[0] - 5, thckY]);
  65177. xMainPois.push([dvb[0], thckY]);
  65178. // 参考线
  65179. if (isAddRefLine) {
  65180. // 参考线参数对象
  65181. var refLineSP = new Line_Line([
  65182. [dvb[0], thckY],
  65183. [dvb[2], thckY]
  65184. ]);
  65185. // 参考线默认样式对象
  65186. refLineSP.style = {
  65187. strokeColor: "#cfcfcf",
  65188. strokeLinecap: "butt",
  65189. strokeLineJoin: "round",
  65190. strokeWidth: 1
  65191. };
  65192. // 禁止事件
  65193. refLineSP.clickable = false;
  65194. refLineSP.hoverable = false;
  65195. // 用户style
  65196. if (sets.xReferenceLineStyle) {
  65197. Util_Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  65198. }
  65199. // 生成参考线图形对象
  65200. refLines.push(shapeFactory.createShape(refLineSP))
  65201. }
  65202. // y 刻度增量
  65203. thckY += unitTick;
  65204. }
  65205. xMainPois.push([dvb[0], dvb[1]]);
  65206. // 3D 坐标轴 第三象限平分线
  65207. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  65208. let axis3DParameter = parseInt(sets.axis3DParameter);
  65209. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  65210. /*
  65211. // 箭头计算过程
  65212. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  65213. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  65214. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  65215. if(sets.axisUseArrow){
  65216. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65217. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  65218. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65219. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  65220. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65221. }
  65222. else{
  65223. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65224. }
  65225. */
  65226. // 添加 3D 轴节点
  65227. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  65228. //箭头坐标
  65229. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  65230. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  65231. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  65232. //3D轴
  65233. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65234. } else {
  65235. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  65236. }
  65237. xMainPois.push([dvb[0], dvb[1]]);
  65238. }
  65239. xMainPois.push([dvb[2] + 5, dvb[1]]);
  65240. }
  65241. // 坐标轴箭头
  65242. if (sets.axisUseArrow) {
  65243. // x 轴箭头节点数组
  65244. var xArrowPois = [
  65245. [dvb[2] + 5, dvb[1] + 4],
  65246. [dvb[2] + 13, dvb[1]],
  65247. [dvb[2] + 5, dvb[1] - 4]
  65248. ];
  65249. // y 轴箭头节点数组
  65250. var yArrowPois = [
  65251. [dvb[0] - 4, dvb[3] - 5],
  65252. [dvb[0], dvb[3] - 13],
  65253. [dvb[0] + 4, dvb[3] - 5]
  65254. ];
  65255. //x轴箭头
  65256. var xSP = new feature_Polygon_Polygon(xArrowPois);
  65257. xSP.style = {fillColor: "#008acd"};
  65258. Util_Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  65259. arrows.push(shapeFactory.createShape(xSP));
  65260. //y轴箭头
  65261. var ySP = new feature_Polygon_Polygon(yArrowPois);
  65262. ySP.style = {fillColor: "#008acd"};
  65263. Util_Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  65264. arrows.push(shapeFactory.createShape(ySP));
  65265. // z轴箭头 坐标轴箭头是否要使用
  65266. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  65267. var zSP = new feature_Polygon_Polygon(zArrowPois);
  65268. zSP.style = {fillColor: "#008acd"};
  65269. Util_Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  65270. arrows.push(shapeFactory.createShape(zSP));
  65271. }
  65272. }
  65273. //不带箭头的坐标轴
  65274. pois = xMainPois;
  65275. // 坐标轴参数对象
  65276. var axisSP = new Line_Line(pois);
  65277. // 坐标轴默认style
  65278. axisSP.style = {
  65279. strokeLinecap: "butt",
  65280. strokeLineJoin: "round",
  65281. strokeColor: "#008acd",
  65282. strokeWidth: 1
  65283. };
  65284. // 用户 style
  65285. if (sets.axisStyle) {
  65286. Util_Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  65287. }
  65288. // 禁止事件
  65289. axisSP.clickable = false;
  65290. axisSP.hoverable = false;
  65291. // 创建坐标轴图形对象
  65292. var axisMain = [shapeFactory.createShape(axisSP)];
  65293. // Y 轴标签
  65294. var yLabels = [];
  65295. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  65296. var axisYLabels = sets.axisYLabels;
  65297. let len = axisYLabels.length;
  65298. // 标签偏移量
  65299. var ylOffset = [0, 0];
  65300. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  65301. ylOffset = sets.axisYLabelsOffset;
  65302. }
  65303. if (len == 1) {
  65304. // 标签参数对象
  65305. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  65306. labelYSP.style = {
  65307. labelAlign: "right"
  65308. };
  65309. // 用户 style
  65310. if (sets.axisYLabelsStyle) {
  65311. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  65312. }
  65313. // 禁止事件
  65314. labelYSP.clickable = false;
  65315. labelYSP.hoverable = false;
  65316. // 制作标签
  65317. yLabels.push(shapeFactory.createShape(labelYSP));
  65318. } else {
  65319. var labelY = dvb[3];
  65320. // y 轴标签单位距离
  65321. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  65322. for (var j = 0; j < len; j++) {
  65323. // 标签参数对象
  65324. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  65325. labelYSP.style = {
  65326. labelAlign: "right"
  65327. };
  65328. // 用户 style
  65329. if (sets.axisYLabelsStyle) {
  65330. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  65331. }
  65332. // 禁止事件
  65333. labelYSP.clickable = false;
  65334. labelYSP.hoverable = false;
  65335. // 制作标签
  65336. yLabels.push(shapeFactory.createShape(labelYSP));
  65337. // y 轴标签 y 方向增量
  65338. labelY += yUnit;
  65339. }
  65340. }
  65341. }
  65342. // X 轴标签
  65343. var xLabels = [];
  65344. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  65345. let axisXLabels = sets.axisXLabels;
  65346. let len = axisXLabels.length;
  65347. // 标签偏移量
  65348. let xlOffset = [0, 0];
  65349. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  65350. xlOffset = sets.axisXLabelsOffset;
  65351. }
  65352. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  65353. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  65354. let xsCenter = xShapeInfo.xPositions;
  65355. for (let K = 0; K < len; K++) {
  65356. // 标签参数对象
  65357. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  65358. // 默认 style
  65359. labelXSP.style = {
  65360. labelAlign: "center",
  65361. labelBaseline: "top"
  65362. };
  65363. // 用户 style
  65364. if (sets.axisXLabelsStyle) {
  65365. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  65366. }
  65367. // 禁止事件
  65368. labelXSP.clickable = false;
  65369. labelXSP.hoverable = false;
  65370. // 创建标签对象
  65371. xLabels.push(shapeFactory.createShape(labelXSP));
  65372. }
  65373. } else {
  65374. if (len == 1) {
  65375. // 标签参数对象
  65376. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  65377. // 默认 style
  65378. labelXSP.style = {
  65379. labelAlign: "center",
  65380. labelBaseline: "top"
  65381. };
  65382. // 用户 style
  65383. if (sets.axisXLabelsStyle) {
  65384. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  65385. }
  65386. // 禁止事件
  65387. labelXSP.clickable = false;
  65388. labelXSP.hoverable = false;
  65389. // 创建标签对象
  65390. xLabels.push(shapeFactory.createShape(labelXSP));
  65391. } else {
  65392. let labelX = dvb[0];
  65393. // x 轴标签单位距离
  65394. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  65395. for (let m = 0; m < len; m++) {
  65396. // 标签参数对象
  65397. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  65398. // 默认 style
  65399. labelXSP.style = {
  65400. labelAlign: "center",
  65401. labelBaseline: "top"
  65402. };
  65403. // 用户 style
  65404. if (sets.axisXLabelsStyle) {
  65405. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  65406. }
  65407. // 禁止事件
  65408. labelXSP.clickable = false;
  65409. labelXSP.hoverable = false;
  65410. // 创建标签对象
  65411. xLabels.push(shapeFactory.createShape(labelXSP));
  65412. // x 轴标签 x 方向增量
  65413. labelX += xUnit;
  65414. }
  65415. }
  65416. }
  65417. }
  65418. // 组装并返回构成坐标轴的图形
  65419. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  65420. }
  65421. /**
  65422. * @function FeatureShapeFactory.prototype.ShapeStyleTool
  65423. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  65424. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。
  65425. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  65426. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  65427. * 其可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  65428. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  65429. * (start code)
  65430. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  65431. * // start: 值域值下限(包含);
  65432. * // end: 值域值上限(不包含);
  65433. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <ShapeParameters> 子类对象的 style 属性。
  65434. * // dataStyleByCodomain 数组形如:
  65435. * [
  65436. * {
  65437. * start:0,
  65438. * end:250,
  65439. * style:{
  65440. * fillColor:"#00CD00"
  65441. * }
  65442. * },
  65443. * {
  65444. * start:250,
  65445. * end:500,
  65446. * style:{
  65447. * fillColor:"#00EE00"
  65448. * }
  65449. * },
  65450. * {
  65451. * start:500,
  65452. * end:750,
  65453. * style:{
  65454. * fillColor:"#00FF7F"
  65455. * }
  65456. * },
  65457. * {
  65458. * start:750,
  65459. * end:1500,
  65460. * style:{
  65461. * fillColor:"#00FF00"
  65462. * }
  65463. * }
  65464. * ]
  65465. * (end)
  65466. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  65467. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  65468. * @returns {Object} 合并后的样式 (style) 对象。
  65469. */
  65470. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  65471. // 用 defaultStyle 初始化 style 对象
  65472. var finalStyle = defaultStyle ? defaultStyle : {};
  65473. // 基础 style
  65474. if (style) {
  65475. Util_Util.copyAttributesWithClip(finalStyle, style);
  65476. }
  65477. // 按索引赋 style
  65478. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  65479. if (styleGroup[index]) {
  65480. Util_Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  65481. }
  65482. }
  65483. // 按值域赋 style
  65484. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  65485. var dsc = styleByCodomain;
  65486. var dscLen = dsc.length;
  65487. var v = parseFloat(value);
  65488. for (var i = 0; i < dscLen; i++) {
  65489. if (dsc[i].start <= v && v < dsc[i].end) {
  65490. Util_Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  65491. break;
  65492. }
  65493. }
  65494. }
  65495. return finalStyle;
  65496. }
  65497. }
  65498. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  65499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65500. * This program are made available under the terms of the Apache License, Version 2.0
  65501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65502. /**
  65503. * @class FeatureTheme
  65504. * @aliasclass Feature.Theme
  65505. * @deprecatedclass SuperMap.Feature.Theme
  65506. * @category Visualization Theme
  65507. * @classdesc 专题要素基类。
  65508. * @param {Object} data - 用户数据,用于生成可视化 shape。
  65509. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  65510. * @usage
  65511. */
  65512. class Theme_Theme {
  65513. constructor(data, layer) {
  65514. if (!data) {
  65515. return;
  65516. }
  65517. // layer 必须已经添加到地图, 且已初始化渲染器
  65518. if (!layer || !layer.map || !layer.renderer) {
  65519. return;
  65520. }
  65521. /**
  65522. * @member {string} FeatureTheme.prototype.id
  65523. * @description 专题要素唯一标识。
  65524. */
  65525. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  65526. /**
  65527. * @member {LonLat} FeatureTheme.prototype.lonlat
  65528. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  65529. */
  65530. this.lonlat = null;
  65531. /**
  65532. * @member {Array.<number>} FeatureTheme.prototype.location
  65533. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65534. */
  65535. this.location = [];
  65536. /**
  65537. * @readonly
  65538. * @member {Object} FeatureTheme.prototype.data
  65539. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<{@link FeatureVector}>。
  65540. */
  65541. this.data = data;
  65542. /**
  65543. * @readonly
  65544. * @member {Array.<Object>} FeatureTheme.prototype.shapes
  65545. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  65546. */
  65547. this.shapes = [];
  65548. /**
  65549. * @readonly
  65550. * @member {SuperMap.Layer.Theme} FeatureTheme.prototype.layer
  65551. * @description 此专题要素所在专题图层。
  65552. */
  65553. this.layer = layer;
  65554. this.CLASS_NAME = "SuperMap.Feature.Theme";
  65555. }
  65556. /**
  65557. * @function FeatureTheme.prototype.destroy
  65558. * @description 销毁专题要素。
  65559. */
  65560. destroy() {
  65561. this.data = null;
  65562. this.id = null;
  65563. this.lonlat = null;
  65564. this.location = null;
  65565. this.shapes = null;
  65566. this.layer = null;
  65567. }
  65568. /**
  65569. * @function FeatureTheme.prototype.getLocalXY
  65570. * @description 地理坐标转为像素坐标。
  65571. * @param {GeometryPoint|GeometryGeoText|LonLat} coordinate - 地理坐标点。
  65572. * @returns {Array.<number>} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65573. */
  65574. getLocalXY(coordinate) {
  65575. var resolution = this.layer.map.getResolution();
  65576. var extent = this.layer.map.getExtent();
  65577. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  65578. let x = (coordinate.x / resolution + (-extent.left / resolution));
  65579. let y = ((extent.top / resolution) - coordinate.y / resolution);
  65580. return [x, y];
  65581. } else if (coordinate instanceof LonLat) {
  65582. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  65583. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  65584. return [x, y];
  65585. } else {
  65586. return null;
  65587. }
  65588. }
  65589. }
  65590. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  65591. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65592. * This program are made available under the terms of the Apache License, Version 2.0
  65593. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65594. /**
  65595. * @class FeatureThemeGraph
  65596. * @aliasclass Feature.Theme.Graph
  65597. * @deprecatedclass SuperMap.Feature.Theme.Graph
  65598. * @category Visualization Theme
  65599. * @classdesc 统计专题要素基类。
  65600. * 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  65601. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeGraph.setting> 的基础属性只有 7 个,
  65602. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  65603. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  65604. * @extends FeatureTheme
  65605. * @param {FeatureVector} data - 用户数据。
  65606. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  65607. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  65608. * @param {Object} setting - 图表配置对象。
  65609. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  65610. * @usage
  65611. */
  65612. class Graph extends Theme_Theme {
  65613. constructor(data, layer, fields, setting, lonlat, options) {
  65614. super(data, layer, fields, setting, lonlat, options);
  65615. /**
  65616. * @member {FeatureShapeFactory} FeatureThemeGraph.prototype.shapeFactory
  65617. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  65618. */
  65619. this.shapeFactory = new ShapeFactory();
  65620. /**
  65621. * @member {Object} FeatureThemeGraph.prototype.shapeParameters
  65622. * @description 当前图形参数对象,<{@link ShapeParameters}> 的子类对象。
  65623. */
  65624. this.shapeParameters = null;
  65625. /**
  65626. * @member {boolean} [FeatureThemeGraph.prototype.RelativeCoordinate]
  65627. * @description 图形是否已经计算了相对坐标。
  65628. */
  65629. this.RelativeCoordinate = false;
  65630. /**
  65631. * @member {Object} FeatureThemeGraph.prototype.setting
  65632. * @description 图表配置对象,该对象控制着图表的可视化显示。
  65633. * @param {number} width - 专题要素(图表)宽度。
  65634. * @param {number} height - 专题要素(图表)高度。
  65635. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  65636. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  65637. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  65638. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  65639. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  65640. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  65641. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  65642. *
  65643. */
  65644. this.setting = null;
  65645. /**
  65646. * @readonly
  65647. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPoint
  65648. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65649. */
  65650. this.origonPoint = null;
  65651. /**
  65652. * @readonly
  65653. * @member {Array.<number>} FeatureThemeGraph.prototype.chartBox
  65654. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  65655. * 下端 y坐标值、右端 x坐标值、上端 y 坐标值;[left, bottom, right, top]。
  65656. */
  65657. this.chartBox = null;
  65658. /**
  65659. * @readonly
  65660. * @member {Bounds} FeatureThemeGraph.prototype.chartBounds
  65661. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  65662. */
  65663. this.chartBounds = null;
  65664. /**
  65665. * @readonly
  65666. * @member {number} FeatureThemeGraph.prototype.width
  65667. * @description 专题要素(图表)宽度 。
  65668. */
  65669. this.width = null;
  65670. /**
  65671. * @readonly
  65672. * @member {number} FeatureThemeGraph.prototype.height
  65673. * @description 专题要素(图表)高度 。
  65674. */
  65675. this.height = null;
  65676. /**
  65677. * @readonly
  65678. * @member {number} FeatureThemeGraph.prototype.XOffset
  65679. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  65680. */
  65681. this.XOffset = 0;
  65682. /**
  65683. * @readonly
  65684. * @member {number} FeatureThemeGraph.prototype.YOffset
  65685. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  65686. */
  65687. this.YOffset = 0;
  65688. /**
  65689. * @readonly
  65690. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBParameter
  65691. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  65692. * 此属性用于指定数据视图框 dataViewBox 的范围。
  65693. */
  65694. this.DVBParameter = null;
  65695. /**
  65696. * @readonly
  65697. * @member {Array.<number>} FeatureThemeGraph.prototype.dataViewBox
  65698. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  65699. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  65700. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  65701. */
  65702. this.dataViewBox = null;
  65703. /**
  65704. * @readonly
  65705. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCodomain
  65706. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  65707. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  65708. */
  65709. this.DVBCodomain = null;
  65710. /**
  65711. * @readonly
  65712. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCenterPoint
  65713. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65714. */
  65715. this.DVBCenterPoint = null;
  65716. /**
  65717. * @readonly
  65718. * @member {string} FeatureThemeGraph.prototype.DVBUnitValue
  65719. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  65720. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  65721. */
  65722. this.DVBUnitValue = null;
  65723. /**
  65724. * @readonly
  65725. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBOrigonPoint
  65726. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65727. */
  65728. this.DVBOrigonPoint = null;
  65729. /**
  65730. * @readonly
  65731. * @member {number} FeatureThemeGraph.prototype.DVBWidth
  65732. * @description 数据视图框宽度。
  65733. */
  65734. this.DVBWidth = null;
  65735. /**
  65736. * @readonly
  65737. * @member {number} FeatureThemeGraph.prototype.DVBHeight
  65738. * @description 数据视图框高度。
  65739. */
  65740. this.DVBHeight = null;
  65741. /**
  65742. * @readonly
  65743. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPointOffset
  65744. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  65745. */
  65746. this.origonPointOffset = null;
  65747. /**
  65748. * @readonly
  65749. * @member {Array.<string>} FeatureThemeGraph.prototype.fields
  65750. * @description 数据{FeatureVector}属性字段。
  65751. */
  65752. this.fields = fields || [];
  65753. /**
  65754. * @readonly
  65755. * @member {Array.<number>} FeatureThemeGraph.prototype.dataValues
  65756. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  65757. */
  65758. this.dataValues = null;
  65759. // 图表位置
  65760. if (lonlat) {
  65761. this.lonlat = lonlat;
  65762. } else {
  65763. // 默认使用 bounds 中心
  65764. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  65765. }
  65766. // 配置项检测与赋值
  65767. if (setting && setting.width && setting.height && setting.codomain) {
  65768. this.setting = setting;
  65769. }
  65770. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  65771. }
  65772. /**
  65773. * @function FeatureThemeGraph.prototype.destroy
  65774. * @description 销毁专题要素。
  65775. */
  65776. destroy() {
  65777. this.shapeFactory = null;
  65778. this.shapeParameters = null;
  65779. this.width = null;
  65780. this.height = null;
  65781. this.origonPoint = null;
  65782. this.chartBox = null;
  65783. this.dataViewBox = null;
  65784. this.chartBounds = null;
  65785. this.DVBParameter = null;
  65786. this.DVBOrigonPoint = null;
  65787. this.DVBCenterPoint = null;
  65788. this.DVBWidth = null;
  65789. this.DVBHeight = null;
  65790. this.DVBCodomain = null;
  65791. this.DVBUnitValue = null;
  65792. this.origonPointOffset = null;
  65793. this.XOffset = null;
  65794. this.YOffset = null;
  65795. this.fields = null;
  65796. this.dataValues = null;
  65797. this.setting = null;
  65798. super.destroy();
  65799. }
  65800. /**
  65801. * @function FeatureThemeGraph.prototype.initBaseParameter
  65802. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  65803. * 调用此函数关系到 setting 对象的以下属性。
  65804. * @param {number} width - 专题要素(图表)宽度。
  65805. * @param {number} height - 专题要素(图表)高度。
  65806. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  65807. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  65808. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  65809. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  65810. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  65811. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  65812. * @returns {boolean} 初始化参数是否成功。
  65813. */
  65814. initBaseParameter() {
  65815. // 参数初始化是否成功
  65816. var isSuccess = true;
  65817. // setting 属性是否已成功赋值
  65818. if (!this.setting) {
  65819. return false;
  65820. }
  65821. var sets = this.setting;
  65822. // 检测 setting 的必设参数
  65823. if (!(sets.width && sets.height && sets.codomain)) {
  65824. return false;
  65825. }
  65826. // 数据
  65827. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  65828. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  65829. this.dataValues = dataEffective ? dataEffective : [];
  65830. // 基础参数 width, height, codomain
  65831. this.width = parseFloat(sets.width);
  65832. this.height = parseFloat(sets.height);
  65833. this.DVBCodomain = sets.codomain;
  65834. // 图表偏移
  65835. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  65836. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  65837. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  65838. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  65839. // 其他默认值
  65840. this.origonPoint = [];
  65841. this.chartBox = [];
  65842. this.dataViewBox = [];
  65843. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  65844. this.DVBOrigonPoint = [];
  65845. this.DVBCenterPoint = [];
  65846. this.origonPointOffset = [];
  65847. // 图表位置
  65848. this.resetLocation();
  65849. // 专题要素宽度 w
  65850. var w = this.width;
  65851. // 专题要素高度 h
  65852. var h = this.height;
  65853. // 专题要素像素位置 loc
  65854. var loc = this.location;
  65855. // 专题要素像素位置 loc
  65856. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  65857. // 专题要素原点(左上角)
  65858. var op = this.origonPoint;
  65859. // 图表框([left, bottom, right, top])
  65860. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  65861. // 图表框
  65862. var cb = this.chartBox;
  65863. // 数据视图框参数,它是图表框各方向对应的内偏距
  65864. var dbbP = this.DVBParameter;
  65865. // 数据视图框 ([left, bottom, right, top])
  65866. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  65867. // 数据视图框
  65868. var dvb = this.dataViewBox;
  65869. //检查数据视图框是否合法
  65870. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  65871. return false;
  65872. }
  65873. // 数据视图框原点
  65874. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  65875. // 数据视图框宽度
  65876. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  65877. // 数据视图框高度
  65878. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  65879. // 数据视图框中心点
  65880. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  65881. // 数据视图框原点与图表框的原点偏移量
  65882. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  65883. return isSuccess;
  65884. }
  65885. /**
  65886. * @function FeatureThemeGraph.prototype.resetLocation
  65887. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  65888. * @param {LonLat} lonlat - 专题要素新的像素中心位置。
  65889. * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65890. */
  65891. resetLocation(lonlat) {
  65892. if (lonlat) {
  65893. this.lonlat = lonlat;
  65894. }
  65895. // 获取地理位置对应的像素坐标 newLocalLX
  65896. var newLocalLX = this.getLocalXY(this.lonlat);
  65897. // 处理偏移量 XOffset, YOffset
  65898. newLocalLX[0] += this.XOffset;
  65899. newLocalLX[1] += this.YOffset;
  65900. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  65901. this.location = newLocalLX;
  65902. // 更新图表像素 Bounds
  65903. var w = this.width;
  65904. var h = this.height;
  65905. var loc = this.location;
  65906. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  65907. //重新计算当前渐变色
  65908. this.resetLinearGradient();
  65909. return loc;
  65910. }
  65911. /**
  65912. * @function FeatureThemeGraph.prototype.resetLinearGradient
  65913. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  65914. */
  65915. resetLinearGradient() {
  65916. //子类实现此方法
  65917. }
  65918. /**
  65919. * @function FeatureThemeGraph.prototype.shapesConvertToRelativeCoordinate
  65920. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  65921. */
  65922. shapesConvertToRelativeCoordinate() {
  65923. var shapes = this.shapes;
  65924. var shapeROP = this.location;
  65925. for (var i = 0, len = shapes.length; i < len; i++) {
  65926. shapes[i].refOriginalPosition = shapeROP;
  65927. var style = shapes[i].style;
  65928. for (var sty in style) {
  65929. switch (sty) {
  65930. case "pointList":
  65931. var pl = style[sty];
  65932. for (var j = 0, len2 = pl.length; j < len2; j++) {
  65933. pl[j][0] -= shapeROP[0];
  65934. pl[j][1] -= shapeROP[1];
  65935. }
  65936. break;
  65937. case "x":
  65938. style[sty] -= shapeROP[0];
  65939. break;
  65940. case "y":
  65941. style[sty] -= shapeROP[1];
  65942. break;
  65943. default:
  65944. break;
  65945. }
  65946. }
  65947. }
  65948. this.RelativeCoordinate = true;
  65949. }
  65950. /**
  65951. * @function FeatureThemeGraph.prototype.assembleShapes
  65952. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  65953. * 重写此方法的步骤:<br>
  65954. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  65955. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  65956. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  65957. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  65958. * @example
  65959. * //子类实现 assembleShapes() 接口的步骤示例:
  65960. * assembleShapes: function(){
  65961. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  65962. *
  65963. * // 图表配置对象
  65964. * var sets = this.setting;
  65965. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  65966. * if(!sets.dataViewBoxParameter){
  65967. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  65968. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  65969. * }
  65970. * else{
  65971. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  65972. * }
  65973. * }
  65974. *
  65975. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  65976. * if(!this.initBaseParameter()) return;
  65977. *
  65978. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  65979. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  65980. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  65981. * var uv = this.DVBUnitValue;
  65982. *
  65983. * // 图形参数计算代码......
  65984. *
  65985. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  65986. * var barParams = new ShapeParametersPolygon(poiLists);
  65987. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  65988. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  65989. * // 图形携带数据ID信息
  65990. * barParams.refDataID = this.data.id;
  65991. * // 创建图形并添加到图表图形数组中
  65992. * this.shapes.push(this.shapeFactory.createShape(barParams));
  65993. *
  65994. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  65995. * this.shapesConvertToRelativeCoordinate();
  65996. * },
  65997. */
  65998. assembleShapes() {
  65999. //子类必须实现此方法
  66000. }
  66001. /**
  66002. * @function FeatureThemeGraph.prototype.getLocalXY
  66003. * @description 地理坐标转为像素坐标。
  66004. * @param {LonLat} lonlat - 带转换的地理坐标。
  66005. * @returns 屏幕像素坐标。
  66006. */
  66007. getLocalXY(lonlat) {
  66008. return this.layer.getLocalXY(lonlat);
  66009. }
  66010. }
  66011. /**
  66012. * @function FeatureTheme.getDataValues
  66013. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  66014. * @param {FeatureVector} data - 数据。
  66015. * @param {Array.<string>} [fields] - 字段名数组。
  66016. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  66017. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  66018. */
  66019. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  66020. if (!data.attributes) {
  66021. return false;
  66022. }
  66023. var fieldsValue = [];
  66024. var attrs = data.attributes;
  66025. for (var i = 0; i < fields.length; i++) {
  66026. for (var field in attrs) {
  66027. if (field !== fields[i]) {
  66028. continue
  66029. }
  66030. // 数字转换判断
  66031. try {
  66032. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  66033. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  66034. } else {
  66035. fieldsValue.push(parseFloat(attrs[field].toString()));
  66036. }
  66037. } catch (e) {
  66038. throw new Error("not a number")
  66039. }
  66040. }
  66041. }
  66042. if (fieldsValue.length === fields.length) {
  66043. return fieldsValue;
  66044. } else {
  66045. return false;
  66046. }
  66047. };
  66048. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  66049. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66050. * This program are made available under the terms of the Apache License, Version 2.0
  66051. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66052. /**
  66053. * @class FeatureThemeBar
  66054. * @aliasclass Feature.Theme.Bar
  66055. * @deprecatedclass SuperMap.Feature.Theme.Bar
  66056. * @classdesc 柱状图 。
  66057. * @category Visualization Theme
  66058. * @example
  66059. * // barStyleByCodomain参数用法如下:
  66060. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66061. * // start: 值域值下限(包含);
  66062. * // end: 值域值上限(不包含);
  66063. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  66064. * // barStyleByCodomain 数组形如:
  66065. * [
  66066. * {
  66067. * start:0,
  66068. * end:250,
  66069. * style:{
  66070. * fillColor:"#00CD00"
  66071. * }
  66072. * },
  66073. * {
  66074. * start:250,
  66075. * end:500,
  66076. * style:{
  66077. * fillColor:"#00EE00"
  66078. * }
  66079. * },
  66080. * {
  66081. * start:500,
  66082. * end:750,
  66083. * style:{
  66084. * fillColor:"#00FF7F"
  66085. * }
  66086. * },
  66087. * {
  66088. * start:750,
  66089. * end:1500,
  66090. * style:{
  66091. * fillColor:"#00FF00"
  66092. * }
  66093. * }
  66094. * ]
  66095. * @extends FeatureThemeGraph
  66096. * @param {FeatureVector} data - 用户数据。
  66097. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  66098. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  66099. * @param {FeatureThemeBar.setting} setting - 图表配置对象。
  66100. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  66101. * @usage
  66102. * @private
  66103. */
  66104. class Bar extends Graph {
  66105. constructor(data, layer, fields, setting, lonlat) {
  66106. super(data, layer, fields, setting, lonlat);
  66107. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  66108. }
  66109. /**
  66110. * @function FeatureThemeBar.prototype.destroy
  66111. * @override
  66112. */
  66113. destroy() {
  66114. super.destroy();
  66115. }
  66116. /**
  66117. * @function FeatureThemeBar.prototype.assembleShapes
  66118. * @description 图表图形装配函数。
  66119. */
  66120. assembleShapes() {
  66121. //默认渐变颜色数组
  66122. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  66123. //默认阴影
  66124. var deafaultShawdow = {
  66125. showShadow: true,
  66126. shadowBlur: 8,
  66127. shadowColor: "rgba(100,100,100,0.8)",
  66128. shadowOffsetX: 2,
  66129. shadowOffsetY: 2
  66130. };
  66131. // 图表配置对象
  66132. var sets = this.setting;
  66133. if (!sets.barLinearGradient) {
  66134. sets.barLinearGradient = deafaultColors;
  66135. }
  66136. // 默认数据视图框
  66137. if (!sets.dataViewBoxParameter) {
  66138. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  66139. sets.dataViewBoxParameter = [45, 15, 15, 15];
  66140. } else {
  66141. sets.dataViewBoxParameter = [5, 5, 5, 5];
  66142. }
  66143. }
  66144. // 重要步骤:初始化参数
  66145. if (!this.initBaseParameter()) {
  66146. return;
  66147. }
  66148. // 值域
  66149. var codomain = this.DVBCodomain;
  66150. // 重要步骤:定义图表 BaFeatureThemeBarr 数据视图框中单位值的含义
  66151. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  66152. // 数据视图域
  66153. var dvb = this.dataViewBox;
  66154. // 用户数据值
  66155. var fv = this.dataValues;
  66156. if (fv.length < 1) {
  66157. return;
  66158. } // 没有数据
  66159. // 数据溢出值域范围处理
  66160. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  66161. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  66162. return;
  66163. }
  66164. }
  66165. // 获取 x 轴上的图形信息
  66166. var xShapeInfo = this.calculateXShapeInfo();
  66167. if (!xShapeInfo) {
  66168. return;
  66169. }
  66170. // 每个柱条 x 位置
  66171. var xsLoc = xShapeInfo.xPositions;
  66172. // 柱条宽度
  66173. var xsWdith = xShapeInfo.width;
  66174. // 背景框,默认启用
  66175. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  66176. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  66177. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  66178. }
  66179. // 坐标轴, 默认启用
  66180. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  66181. // 添加坐标轴图形数组
  66182. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  66183. }
  66184. for (var i = 0; i < fv.length; i++) {
  66185. // 计算柱条 top 边的 y 轴坐标值
  66186. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  66187. // 柱条节点数组
  66188. var poiLists = [
  66189. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  66190. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  66191. [xsLoc[i] + xsWdith / 2, yPx],
  66192. [xsLoc[i] - xsWdith / 2, yPx]
  66193. ];
  66194. // 柱条参数对象(一个面参数对象)
  66195. var barParams = new feature_Polygon_Polygon(poiLists);
  66196. // 柱条 阴影 style
  66197. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  66198. if (sets.barShadowStyle) {
  66199. var sss = sets.barShadowStyle;
  66200. if (sss.shadowBlur) {
  66201. deafaultShawdow.shadowBlur = sss.shadowBlur;
  66202. }
  66203. if (sss.shadowColor) {
  66204. deafaultShawdow.shadowColor = sss.shadowColor;
  66205. }
  66206. if (sss.shadowOffsetX) {
  66207. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  66208. }
  66209. if (sss.shadowOffsetY) {
  66210. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  66211. }
  66212. }
  66213. barParams.style = {};
  66214. Util_Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  66215. }
  66216. // 图形携带的数据信息
  66217. barParams.refDataID = this.data.id;
  66218. barParams.dataInfo = {
  66219. field: this.fields[i],
  66220. value: fv[i]
  66221. };
  66222. // 柱条 hover click
  66223. if (typeof(sets.barHoverAble) !== "undefined") {
  66224. barParams.hoverable = sets.barHoverAble;
  66225. }
  66226. if (typeof(sets.barClickAble) !== "undefined") {
  66227. barParams.clickable = sets.barClickAble;
  66228. }
  66229. // 创建柱条并添加到图表图形数组中
  66230. this.shapes.push(this.shapeFactory.createShape(barParams));
  66231. }
  66232. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  66233. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  66234. this.shapesConvertToRelativeCoordinate();
  66235. }
  66236. /**
  66237. * @function FeatureThemeBar.prototype.calculateXShapeInfo
  66238. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  66239. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  66240. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  66241. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  66242. * 本函数中图形配置对象 setting 可设属性:
  66243. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  66244. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  66245. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  66246. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  66247. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  66248. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  66249. *
  66250. */
  66251. calculateXShapeInfo() {
  66252. var dvb = this.dataViewBox; // 数据视图框
  66253. var sets = this.setting; // 图表配置对象
  66254. var fvc = this.dataValues.length; // 数组值个数
  66255. if (fvc < 1) {
  66256. return null;
  66257. }
  66258. var xBlank; // x 轴空白间隔参数
  66259. var xShapePositions = []; // x 轴上图形的位置
  66260. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  66261. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  66262. // x 轴空白间隔参数处理
  66263. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  66264. xBlank = sets.xShapeBlank;
  66265. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  66266. if (xsLen <= fvc) {
  66267. return null;
  66268. }
  66269. xShapeWidth = xsLen / fvc
  66270. } else {
  66271. // 默认使用等距离空白间隔,空白间隔为图形宽度
  66272. xShapeWidth = dvbWidth / (2 * fvc + 1);
  66273. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  66274. }
  66275. // 图形 x 轴上的位置计算
  66276. var xOffset = 0
  66277. for (var i = 0; i < fvc; i++) {
  66278. if (i == 0) {
  66279. xOffset = xBlank[0] + xShapeWidth / 2;
  66280. } else {
  66281. xOffset += (xShapeWidth + xBlank[1]);
  66282. }
  66283. xShapePositions.push(dvb[0] + xOffset);
  66284. }
  66285. return {
  66286. "xPositions": xShapePositions,
  66287. "width": xShapeWidth
  66288. };
  66289. }
  66290. /**
  66291. * @function FeatureThemeBar.prototype.resetLinearGradient
  66292. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  66293. */
  66294. resetLinearGradient() {
  66295. if (this.RelativeCoordinate) {
  66296. var shpelength = this.shapes.length;
  66297. var barLinearGradient = this.setting.barLinearGradient;
  66298. var index = -1;
  66299. for (var i = 0; i < shpelength; i++) {
  66300. var shape = this.shapes[i];
  66301. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  66302. var style = shape.style;
  66303. //计算出当前的绝对 x y
  66304. var x1 = this.location[0] + style.pointList[0][0];
  66305. var x2 = this.location[0] + style.pointList[1][0];
  66306. //渐变颜色
  66307. index++;
  66308. //以防定义的颜色数组不够用
  66309. if (index >= barLinearGradient.length) {
  66310. index = index % barLinearGradient.length;
  66311. }
  66312. var color1 = barLinearGradient[index][0];
  66313. var color2 = barLinearGradient[index][1];
  66314. //颜色
  66315. var zcolor = new Color();
  66316. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  66317. [[0, color1], [1, color2]]);
  66318. //赋值
  66319. shape.style.color = linearGradient;
  66320. }
  66321. }
  66322. }
  66323. }
  66324. }
  66325. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  66326. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66327. * This program are made available under the terms of the Apache License, Version 2.0
  66328. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66329. /**
  66330. * @class FeatureThemeBar3D
  66331. * @aliasclass Feature.Theme.Bar3D
  66332. * @deprecatedclass SuperMap.Feature.Theme.Bar3D
  66333. * @classdesc 三维柱状图 。
  66334. * @category Visualization Theme
  66335. * @extends FeatureThemeGraph
  66336. * @param {FeatureVector} data - 用户数据。
  66337. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  66338. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  66339. * @param {FeatureThemeBar3D.setting} setting - 图表配置对象。
  66340. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  66341. *
  66342. *
  66343. * @example
  66344. * // barFaceStyleByCodomain 用法示例如下:
  66345. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66346. * // start: 值域值下限(包含);
  66347. * // end: 值域值上限(不包含);
  66348. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  66349. * // barFaceStyleByCodomain 数组形如:
  66350. * [
  66351. * {
  66352. * start:0,
  66353. * end:250,
  66354. * style:{
  66355. * fillColor:"#00CD00"
  66356. * }
  66357. * },
  66358. * {
  66359. * start:250,
  66360. * end:500,
  66361. * style:{
  66362. * fillColor:"#00EE00"
  66363. * }
  66364. * },
  66365. * {
  66366. * start:500,
  66367. * end:750,
  66368. * style:{
  66369. * fillColor:"#00FF7F"
  66370. * }
  66371. * },
  66372. * {
  66373. * start:750,
  66374. * end:1500,
  66375. * style:{
  66376. * fillColor:"#00FF00"
  66377. * }
  66378. * }
  66379. * ]
  66380. *
  66381. * @example
  66382. * // barSideStyleByCodomain 用法示例如下:
  66383. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66384. * // start: 值域值下限(包含);
  66385. * // end: 值域值上限(不包含);
  66386. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  66387. * // barSideStyleByCodomain 数组形如:
  66388. * [
  66389. * {
  66390. * start:0,
  66391. * end:250,
  66392. * style:{
  66393. * fillColor:"#00CD00"
  66394. * }
  66395. * },
  66396. * {
  66397. * start:250,
  66398. * end:500,
  66399. * style:{
  66400. * fillColor:"#00EE00"
  66401. * }
  66402. * },
  66403. * {
  66404. * start:500,
  66405. * end:750,
  66406. * style:{
  66407. * fillColor:"#00FF7F"
  66408. * }
  66409. * },
  66410. * {
  66411. * start:750,
  66412. * end:1500,
  66413. * style:{
  66414. * fillColor:"#00FF00"
  66415. * }
  66416. * }
  66417. * ]
  66418. *
  66419. * @example
  66420. * // barTopStyleByCodomain 用法示例如下:
  66421. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66422. * // start: 值域值下限(包含);
  66423. * // end: 值域值上限(不包含);
  66424. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<ShapeParametersPolygon.style> 。
  66425. * // barTopStyleByCodomain 数组形如:
  66426. * [
  66427. * {
  66428. * start:0,
  66429. * end:250,
  66430. * style:{
  66431. * fillColor:"#00CD00"
  66432. * }
  66433. * },
  66434. * {
  66435. * start:250,
  66436. * end:500,
  66437. * style:{
  66438. * fillColor:"#00EE00"
  66439. * }
  66440. * },
  66441. * {
  66442. * start:500,
  66443. * end:750,
  66444. * style:{
  66445. * fillColor:"#00FF7F"
  66446. * }
  66447. * },
  66448. * {
  66449. * start:750,
  66450. * end:1500,
  66451. * style:{
  66452. * fillColor:"#00FF00"
  66453. * }
  66454. * }
  66455. * ]
  66456. * @usage
  66457. * @private
  66458. */
  66459. class Bar3D extends Graph {
  66460. constructor(data, layer, fields, setting, lonlat) {
  66461. super(data, layer, fields, setting, lonlat);
  66462. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  66463. }
  66464. /**
  66465. * @function FeatureThemeBar3D.prototype.destroy
  66466. * @override
  66467. */
  66468. destroy() {
  66469. super.destroy();
  66470. }
  66471. /**
  66472. * @function FeatureThemeBar3D.prototype.assembleShapes
  66473. * @description 图形装配实现(扩展接口)。
  66474. */
  66475. assembleShapes() {
  66476. // 图表配置对象
  66477. var sets = this.setting;
  66478. // 默认数据视图框
  66479. if (!sets.dataViewBoxParameter) {
  66480. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  66481. sets.dataViewBoxParameter = [45, 25, 20, 20];
  66482. } else {
  66483. sets.dataViewBoxParameter = [5, 5, 5, 5];
  66484. }
  66485. }
  66486. // 3d 柱图的坐标轴默认使用坐标轴箭头
  66487. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  66488. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  66489. // 重要步骤:初始化参数
  66490. if (!this.initBaseParameter()) {
  66491. return;
  66492. }
  66493. // 值域
  66494. var codomain = this.DVBCodomain;
  66495. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  66496. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  66497. // 数据视图域
  66498. var dvb = this.dataViewBox;
  66499. // 用户数据值
  66500. var fv = this.dataValues;
  66501. if (fv.length < 1) {
  66502. return;
  66503. } // 没有数据
  66504. // 数据溢出值域范围处理
  66505. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  66506. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  66507. return;
  66508. }
  66509. }
  66510. // 获取 x 轴上的图形信息
  66511. var xShapeInfo = this.calculateXShapeInfo();
  66512. if (!xShapeInfo) {
  66513. return;
  66514. }
  66515. // 每个柱条 x 位置
  66516. var xsLoc = xShapeInfo.xPositions;
  66517. // 柱条宽度
  66518. var xsWdith = xShapeInfo.width;
  66519. // 坐标轴, 默认启用
  66520. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  66521. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  66522. }
  66523. // 坐标轴
  66524. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  66525. sets.axis3DParameter = 20;
  66526. }
  66527. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  66528. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  66529. }
  66530. // 3d 偏移量, 默认值 10;
  66531. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  66532. for (let i = 0; i < fv.length; i++) {
  66533. // 无 3d 偏移量时的柱面顶部 y 坐标
  66534. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  66535. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  66536. var iPoiL = xsLoc[i] - xsWdith / 2;
  66537. var iPoiR = xsLoc[i] + xsWdith / 2;
  66538. // 3d 柱顶面节点
  66539. var bar3DTopPois = [
  66540. [iPoiL, yPx],
  66541. [iPoiR, yPx],
  66542. [iPoiR - offset3d, yPx + offset3d],
  66543. [iPoiL - offset3d, yPx + offset3d]
  66544. ];
  66545. // 3d 柱侧面节点
  66546. var bar3DSidePois = [
  66547. [iPoiR, yPx],
  66548. [iPoiR - offset3d, yPx + offset3d],
  66549. [iPoiR - offset3d, dvb[1] + offset3d],
  66550. [iPoiR, dvb[1]]
  66551. ];
  66552. // 3d 柱正面节点
  66553. var bar3DFacePois = [
  66554. [iPoiL - offset3d, dvb[1] + offset3d],
  66555. [iPoiR - offset3d, dvb[1] + offset3d],
  66556. [iPoiR - offset3d, yPx + offset3d],
  66557. [iPoiL - offset3d, yPx + offset3d]
  66558. ];
  66559. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  66560. bar3DFacePois = [
  66561. [iPoiL, dvb[1]],
  66562. [iPoiR, dvb[1]],
  66563. [iPoiR, yPx],
  66564. [iPoiL, yPx]
  66565. ];
  66566. }
  66567. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  66568. var polyTopSP = new feature_Polygon_Polygon(bar3DTopPois);
  66569. var polySideSP = new feature_Polygon_Polygon(bar3DSidePois);
  66570. var polyFaceSP = new feature_Polygon_Polygon(bar3DFacePois);
  66571. // 侧面、正面图形 style 默认值
  66572. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  66573. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  66574. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  66575. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  66576. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  66577. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  66578. // 顶面、侧面、正面图形 style
  66579. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  66580. stroke: true,
  66581. strokeColor: "#ffffff",
  66582. fillColor: "#ee9900"
  66583. },
  66584. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  66585. polySideSP.style = ShapeFactory.ShapeStyleTool({
  66586. stroke: true,
  66587. strokeColor: "#ffffff",
  66588. fillColor: "#ee9900"
  66589. },
  66590. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  66591. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  66592. stroke: true,
  66593. strokeColor: "#ffffff",
  66594. fillColor: "#ee9900"
  66595. },
  66596. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  66597. // 3d 柱条高亮样式
  66598. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  66599. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  66600. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  66601. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  66602. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  66603. // 图形携带的数据 id 信息 & 高亮模式
  66604. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  66605. // hover 模式(组合)
  66606. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  66607. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  66608. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util_Util.createUniqueID("lr_shg");
  66609. // 图形携带的数据信息
  66610. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  66611. field: this.fields[i],
  66612. value: fv[i]
  66613. };
  66614. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  66615. if (typeof(sets.barHoverAble) !== "undefined") {
  66616. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  66617. }
  66618. if (typeof(sets.barClickAble) !== "undefined") {
  66619. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  66620. }
  66621. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  66622. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  66623. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  66624. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  66625. }
  66626. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  66627. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  66628. this.shapesConvertToRelativeCoordinate();
  66629. }
  66630. /**
  66631. * @function FeatureThemeBar3D.prototype.calculateXShapeInfo
  66632. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  66633. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  66634. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  66635. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  66636. * 本函数中图形配置对象 setting 可设属性:
  66637. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  66638. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  66639. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  66640. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  66641. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  66642. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  66643. */
  66644. calculateXShapeInfo() {
  66645. var dvb = this.dataViewBox; // 数据视图框
  66646. var sets = this.setting; // 图表配置对象
  66647. var fvc = this.dataValues.length; // 数组值个数
  66648. if (fvc < 1) {
  66649. return null;
  66650. }
  66651. var xBlank; // x 轴空白间隔参数
  66652. var xShapePositions = []; // x 轴上图形的位置
  66653. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  66654. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  66655. // x 轴空白间隔参数处理
  66656. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  66657. xBlank = sets.xShapeBlank;
  66658. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  66659. if (xsLen <= fvc) {
  66660. return null;
  66661. }
  66662. xShapeWidth = xsLen / fvc
  66663. } else {
  66664. // 默认使用等距离空白间隔,空白间隔为图形宽度
  66665. xShapeWidth = dvbWidth / (2 * fvc + 1);
  66666. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  66667. }
  66668. // 图形 x 轴上的位置计算
  66669. var xOffset = 0
  66670. for (var i = 0; i < fvc; i++) {
  66671. if (i == 0) {
  66672. xOffset = xBlank[0] + xShapeWidth / 2;
  66673. } else {
  66674. xOffset += (xShapeWidth + xBlank[1]);
  66675. }
  66676. xShapePositions.push(dvb[0] + xOffset);
  66677. }
  66678. return {
  66679. "xPositions": xShapePositions,
  66680. "width": xShapeWidth
  66681. };
  66682. }
  66683. }
  66684. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  66685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66686. * This program are made available under the terms of the Apache License, Version 2.0
  66687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66688. /**
  66689. * @class FeatureThemeRankSymbol
  66690. * @aliasclass Feature.Theme.RankSymbol
  66691. * @deprecatedclass SuperMap.Feature.Theme.RankSymbol
  66692. * @category Visualization Theme
  66693. * @classdesc 符号专题要素基类。此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  66694. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeRankSymbol.setting> 的基础属性只有 5 个,
  66695. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  66696. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  66697. * @param {FeatureVector} data - 用户数据。
  66698. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  66699. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  66700. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  66701. * @param {Object} setting - 图表配置对象。除了以下 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同,请在此类的子类中查看 setting 对象的可设属性和属性含义。
  66702. * @param {Array.<number>} setting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  66703. * @param {number} [setting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  66704. * @param {number} [setting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  66705. * @param {Array.<number>} [setting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  66706. * @param {number} [setting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  66707. * @extends FeatureThemeGraph
  66708. * @usage
  66709. */
  66710. class RankSymbol extends Graph {
  66711. constructor(data, layer, fields, setting, lonlat, options) {
  66712. super(data, layer, fields, setting, lonlat, options);
  66713. /**
  66714. * @member {Object} FeatureThemeRankSymbol.prototype.setting
  66715. * @description 符号配置对象,该对象控制着图表的可视化显示。
  66716. */
  66717. this.setting = null;
  66718. // 配置项检测与赋值
  66719. if (setting && setting.codomain) {
  66720. this.setting = setting;
  66721. this.DVBCodomain = this.setting.codomain;
  66722. }
  66723. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  66724. }
  66725. /**
  66726. * @function FeatureThemeRankSymbol.prototype.destroy
  66727. * @description 销毁专题要素。
  66728. */
  66729. destroy() {
  66730. this.setting = null;
  66731. super.destroy();
  66732. }
  66733. /**
  66734. * @function FeatureThemeRankSymbol.prototype.initBaseParameter
  66735. * @description 初始化专题要素(图形)基础参数。
  66736. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  66737. * 调用此函数关系到 setting 对象的以下属性。
  66738. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  66739. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  66740. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  66741. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  66742. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  66743. * @returns {boolean} 初始化参数是否成功。
  66744. */
  66745. initBaseParameter() {
  66746. // 参数初始化是否成功
  66747. var isSuccess = true;
  66748. // setting 属性是否已成功赋值
  66749. if (!this.setting) {
  66750. return false;
  66751. }
  66752. var sets = this.setting;
  66753. // 图表偏移
  66754. if (sets.XOffset) {
  66755. this.XOffset = sets.XOffset;
  66756. }
  66757. if (sets.YOffset) {
  66758. this.YOffset = sets.YOffset;
  66759. }
  66760. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  66761. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  66762. // 其他默认值
  66763. this.origonPoint = [];
  66764. this.chartBox = [];
  66765. this.dataViewBox = [];
  66766. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  66767. this.DVBOrigonPoint = [];
  66768. this.DVBCenterPoint = [];
  66769. this.origonPointOffset = [];
  66770. // 图表位置
  66771. this.resetLocation();
  66772. // 专题要素宽度 w
  66773. var w = this.width;
  66774. // 专题要素高度 h
  66775. var h = this.height;
  66776. // 专题要素像素位置 loc
  66777. var loc = this.location;
  66778. // 专题要素像素位置 loc
  66779. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  66780. // 专题要素原点(左上角)
  66781. var op = this.origonPoint;
  66782. // 图表框([left, bottom, right, top])
  66783. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  66784. // 图表框
  66785. var cb = this.chartBox;
  66786. // 数据视图框参数,它是图表框各方向对应的内偏距
  66787. var dbbP = this.DVBParameter;
  66788. // 数据视图框 ([left, bottom, right, top])
  66789. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  66790. // 数据视图框
  66791. var dvb = this.dataViewBox;
  66792. //检查数据视图框是否合法
  66793. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  66794. return false;
  66795. }
  66796. // 数据视图框原点
  66797. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  66798. // 数据视图框宽度
  66799. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  66800. // 数据视图框高度
  66801. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  66802. // 数据视图框中心点
  66803. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  66804. // 数据视图框原点与图表框的原点偏移量
  66805. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  66806. return isSuccess;
  66807. }
  66808. }
  66809. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  66810. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66811. * This program are made available under the terms of the Apache License, Version 2.0
  66812. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66813. /**
  66814. * @class FeatureThemeCircle
  66815. * @aliasclass Feature.Theme.Circle
  66816. * @deprecatedclass SuperMap.Feature.Theme.Circle
  66817. * @classdesc 圆类。
  66818. * @category Visualization Theme
  66819. * @extends FeatureThemeRankSymbol
  66820. * @param {FeatureVector} data - 用户数据。
  66821. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  66822. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  66823. * @param {FeatureThemeCircle.setting} setting - 图表配置对象。
  66824. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  66825. * @usage
  66826. * @private
  66827. */
  66828. class Circle extends RankSymbol {
  66829. constructor(data, layer, fields, setting, lonlat) {
  66830. super(data, layer, fields, setting, lonlat);
  66831. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  66832. }
  66833. /**
  66834. * @function FeatureThemeCircle.prototype.destroy
  66835. * @override
  66836. */
  66837. destroy() {
  66838. super.destroy();
  66839. }
  66840. /**
  66841. * @function FeatureThemeCircle.prototype.assembleShapes
  66842. * @description 装配图形(扩展接口)。
  66843. */
  66844. assembleShapes() {
  66845. //默认填充颜色
  66846. var defaultFillColor = "#ff9277";
  66847. // setting 属性是否已成功赋值
  66848. if (!this.setting) {
  66849. return false;
  66850. }
  66851. var sets = this.setting;
  66852. // 检测 setting 的必设参数
  66853. if (!(sets.codomain)) {
  66854. return false;
  66855. }
  66856. // 数据
  66857. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  66858. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  66859. this.dataValues = dataEffective ? dataEffective : [];
  66860. // 数据值数组
  66861. var fv = this.dataValues;
  66862. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  66863. //if(fv[0] < 0) return; //数据为负值
  66864. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  66865. if (!sets.maxR) {
  66866. sets.maxR = 100;
  66867. }
  66868. if (!sets.minR) {
  66869. sets.minR = 0;
  66870. }
  66871. // 值域范围
  66872. var codomain = this.DVBCodomain;
  66873. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  66874. // 用户定义了值域范围
  66875. if (codomain && codomain[1] - codomain[0] > 0) {
  66876. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  66877. } else {
  66878. //this.DVBUnitValue = sets.maxR / maxValue;
  66879. this.DVBUnitValue = sets.maxR;
  66880. }
  66881. var uv = this.DVBUnitValue;
  66882. //圆半径
  66883. var r = fv[0] * uv + sets.minR;
  66884. this.width = 2 * r;
  66885. this.height = 2 * r;
  66886. // 重要步骤:初始化参数
  66887. if (!this.initBaseParameter()) {
  66888. return;
  66889. }
  66890. //假如用户设置了值域范围 没有在值域范围直接返回
  66891. if (codomain) {
  66892. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  66893. return;
  66894. }
  66895. }
  66896. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  66897. //圆形对象参数
  66898. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  66899. //circleSP.sytle 初始化
  66900. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  66901. //图形的填充颜色
  66902. if (typeof (sets.fillColor) !== "undefined") {
  66903. //用户自定义
  66904. circleSP.style.fillColor = sets.fillColor;
  66905. } else {
  66906. //当前默认
  66907. circleSP.style.fillColor = defaultFillColor;
  66908. }
  66909. //圆形 Hover样式
  66910. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  66911. //圆形 Hover 与 click 设置
  66912. if (typeof(sets.circleHoverAble) !== "undefined") {
  66913. circleSP.hoverable = sets.circleHoverAble;
  66914. }
  66915. if (typeof(sets.circleClickAble) !== "undefined") {
  66916. circleSP.clickable = sets.circleClickAble;
  66917. }
  66918. //图形携带的数据信息
  66919. circleSP.refDataID = this.data.id;
  66920. circleSP.dataInfo = {
  66921. field: this.fields[0],
  66922. r: r,
  66923. value: fv[0]
  66924. };
  66925. // 创建扇形并把此扇形添加到图表图形数组
  66926. this.shapes.push(this.shapeFactory.createShape(circleSP));
  66927. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  66928. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  66929. this.shapesConvertToRelativeCoordinate();
  66930. }
  66931. }
  66932. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  66933. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66934. * This program are made available under the terms of the Apache License, Version 2.0
  66935. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66936. /**
  66937. * @class FeatureThemeLine
  66938. * @aliasclass Feature.Theme.Line
  66939. * @deprecatedclass SuperMap.Feature.Theme.Line
  66940. * @classdesc 折线图。
  66941. * @category Visualization Theme
  66942. * @example
  66943. * // pointStyleByCodomain 参数用法示例
  66944. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66945. * // start: 值域值下限(包含);
  66946. * // end: 值域值上限(不包含);
  66947. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  66948. * // pointStyleByCodomain 数组形如:
  66949. * [
  66950. * {
  66951. * start:0,
  66952. * end:250,
  66953. * style:{
  66954. * fillColor:"#00CD00"
  66955. * }
  66956. * },
  66957. * {
  66958. * start:250,
  66959. * end:500,
  66960. * style:{
  66961. * fillColor:"#00EE00"
  66962. * }
  66963. * },
  66964. * {
  66965. * start:500,
  66966. * end:750,
  66967. * style:{
  66968. * fillColor:"#00FF7F"
  66969. * }
  66970. * },
  66971. * {
  66972. * start:750,
  66973. * end:1500,
  66974. * style:{
  66975. * fillColor:"#00FF00"
  66976. * }
  66977. * }
  66978. * ]
  66979. *
  66980. * @extends FeatureThemeGraph
  66981. * @param {FeatureVector} data - 用户数据。
  66982. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  66983. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  66984. * @param {FeatureThemeLine.setting} setting - 图表配置对象。
  66985. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  66986. * @usage
  66987. * @private
  66988. */
  66989. class Line extends Graph {
  66990. constructor(data, layer, fields, setting, lonlat, options) {
  66991. super(data, layer, fields, setting, lonlat, options);
  66992. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  66993. }
  66994. /**
  66995. * @function FeatureThemeLine.prototype.destroy
  66996. * @override
  66997. */
  66998. destroy() {
  66999. super.destroy();
  67000. }
  67001. /**
  67002. * @function FeatureThemeLine.prototype.assembleShapes
  67003. * @description 装配图形(扩展接口)。
  67004. */
  67005. assembleShapes() {
  67006. // 图表配置对象
  67007. var sets = this.setting;
  67008. // 默认数据视图框
  67009. if (!sets.dataViewBoxParameter) {
  67010. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67011. sets.dataViewBoxParameter = [45, 15, 15, 15];
  67012. } else {
  67013. sets.dataViewBoxParameter = [5, 5, 5, 5];
  67014. }
  67015. }
  67016. // 重要步骤:初始化参数
  67017. if (!this.initBaseParameter()) {
  67018. return;
  67019. }
  67020. var dvb = this.dataViewBox;
  67021. // 值域
  67022. var codomain = this.DVBCodomain;
  67023. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  67024. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  67025. var uv = this.DVBUnitValue;
  67026. // 数据值数组
  67027. var fv = this.dataValues;
  67028. if (fv.length < 1) {
  67029. return;
  67030. } // 没有数据
  67031. // 获取 x 轴上的图形信息
  67032. var xShapeInfo = this.calculateXShapeInfo();
  67033. if (!xShapeInfo) {
  67034. return;
  67035. }
  67036. // 折线每个节点的 x 位置
  67037. var xsLoc = xShapeInfo.xPositions;
  67038. // 背景框,默认启用
  67039. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  67040. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  67041. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67042. }
  67043. // 折线图必须使用坐标轴
  67044. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  67045. // var isDataEffective = true;
  67046. var xPx; // 折线节点 x 坐标
  67047. var yPx; // 折线节点 y 坐标
  67048. var poiLists = []; // 折线节点数组
  67049. var shapePois = []; // 折线节点图形数组
  67050. for (var i = 0, len = fv.length; i < len; i++) {
  67051. // 数据溢出值域检查
  67052. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67053. // isDataEffective = false;
  67054. return null;
  67055. }
  67056. xPx = xsLoc[i];
  67057. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  67058. // 折线节点参数对象
  67059. var poiSP = new Point_Point(xPx, yPx);
  67060. // 折线节点 style
  67061. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  67062. // 折线节点 hover 样式
  67063. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  67064. // 折线节点 hover click
  67065. if (typeof(sets.pointHoverAble) !== "undefined") {
  67066. poiSP.hoverable = sets.pointHoverAble;
  67067. }
  67068. if (typeof(sets.pointClickAble) !== "undefined") {
  67069. poiSP.clickable = sets.pointClickAble;
  67070. }
  67071. // 图形携带的数据信息
  67072. poiSP.refDataID = this.data.id;
  67073. poiSP.dataInfo = {
  67074. field: this.fields[i],
  67075. value: fv[i]
  67076. };
  67077. // 创建图形并把此图形添加到折线节点图形数组
  67078. shapePois.push(this.shapeFactory.createShape(poiSP));
  67079. // 添加折线节点到折线节点数组
  67080. var poi = [xPx, yPx];
  67081. poiLists.push(poi);
  67082. }
  67083. // 折线参数对象
  67084. var lineSP = new Line_Line(poiLists);
  67085. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  67086. // 禁止事件响应
  67087. lineSP.clickable = false;
  67088. lineSP.hoverable = false;
  67089. var shapeLine = this.shapeFactory.createShape(lineSP);
  67090. this.shapes.push(shapeLine);
  67091. // 添加节点到图表图形数组
  67092. this.shapes = this.shapes.concat(shapePois);
  67093. // // 数据范围检测未通过,清空图形
  67094. // if (isDataEffective === false) {
  67095. // this.shapes = [];
  67096. // }
  67097. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67098. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67099. this.shapesConvertToRelativeCoordinate();
  67100. }
  67101. /**
  67102. * @function FeatureThemeLine.prototype.calculateXShapeInfo
  67103. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  67104. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  67105. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67106. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67107. * 本函数中图形配置对象 setting 可设属性:<br>
  67108. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  67109. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  67110. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  67111. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  67112. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67113. */
  67114. calculateXShapeInfo() {
  67115. var dvb = this.dataViewBox; // 数据视图框
  67116. var sets = this.setting; // 图表配置对象
  67117. var fvc = this.dataValues.length; // 数组值个数
  67118. if (fvc < 1) {
  67119. return null;
  67120. }
  67121. var xBlank; // x 轴空白间隔参数
  67122. var xShapePositions = []; // x 轴上图形的位置
  67123. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  67124. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  67125. var unitOffset = 0; // 单位偏移量
  67126. // x 轴空白间隔参数处理
  67127. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  67128. xBlank = sets.xShapeBlank;
  67129. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  67130. if (xsLen <= fvc) {
  67131. return null;
  67132. }
  67133. unitOffset = xsLen / (fvc - 1);
  67134. } else {
  67135. // 默认使用等距离空白间隔,空白间隔为图形宽度
  67136. unitOffset = dvbWidth / (fvc + 1);
  67137. xBlank = [unitOffset, unitOffset, unitOffset];
  67138. }
  67139. // 图形 x 轴上的位置计算
  67140. var xOffset = 0
  67141. for (var i = 0; i < fvc; i++) {
  67142. if (i == 0) {
  67143. xOffset = xBlank[0];
  67144. } else {
  67145. xOffset += unitOffset;
  67146. }
  67147. xShapePositions.push(dvb[0] + xOffset);
  67148. }
  67149. return {
  67150. "xPositions": xShapePositions,
  67151. "width": xShapeWidth
  67152. };
  67153. }
  67154. }
  67155. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  67156. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67157. * This program are made available under the terms of the Apache License, Version 2.0
  67158. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67159. /**
  67160. * @class FeatureThemePie
  67161. * @aliasclass Feature.Theme.Pie
  67162. * @deprecatedclass SuperMap.Feature.Theme.Pie
  67163. * @classdesc 饼图。
  67164. * @category Visualization Theme
  67165. * @param {FeatureVector} data - 用户数据。
  67166. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  67167. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  67168. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  67169. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  67170. * @extends FeatureThemeGraph
  67171. * @example
  67172. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67173. * // start: 值域值下限(包含);
  67174. * // end: 值域值上限(不包含);
  67175. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  67176. * // sectorStyleByCodomain 数组形如:
  67177. * [
  67178. * {
  67179. * start:0,
  67180. * end:250,
  67181. * style:{
  67182. * fillColor:"#00CD00"
  67183. * }
  67184. * },
  67185. * {
  67186. * start:250,
  67187. * end:500,
  67188. * style:{
  67189. * fillColor:"#00EE00"
  67190. * }
  67191. * },
  67192. * {
  67193. * start:500,
  67194. * end:750,
  67195. * style:{
  67196. * fillColor:"#00FF7F"
  67197. * }
  67198. * },
  67199. * {
  67200. * start:750,
  67201. * end:1500,
  67202. * style:{
  67203. * fillColor:"#00FF00"
  67204. * }
  67205. * }
  67206. * ]
  67207. * @usage
  67208. * @private
  67209. */
  67210. class Pie extends Graph {
  67211. constructor(data, layer, fields, setting, lonlat) {
  67212. super(data, layer, fields, setting, lonlat);
  67213. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  67214. }
  67215. /**
  67216. * @function FeatureThemePie.prototype.destroy
  67217. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  67218. */
  67219. destroy() {
  67220. super.destroy();
  67221. }
  67222. /**
  67223. * @function FeatureThemePie.prototype.assembleShapes
  67224. * @description 装配图形(扩展接口)。
  67225. */
  67226. assembleShapes() {
  67227. // 图表配置对象
  67228. var sets = this.setting;
  67229. // 一个默认 style 组
  67230. var defaultStyleGroup = [
  67231. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  67232. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  67233. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  67234. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  67235. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  67236. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  67237. ];
  67238. // 重要步骤:初始化参数
  67239. if (!this.initBaseParameter()) {
  67240. return;
  67241. }
  67242. // 背景框,默认不启用
  67243. if (sets.useBackground) {
  67244. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67245. }
  67246. // 数据值数组
  67247. var fv = this.dataValues;
  67248. if (fv.length < 1) {
  67249. return;
  67250. } // 没有数据
  67251. // 值域范围
  67252. var codomain = this.DVBCodomain;
  67253. // 值域范围检测
  67254. for (let i = 0; i < fv.length; i++) {
  67255. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67256. return;
  67257. }
  67258. }
  67259. // 值的绝对值总和
  67260. var valueSum = 0;
  67261. for (let i = 0; i < fv.length; i++) {
  67262. valueSum += Math.abs(fv[i]);
  67263. }
  67264. // 重要步骤:定义图表 FeatureThemePie 数据视图框中单位值的含义,单位值:每度代表的数值
  67265. this.DVBUnitValue = 360 / valueSum;
  67266. var uv = this.DVBUnitValue;
  67267. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  67268. var startAngle = 0; // 扇形起始边角度
  67269. var endAngle = 0; // 扇形终止边角度
  67270. var startAngleTmp = startAngle; // 扇形临时起始边角度
  67271. // 扇形(自适应)半径
  67272. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  67273. for (var i = 0; i < fv.length; i++) {
  67274. var fvi = Math.abs(fv[i]);
  67275. //计算终止角
  67276. if (i === 0) {
  67277. endAngle = startAngle + fvi * uv;
  67278. } else if (i === fvi.length - 1) {
  67279. endAngle = startAngleTmp;
  67280. } else {
  67281. endAngle = startAngle + fvi * uv;
  67282. }
  67283. //矫正误差计算
  67284. if ((endAngle - startAngle) >= 360) {
  67285. endAngle = 359.9999999;
  67286. }
  67287. // 扇形参数对象
  67288. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  67289. // 扇形样式
  67290. if (typeof(sets.sectorStyleByFields) === "undefined") {
  67291. // 使用默认 style 组
  67292. var colorIndex = i % defaultStyleGroup.length;
  67293. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  67294. } else {
  67295. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  67296. }
  67297. // 扇形 hover 样式
  67298. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  67299. // 扇形 hover 与 click 设置
  67300. if (typeof(sets.sectorHoverAble) !== "undefined") {
  67301. sectorSP.hoverable = sets.sectorHoverAble;
  67302. }
  67303. if (typeof(sets.sectorClickAble) !== "undefined") {
  67304. sectorSP.clickable = sets.sectorClickAble;
  67305. }
  67306. // 图形携带的数据信息
  67307. sectorSP.refDataID = this.data.id;
  67308. sectorSP.dataInfo = {
  67309. field: this.fields[i],
  67310. value: fv[i]
  67311. };
  67312. // 创建扇形并把此扇形添加到图表图形数组
  67313. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  67314. // 把上一次的结束角度作为下一次的起始角度
  67315. startAngle = endAngle;
  67316. }
  67317. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67318. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67319. this.shapesConvertToRelativeCoordinate();
  67320. }
  67321. }
  67322. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  67323. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67324. * This program are made available under the terms of the Apache License, Version 2.0
  67325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67326. /**
  67327. * @class FeatureThemePoint
  67328. * @aliasclass Feature.Theme.Point
  67329. * @deprecatedclass SuperMap.Feature.Theme.Point
  67330. * @classdesc 点状图。
  67331. * @category Visualization Theme
  67332. * @param {FeatureVector} data - 用户数据。
  67333. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  67334. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  67335. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  67336. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  67337. * @example
  67338. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67339. * // start: 值域值下限(包含);
  67340. * // end: 值域值上限(不包含);
  67341. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  67342. * // pointStyleByCodomain 数组形如:
  67343. * [
  67344. * {
  67345. * start:0,
  67346. * end:250,
  67347. * style:{
  67348. * fillColor:"#00CD00"
  67349. * }
  67350. * },
  67351. * {
  67352. * start:250,
  67353. * end:500,
  67354. * style:{
  67355. * fillColor:"#00EE00"
  67356. * }
  67357. * },
  67358. * {
  67359. * start:500,
  67360. * end:750,
  67361. * style:{
  67362. * fillColor:"#00FF7F"
  67363. * }
  67364. * },
  67365. * {
  67366. * start:750,
  67367. * end:1500,
  67368. * style:{
  67369. * fillColor:"#00FF00"
  67370. * }
  67371. * }
  67372. * ]
  67373. * @extends FeatureThemeGraph
  67374. * @usage
  67375. * @private
  67376. */
  67377. class overlay_Point_Point extends Graph {
  67378. constructor(data, layer, fields, setting, lonlat, options) {
  67379. super(data, layer, fields, setting, lonlat, options);
  67380. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  67381. }
  67382. /**
  67383. * @function FeatureThemePoint.prototype.destroy
  67384. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  67385. */
  67386. destroy() {
  67387. super.destroy();
  67388. }
  67389. /**
  67390. * @function FeatureThemePoint.prototype.Point.assembleShapes
  67391. * @description 装配图形(扩展接口)。
  67392. */
  67393. assembleShapes() {
  67394. // 图表配置对象
  67395. var sets = this.setting;
  67396. // 默认数据视图框
  67397. if (!sets.dataViewBoxParameter) {
  67398. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67399. sets.dataViewBoxParameter = [45, 15, 15, 15];
  67400. } else {
  67401. sets.dataViewBoxParameter = [5, 5, 5, 5];
  67402. }
  67403. }
  67404. // 重要步骤:初始化参数
  67405. if (!this.initBaseParameter()) {
  67406. return;
  67407. }
  67408. var dvb = this.dataViewBox;
  67409. // 值域
  67410. var codomain = this.DVBCodomain;
  67411. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  67412. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  67413. var uv = this.DVBUnitValue;
  67414. var fv = this.dataValues;
  67415. // 获取 x 轴上的图形信息
  67416. var xShapeInfo = this.calculateXShapeInfo();
  67417. if (!xShapeInfo) {
  67418. return;
  67419. }
  67420. // 折线每个节点的 x 位置
  67421. var xsLoc = xShapeInfo.xPositions;
  67422. // 背景框,默认启用
  67423. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  67424. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  67425. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67426. }
  67427. // 点状图必须使用坐标轴
  67428. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  67429. var xPx; // 图形点 x 坐标
  67430. var yPx; // 图形点 y 坐标
  67431. for (var i = 0, len = fv.length; i < len; i++) {
  67432. // 数据溢出值域检查
  67433. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67434. //isDataEffective = false;
  67435. return null;
  67436. }
  67437. xPx = xsLoc[i];
  67438. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  67439. // 图形点参数对象
  67440. var poiSP = new Point_Point(xPx, yPx);
  67441. // 图形点 style
  67442. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  67443. // 图形点 hover 样式
  67444. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  67445. // 图形点 hover click
  67446. if (typeof(sets.pointHoverAble) !== "undefined") {
  67447. poiSP.hoverable = sets.pointHoverAble;
  67448. }
  67449. if (typeof(sets.pointClickAble) !== "undefined") {
  67450. poiSP.clickable = sets.pointClickAble;
  67451. }
  67452. // 图形携带的数据信息
  67453. poiSP.refDataID = this.data.id;
  67454. poiSP.dataInfo = {
  67455. field: this.fields[i],
  67456. value: fv[i]
  67457. };
  67458. // 创建图形点并把此图形添加到图表图形数组
  67459. this.shapes.push(this.shapeFactory.createShape(poiSP));
  67460. }
  67461. // 数据范围检测未通过,清空图形
  67462. // if (isDataEffective === false) {
  67463. // this.shapes = [];
  67464. // }
  67465. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67466. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67467. this.shapesConvertToRelativeCoordinate();
  67468. }
  67469. /**
  67470. * @function FeatureThemePoint.prototype.calculateXShapeInfo
  67471. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  67472. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  67473. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67474. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67475. * 本函数中图形配置对象 setting 可设属性:<br>
  67476. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  67477. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  67478. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  67479. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67480. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67481. */
  67482. calculateXShapeInfo() {
  67483. var dvb = this.dataViewBox; // 数据视图框
  67484. var sets = this.setting; // 图表配置对象
  67485. var fvc = this.dataValues.length; // 数组值个数
  67486. if (fvc < 1) {
  67487. return null;
  67488. }
  67489. var xBlank; // x 轴空白间隔参数
  67490. var xShapePositions = []; // x 轴上图形的位置
  67491. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  67492. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  67493. var unitOffset = 0; // 单位偏移量
  67494. // x 轴空白间隔参数处理
  67495. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  67496. xBlank = sets.xShapeBlank;
  67497. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  67498. if (xsLen <= fvc) {
  67499. return null;
  67500. }
  67501. unitOffset = xsLen / (fvc - 1);
  67502. } else {
  67503. // 默认使用等距离空白间隔,空白间隔为图形宽度
  67504. unitOffset = dvbWidth / (fvc + 1);
  67505. xBlank = [unitOffset, unitOffset, unitOffset];
  67506. }
  67507. // 图形 x 轴上的位置计算
  67508. var xOffset = 0
  67509. for (var i = 0; i < fvc; i++) {
  67510. if (i == 0) {
  67511. xOffset = xBlank[0];
  67512. } else {
  67513. xOffset += unitOffset;
  67514. }
  67515. xShapePositions.push(dvb[0] + xOffset);
  67516. }
  67517. return {
  67518. "xPositions": xShapePositions,
  67519. "width": xShapeWidth
  67520. };
  67521. }
  67522. }
  67523. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  67524. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67525. * This program are made available under the terms of the Apache License, Version 2.0
  67526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67527. /**
  67528. * @class FeatureThemeRing
  67529. * @aliasclass Feature.Theme.Ring
  67530. * @deprecatedclass SuperMap.Feature.Theme.Ring
  67531. * @classdesc 环状图。
  67532. * @category Visualization Theme
  67533. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  67534. * @param {FeatureVector} data - 用户数据。
  67535. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  67536. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  67537. * @param {FeatureThemeRing.setting} setting - 图表配置对象。
  67538. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  67539. * @example
  67540. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67541. * // start: 值域值下限(包含);
  67542. * // end: 值域值上限(不包含);
  67543. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  67544. * // sectorStyleByCodomain 数组形如:
  67545. * [
  67546. * {
  67547. * start:0,
  67548. * end:250,
  67549. * style:{
  67550. * fillColor:"#00CD00"
  67551. * }
  67552. * },
  67553. * {
  67554. * start:250,
  67555. * end:500,
  67556. * style:{
  67557. * fillColor:"#00EE00"
  67558. * }
  67559. * },
  67560. * {
  67561. * start:500,
  67562. * end:750,
  67563. * style:{
  67564. * fillColor:"#00FF7F"
  67565. * }
  67566. * },
  67567. * {
  67568. * start:750,
  67569. * end:1500,
  67570. * style:{
  67571. * fillColor:"#00FF00"
  67572. * }
  67573. * }
  67574. * ]
  67575. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  67576. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  67577. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  67578. *
  67579. * @extends FeatureThemeGraph
  67580. * @usage
  67581. * @private
  67582. */
  67583. class Ring extends Graph {
  67584. constructor(data, layer, fields, setting, lonlat) {
  67585. super(data, layer, fields, setting, lonlat);
  67586. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  67587. }
  67588. /**
  67589. * @function FeatureThemeRing.prototype.destroy
  67590. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  67591. */
  67592. destroy() {
  67593. super.destroy();
  67594. }
  67595. /**
  67596. * @function FeatureThemeRing.prototype.assembleShapes
  67597. * @description 装配图形(扩展接口)。
  67598. */
  67599. assembleShapes() {
  67600. // 重要步骤:初始化参数
  67601. if (!this.initBaseParameter()) {
  67602. return;
  67603. }
  67604. // 一个默认 style 组
  67605. var defaultStyleGroup = [
  67606. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  67607. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  67608. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  67609. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  67610. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  67611. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  67612. ];
  67613. // 图表配置对象
  67614. var sets = this.setting;
  67615. // 背景框,默认不启用
  67616. if (sets.useBackground) {
  67617. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67618. }
  67619. // 数据值数组
  67620. var fv = this.dataValues;
  67621. if (fv.length < 1) {
  67622. return;
  67623. } // 没有数据
  67624. // 值域范围
  67625. var codomain = this.DVBCodomain;
  67626. // 值域范围检测
  67627. for (let i = 0; i < fv.length; i++) {
  67628. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67629. return;
  67630. }
  67631. }
  67632. // 值的绝对值总和
  67633. var valueSum = 0;
  67634. for (let i = 0; i < fv.length; i++) {
  67635. valueSum += Math.abs(fv[i]);
  67636. }
  67637. // 重要步骤:定义图表 FeatureThemeRing 数据视图框中单位值的含义,单位值:每度代表的数值
  67638. this.DVBUnitValue = 360 / valueSum;
  67639. var uv = this.DVBUnitValue;
  67640. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  67641. var startAngle = 0; // 扇形起始边角度
  67642. var endAngle = 0; // 扇形终止边角度
  67643. var startAngleTmp = startAngle; // 扇形临时起始边角度
  67644. // 扇形外环(自适应)半径
  67645. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  67646. // 扇形内环(自适应)半径
  67647. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  67648. var r0 = (
  67649. typeof(sets.innerRingRadius) !== "undefined"
  67650. && !isNaN(sets.innerRingRadius)
  67651. && isInRange
  67652. ) ? sets.innerRingRadius : 0;
  67653. for (var i = 0; i < fv.length; i++) {
  67654. var fvi = Math.abs(fv[i]);
  67655. // 计算结束角度
  67656. if (i === 0) {
  67657. endAngle = startAngle + fvi * uv;
  67658. } else if (i === fvi.length - 1) {
  67659. endAngle = startAngleTmp;
  67660. } else {
  67661. endAngle = startAngle + fvi * uv;
  67662. }
  67663. // 扇形参数对象
  67664. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  67665. // 扇形样式
  67666. if (typeof(sets.sectorStyleByFields) === "undefined") {
  67667. // 使用默认 style 组
  67668. var colorIndex = i % defaultStyleGroup.length;
  67669. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  67670. } else {
  67671. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  67672. }
  67673. // 扇形 hover 样式
  67674. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  67675. // 扇形 hover 与 click 设置
  67676. if (typeof(sets.sectorHoverAble) !== "undefined") {
  67677. sectorSP.hoverable = sets.sectorHoverAble;
  67678. }
  67679. if (typeof(sets.sectorClickAble) !== "undefined") {
  67680. sectorSP.clickable = sets.sectorClickAble;
  67681. }
  67682. // 图形携带的数据信息
  67683. sectorSP.refDataID = this.data.id;
  67684. sectorSP.dataInfo = {
  67685. field: this.fields[i],
  67686. value: fv[i]
  67687. };
  67688. // 创建扇形并把此扇形添加到图表图形数组
  67689. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  67690. // 把上一次的结束角度作为下一次的起始角度
  67691. startAngle = endAngle;
  67692. }
  67693. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67694. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67695. this.shapesConvertToRelativeCoordinate();
  67696. }
  67697. }
  67698. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  67699. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67700. * This program are made available under the terms of the Apache License, Version 2.0
  67701. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67702. /**
  67703. * @class FeatureThemeVector
  67704. * @aliasclass Feature.Theme.ThemeVector
  67705. * @deprecatedclass SuperMap.Feature.Theme.ThemeVector
  67706. * @classdesc 矢量专题要素类。
  67707. * @category Visualization Theme
  67708. * @extends FeatureTheme
  67709. * @param {FeatureVector} data - 用户数据,的类型为矢量数据 feature。
  67710. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  67711. * @param {Object} style - 样式。
  67712. * @param {Object} options - 创建专题要素时的可选参数。
  67713. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离,单位:像素。
  67714. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  67715. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  67716. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  67717. * @param {Object} [options.highlightStyle] - 高亮样式。
  67718. * @usage
  67719. */
  67720. class ThemeVector extends Theme_Theme {
  67721. constructor(data, layer, style, options, shapeOptions) {
  67722. super(data, layer);
  67723. //数据的 geometry 属性必须存在且类型是 Geometry 或其子类的类型
  67724. if (!data.geometry) {
  67725. return;
  67726. }
  67727. if (!(data.geometry instanceof Geometry_Geometry)) {
  67728. return;
  67729. }
  67730. /**
  67731. * @member {Bounds} [FeatureThemeVector.prototype.dataBounds]
  67732. * @description 用户数据的(feature.geometry)地理范围。
  67733. */
  67734. this.dataBounds = data.geometry.getBounds();
  67735. /**
  67736. * @member {number} [FeatureThemeVector.prototype.nodesClipPixel=2]
  67737. * @description 节点抽稀像素距离。
  67738. */
  67739. this.nodesClipPixel = 2;
  67740. /**
  67741. * @member {boolean} [FeatureThemeVector.prototype.isHoverAble=true]
  67742. * @description 图形是否可 hover。
  67743. */
  67744. this.isHoverAble = true;
  67745. /**
  67746. * @member {boolean} [FeatureThemeVector.prototype.isMultiHover=true]
  67747. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  67748. */
  67749. this.isMultiHover = true;
  67750. /**
  67751. * @member {boolean} [FeatureThemeVector.prototype.isClickAble=true]
  67752. * @description 图形是否可点击。
  67753. */
  67754. this.isClickAble = true;
  67755. /**
  67756. * @member {Object} [FeatureThemeVector.prototype.highlightStyle]
  67757. * @description 高亮样式。
  67758. */
  67759. this.highlightStyle = null;
  67760. /**
  67761. * @member {Object} [FeatureThemeVector.prototype.shapeOptions]
  67762. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  67763. */
  67764. this.shapeOptions = {};
  67765. /**
  67766. * @member {Object} [FeatureThemeVector.prototype.style]
  67767. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  67768. */
  67769. this.style = style || {};
  67770. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  67771. this.style = style ? style : {};
  67772. if (options) {
  67773. Util_Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  67774. }
  67775. if (shapeOptions) {
  67776. Util_Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  67777. }
  67778. //设置基础参数 dataBounds、lonlat、location
  67779. var geometry = data.geometry;
  67780. this.lonlat = this.dataBounds.getCenterLonLat();
  67781. this.location = this.getLocalXY(this.lonlat);
  67782. //将地理要素转为专题要素
  67783. if (geometry instanceof LinearRing_LinearRing) {
  67784. this.lineToTF(geometry);
  67785. } else if (geometry instanceof LineString) {
  67786. this.lineToTF(geometry);
  67787. } else if (geometry instanceof Curve) {
  67788. //独立几何体
  67789. } else if (geometry instanceof MultiPoint) {
  67790. this.multiPointToTF(geometry);
  67791. } else if (geometry instanceof MultiLineString) {
  67792. this.multiLineStringToTF(geometry);
  67793. } else if (geometry instanceof MultiPolygon) {
  67794. this.multiPolygonToTF(geometry);
  67795. } else if (geometry instanceof Polygon_Polygon) {
  67796. this.polygonToTF(geometry);
  67797. } else if (geometry instanceof Collection) {
  67798. //独立几何体
  67799. } else if (geometry instanceof Point) {
  67800. this.pointToTF(geometry);
  67801. } else if (geometry instanceof Rectangle) {
  67802. this.rectangleToTF(geometry);
  67803. } else if (geometry instanceof GeoText) {
  67804. this.geoTextToTF(geometry);
  67805. }
  67806. }
  67807. /**
  67808. * @function FeatureThemeVector.prototype.destroy
  67809. * @override
  67810. */
  67811. destroy() {
  67812. this.style = null;
  67813. this.dataBounds = null;
  67814. this.nodesClipPixel = null;
  67815. this.isHoverAble = null;
  67816. this.isMultiHover = null;
  67817. this.isClickAble = null;
  67818. this.highlightStyle = null;
  67819. this.shapeOptions = null;
  67820. super.destroy();
  67821. }
  67822. /**
  67823. * @function FeatureThemeVector.prototype.lineToTF
  67824. * @description 转换线和线环要素。
  67825. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeometryLineString 或 GeometryLineRing。
  67826. */
  67827. lineToTF(geometry) {
  67828. var components = geometry.components;
  67829. //节点像素坐标
  67830. var localLX = [];
  67831. //参考位置,参考中心为
  67832. var refLocal = [];
  67833. var location = this.location;
  67834. var pointList = [];
  67835. //节点抽稀距离
  67836. var nCPx = this.nodesClipPixel;
  67837. for (var i = 0; i < components.length; i++) {
  67838. var components_i = components[i];
  67839. refLocal = [];
  67840. localLX = this.getLocalXY(components_i);
  67841. refLocal[0] = localLX[0] - location[0];
  67842. refLocal[1] = localLX[1] - location[1];
  67843. //抽稀 - 2 px
  67844. if (pointList.length > 0) {
  67845. var lastLocalXY = pointList[pointList.length - 1];
  67846. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  67847. continue;
  67848. }
  67849. }
  67850. //使用参考点
  67851. pointList.push(refLocal);
  67852. }
  67853. if (pointList.length < 2) {
  67854. return null;
  67855. }
  67856. //赋 style
  67857. var style = new Object();
  67858. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  67859. style.pointList = pointList;
  67860. //创建图形
  67861. var shape = new SmicBrokenLine({
  67862. style: style,
  67863. clickable: this.isClickAble,
  67864. hoverable: this.isHoverAble
  67865. });
  67866. //设置高亮样式
  67867. if (this.highlightStyle) {
  67868. shape.highlightStyle = this.highlightStyle;
  67869. }
  67870. //设置参考中心,指定图形位置
  67871. shape.refOriginalPosition = this.location;
  67872. //储存数据 id 属性,用于事件
  67873. shape.refDataID = this.data.id;
  67874. //储存数据 id 属性,用于事件-多图形同时高亮
  67875. shape.isHoverByRefDataID = this.isMultiHover;
  67876. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  67877. if (this.shapeOptions) {
  67878. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  67879. }
  67880. this.shapes.push(shape);
  67881. }
  67882. /**
  67883. * @function FeatureThemeVector.prototype.multiPointToTF
  67884. * @description 转多点要素。
  67885. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  67886. */
  67887. multiPointToTF(geometry) {
  67888. /* //-- 不抽稀
  67889. var components = geometry.components;
  67890. for(var i = 0; i < components.length; i++){
  67891. var components_i = components[i];
  67892. this.pointToTF(components_i);
  67893. }
  67894. */
  67895. var components = geometry.components;
  67896. //节点像素坐标
  67897. var localLX = [];
  67898. //参考位置,参考中心为
  67899. var refLocal = [];
  67900. var location = this.location;
  67901. var pointList = [];
  67902. //节点抽稀距离
  67903. var nCPx = this.nodesClipPixel;
  67904. for (var i = 0; i < components.length; i++) {
  67905. var components_i = components[i];
  67906. refLocal = [];
  67907. localLX = this.getLocalXY(components_i);
  67908. refLocal[0] = localLX[0] - location[0];
  67909. refLocal[1] = localLX[1] - location[1];
  67910. //抽稀
  67911. if (pointList.length > 0) {
  67912. var lastLocalXY = pointList[pointList.length - 1];
  67913. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  67914. continue;
  67915. }
  67916. }
  67917. //使用参考点
  67918. pointList.push(refLocal);
  67919. //赋 style
  67920. var style = new Object();
  67921. style.r = 6; //防止漏设此参数,默认 6 像素
  67922. style = Util_Util.copyAttributesWithClip(style, this.style);
  67923. style.x = refLocal[0];
  67924. style.y = refLocal[1];
  67925. //创建图形
  67926. var shape = new SmicPoint({
  67927. style: style,
  67928. clickable: this.isClickAble,
  67929. hoverable: this.isHoverAble
  67930. });
  67931. //设置高亮样式
  67932. if (this.highlightStyle) {
  67933. shape.highlightStyle = this.highlightStyle;
  67934. }
  67935. //设置参考中心,指定图形位置
  67936. shape.refOriginalPosition = location;
  67937. //储存数据 id 属性,用于事件
  67938. shape.refDataID = this.data.id;
  67939. //储存数据 id 属性,用于事件-多图形同时高亮
  67940. shape.isHoverByRefDataID = this.isMultiHover;
  67941. //修改一些 shape 可选属性,通常不需要这么做
  67942. if (this.shapeOptions) {
  67943. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  67944. }
  67945. this.shapes.push(shape);
  67946. }
  67947. }
  67948. /**
  67949. * @function FeatureThemeVector.prototype.multiLineStringToTF
  67950. * @description 转换多线要素。
  67951. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  67952. */
  67953. multiLineStringToTF(geometry) {
  67954. var components = geometry.components;
  67955. for (var i = 0; i < components.length; i++) {
  67956. var components_i = components[i];
  67957. this.lineToTF(components_i);
  67958. }
  67959. }
  67960. /**
  67961. * @function FeatureThemeVector.prototype.multiPolygonToTF
  67962. * @description 转换多面要素。
  67963. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  67964. */
  67965. multiPolygonToTF(geometry) {
  67966. var components = geometry.components;
  67967. for (var i = 0; i < components.length; i++) {
  67968. var components_i = components[i];
  67969. this.polygonToTF(components_i);
  67970. }
  67971. }
  67972. /**
  67973. * @function FeatureThemeVector.prototype.pointToTF
  67974. * @description 转换点要素。
  67975. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  67976. */
  67977. pointToTF(geometry) {
  67978. //参考位置,参考中心为
  67979. var location = this.location;
  67980. //geometry 像素坐标
  67981. var localLX = this.getLocalXY(geometry);
  67982. //赋 style
  67983. var style = new Object();
  67984. style.r = 6; //防止漏设此参数,默认 6 像素
  67985. style = Util_Util.copyAttributesWithClip(style, this.style);
  67986. style.x = localLX[0] - location[0];
  67987. style.y = localLX[1] - location[1];
  67988. //创建图形
  67989. var shape = new SmicPoint({
  67990. style: style,
  67991. clickable: this.isClickAble,
  67992. hoverable: this.isHoverAble
  67993. });
  67994. //设置高亮样式
  67995. if (this.highlightStyle) {
  67996. shape.highlightStyle = this.highlightStyle;
  67997. }
  67998. //设置参考中心,指定图形位置
  67999. shape.refOriginalPosition = location;
  68000. //储存数据 id 属性,用于事件
  68001. shape.refDataID = this.data.id;
  68002. //储存数据 id 属性,用于事件-多图形同时高亮
  68003. shape.isHoverByRefDataID = this.isMultiHover;
  68004. //修改一些 shape 可选属性,通常不需要这么做
  68005. if (this.shapeOptions) {
  68006. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  68007. }
  68008. this.shapes.push(shape);
  68009. }
  68010. /**
  68011. * @function FeatureThemeVector.prototype.polygonToThemeFeature
  68012. * @description 转换面要素。
  68013. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  68014. */
  68015. polygonToTF(geometry) {
  68016. var components = geometry.components;
  68017. //节点像素坐标
  68018. var localLX = [];
  68019. //参考位置,参考中心为
  68020. var refLocal = [];
  68021. var location = this.location;
  68022. var pointList = [];
  68023. //岛洞
  68024. var holePolygonPointList = [];
  68025. var holePolygonPointLists = [];
  68026. //节点抽稀距离
  68027. var nCPx = this.nodesClipPixel;
  68028. for (var i = 0; i < components.length; i++) {
  68029. var components_i = components[i].components;
  68030. if (i === 0) {
  68031. // 第一个 component 正常绘制
  68032. pointList = [];
  68033. for (var j = 0; j < components_i.length; j++) {
  68034. refLocal = [];
  68035. localLX = this.getLocalXY(components_i[j]);
  68036. refLocal[0] = localLX[0] - location[0];
  68037. refLocal[1] = localLX[1] - location[1];
  68038. //抽稀 - 2 px
  68039. if (pointList.length > 0) {
  68040. var lastLocalXY = pointList[pointList.length - 1];
  68041. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  68042. continue;
  68043. }
  68044. }
  68045. //使用参考点
  68046. pointList.push(refLocal);
  68047. }
  68048. } else {
  68049. // 其它 component 作为岛洞
  68050. holePolygonPointList = [];
  68051. for (var k = 0; k < components_i.length; k++) {
  68052. refLocal = [];
  68053. localLX = this.getLocalXY(components_i[k]);
  68054. refLocal[0] = localLX[0] - location[0];
  68055. refLocal[1] = localLX[1] - location[1];
  68056. //抽稀 - 2 px
  68057. if (holePolygonPointList.length > 0) {
  68058. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  68059. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  68060. continue;
  68061. }
  68062. }
  68063. //使用参考点
  68064. holePolygonPointList.push(refLocal);
  68065. }
  68066. }
  68067. if (holePolygonPointList.length < 2) {
  68068. continue;
  68069. }
  68070. holePolygonPointLists.push(holePolygonPointList);
  68071. }
  68072. if (pointList.length < 2) {
  68073. return;
  68074. }
  68075. //赋 style
  68076. var style = {};
  68077. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  68078. style.pointList = pointList;
  68079. //创建图形
  68080. var shape = new SmicPolygon({
  68081. style: style,
  68082. clickable: this.isClickAble,
  68083. hoverable: this.isHoverAble
  68084. });
  68085. //设置高亮样式
  68086. if (this.highlightStyle) {
  68087. shape.highlightStyle = this.highlightStyle;
  68088. }
  68089. //设置参考中心,指定图形位置
  68090. shape.refOriginalPosition = this.location;
  68091. //储存数据 id 属性,用于事件
  68092. shape.refDataID = this.data.id;
  68093. //储存数据 id 属性,用于事件-多图形同时高亮
  68094. shape.isHoverByRefDataID = this.isMultiHover;
  68095. //岛洞面
  68096. if (holePolygonPointLists.length > 0) {
  68097. shape.holePolygonPointLists = holePolygonPointLists;
  68098. }
  68099. //修改一些 shape 可选属性,通常不需要这么做
  68100. if (this.shapeOptions) {
  68101. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  68102. }
  68103. this.shapes.push(shape);
  68104. }
  68105. /**
  68106. * @function FeatureThemeVector.prototype.rectangleToTF
  68107. * @description 转换矩形要素。
  68108. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  68109. */
  68110. rectangleToTF(geometry) {
  68111. //参考位置,参考中心为
  68112. var location = this.location;
  68113. var ll = new LonLat(geometry.x, geometry.y);
  68114. //地图分辨率
  68115. var res = this.layer.map.getResolution();
  68116. //geometry 像素坐标
  68117. var localLX = this.getLocalXY(ll);
  68118. //赋 style
  68119. var style = new Object();
  68120. style.r = 6; //防止漏设此参数,默认 6 像素
  68121. style = Util_Util.copyAttributesWithClip(style, this.style);
  68122. style.x = localLX[0] - location[0];
  68123. // Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  68124. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  68125. style.width = geometry.width / res;
  68126. style.height = geometry.height / res;
  68127. //创建图形
  68128. var shape = new SmicRectangle({
  68129. style: style,
  68130. clickable: this.isClickAble,
  68131. hoverable: this.isHoverAble
  68132. });
  68133. //设置高亮样式
  68134. if (this.highlightStyle) {
  68135. shape.highlightStyle = this.highlightStyle;
  68136. }
  68137. //设置参考中心,指定图形位置
  68138. shape.refOriginalPosition = location;
  68139. //储存数据 id 属性,用于事件
  68140. shape.refDataID = this.data.id;
  68141. //储存数据 id 属性,用于事件-多图形同时高亮
  68142. shape.isHoverByRefDataID = this.isMultiHover;
  68143. //修改一些 shape 可选属性,通常不需要这么做
  68144. if (this.shapeOptions) {
  68145. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  68146. }
  68147. this.shapes.push(shape);
  68148. }
  68149. /**
  68150. * @function FeatureThemeVector.prototype.geoTextToTF
  68151. * @description 转换文本要素。
  68152. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  68153. */
  68154. geoTextToTF(geometry) {
  68155. //参考位置,参考中心为
  68156. var location = this.location;
  68157. //geometry 像素坐标
  68158. var localLX = this.getLocalXY(geometry);
  68159. //赋 style
  68160. var style = new Object();
  68161. style.r = 6; //防止漏设此参数,默认 6 像素
  68162. style = Util_Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  68163. style.x = localLX[0] - location[0];
  68164. style.y = localLX[1] - location[1];
  68165. style.text = geometry.text;
  68166. //创建图形
  68167. var shape = new SmicText({
  68168. style: style,
  68169. clickable: this.isClickAble,
  68170. hoverable: this.isHoverAble
  68171. });
  68172. //设置高亮样式
  68173. if (this.highlightStyle) {
  68174. shape.highlightStyle = this.highlightStyle;
  68175. }
  68176. //设置参考中心,指定图形位置
  68177. shape.refOriginalPosition = location;
  68178. //储存数据 id 属性,用于事件
  68179. shape.refDataID = this.data.id;
  68180. //储存数据 id 属性,用于事件-多图形同时高亮
  68181. shape.isHoverByRefDataID = this.isMultiHover;
  68182. //修改一些 shape 可选属性,通常不需要这么做
  68183. if (this.shapeOptions) {
  68184. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  68185. }
  68186. this.shapes.push(shape);
  68187. }
  68188. /**
  68189. * @function FeatureThemeVector.prototype.updateAndAddShapes
  68190. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  68191. */
  68192. updateAndAddShapes() {
  68193. var newLocalLX = this.getLocalXY(this.lonlat);
  68194. this.location = newLocalLX;
  68195. var render = this.layer.renderer;
  68196. for (var i = 0, len = this.shapes.length; i < len; i++) {
  68197. var shape = this.shapes[i];
  68198. //设置参考中心,指定图形位置
  68199. shape.refOriginalPosition = newLocalLX;
  68200. render.addShape(shape);
  68201. }
  68202. }
  68203. /**
  68204. * @function FeatureThemeVector.prototype.getShapesCount
  68205. * @description 获得专题要素中可视化图形的数量。
  68206. * @returns {number} 可视化图形的数量。
  68207. */
  68208. getShapesCount() {
  68209. return this.shapes.length;
  68210. }
  68211. /**
  68212. * @function FeatureThemeVector.prototype.getLocalXY
  68213. * @description 地理坐标转为像素坐标。
  68214. * @param {LonLat} lonlat - 专题要素地理位置。
  68215. */
  68216. getLocalXY(lonlat) {
  68217. return this.layer.getLocalXY(lonlat);
  68218. }
  68219. }
  68220. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  68221. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68222. * This program are made available under the terms of the Apache License, Version 2.0
  68223. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68224. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  68225. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68226. * This program are made available under the terms of the Apache License, Version 2.0
  68227. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68228. /**
  68229. * @class LevelRenderer.Group
  68230. * @category Visualization Theme
  68231. * @private
  68232. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  68233. * @extends {LevelRenderer.Transformable}
  68234. * (code)
  68235. * var g = new LevelRenderer.Group();
  68236. * var Circle = new LevelRenderer.Shape.Circle();
  68237. * g.position[0] = 100;
  68238. * g.position[1] = 100;
  68239. * g.addChild(new Circle({
  68240. * style: {
  68241. * x: 100,
  68242. * y: 100,
  68243. * r: 20,
  68244. * brushType: 'fill'
  68245. * }
  68246. * }));
  68247. * LR.addGroup(g);
  68248. * (end)
  68249. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  68250. */
  68251. class Group extends mixinExt(Eventful, Transformable) {
  68252. constructor(options) {
  68253. super(options)
  68254. options = options || {};
  68255. /**
  68256. * @member {string} LevelRenderer.Group.prototype.id
  68257. * @description Group 的唯一标识。
  68258. */
  68259. this.id = null;
  68260. /**
  68261. * @readonly
  68262. * @member {string} [LevelRenderer.Group.prototype.type='group']
  68263. * @description 类型。
  68264. */
  68265. this.type = 'group';
  68266. //http://www.w3.org/TR/2dcontext/#clipping-region
  68267. /**
  68268. * @member {string} LevelRenderer.Group.prototype.clipShape
  68269. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  68270. */
  68271. this.clipShape = null;
  68272. /**
  68273. * @member {Array} LevelRenderer.Group.prototype._children
  68274. * @description _children。
  68275. */
  68276. this._children = [];
  68277. /**
  68278. * @member {Array} LevelRenderer.Group.prototype._storage
  68279. * @description _storage。
  68280. */
  68281. this._storage = null;
  68282. /**
  68283. * @member {boolean} [LevelRenderer.Group.prototype.__dirty=true]
  68284. * @description __dirty。
  68285. */
  68286. this.__dirty = true;
  68287. /**
  68288. * @member {boolean} [LevelRenderer.Group.prototype.ignore=false]
  68289. * @description 是否忽略该 Group 及其所有子节点。
  68290. */
  68291. this.ignore = false;
  68292. Util_Util.extend(this, options);
  68293. this.id = this.id || Util_Util.createUniqueID("smShapeGroup_");
  68294. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  68295. }
  68296. /**
  68297. * @function LevelRenderer.Group.prototype.destroy
  68298. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  68299. */
  68300. destroy() {
  68301. this.id = null;
  68302. this.type = null;
  68303. this.clipShape = null;
  68304. this._children = null;
  68305. this._storage = null;
  68306. this.__dirty = null;
  68307. this.ignore = null;
  68308. super.destroy();
  68309. }
  68310. /**
  68311. * @function LevelRenderer.Group.prototype.children
  68312. * @description 复制并返回一份新的包含所有儿子节点的数组。
  68313. * @returns {Array.<LevelRenderer.Shape>} 图形数组。
  68314. */
  68315. children() {
  68316. return this._children.slice();
  68317. }
  68318. /**
  68319. * @function LevelRenderer.Group.prototype.childAt
  68320. * @description 获取指定 index 的儿子节点
  68321. * @param {number} idx - 节点索引。
  68322. * @returns {LevelRenderer.Shape} 图形。
  68323. */
  68324. childAt(idx) {
  68325. return this._children[idx];
  68326. }
  68327. /**
  68328. * @function LevelRenderer.Group.prototype.addChild
  68329. * @description 添加子节点,可以是 Shape 或者 Group。
  68330. * @param {(LevelRenderer.Shape|LevelRenderer.Group)} child - 节点图形。
  68331. */
  68332. // TODO Type Check
  68333. addChild(child) {
  68334. if (child == this) {
  68335. return;
  68336. }
  68337. if (child.parent == this) {
  68338. return;
  68339. }
  68340. if (child.parent) {
  68341. child.parent.removeChild(child);
  68342. }
  68343. this._children.push(child);
  68344. child.parent = this;
  68345. if (this._storage && this._storage !== child._storage) {
  68346. this._storage.addToMap(child);
  68347. if (child instanceof Group) {
  68348. child.addChildrenToStorage(this._storage);
  68349. }
  68350. }
  68351. }
  68352. /**
  68353. * @function LevelRenderer.Group.prototype.removeChild
  68354. * @description 移除子节点。
  68355. * @param {LevelRenderer.Shape} child - 需要移除的子节点图形。
  68356. */
  68357. removeChild(child) {
  68358. var idx = Util_Util.indexOf(this._children, child);
  68359. this._children.splice(idx, 1);
  68360. child.parent = null;
  68361. if (this._storage) {
  68362. this._storage.delFromMap(child.id);
  68363. if (child instanceof Group) {
  68364. child.delChildrenFromStorage(this._storage);
  68365. }
  68366. }
  68367. }
  68368. /**
  68369. * @function LevelRenderer.Group.prototype.eachChild
  68370. * @description 遍历所有子节点。
  68371. * @param {function} cb - 回调函数。
  68372. * @param {Object} context - 上下文。
  68373. */
  68374. eachChild(cb, context) {
  68375. var haveContext = !!context;
  68376. for (var i = 0; i < this._children.length; i++) {
  68377. var child = this._children[i];
  68378. if (haveContext) {
  68379. cb.call(context, child);
  68380. } else {
  68381. cb(child);
  68382. }
  68383. }
  68384. }
  68385. /**
  68386. * @function LevelRenderer.Group.prototype.traverse
  68387. * @description 深度优先遍历所有子孙节点。
  68388. * @param {function} cb - 回调函数。
  68389. * @param {Object} context - 上下文。
  68390. */
  68391. traverse(cb, context) {
  68392. var haveContext = !!context;
  68393. for (var i = 0; i < this._children.length; i++) {
  68394. var child = this._children[i];
  68395. if (haveContext) {
  68396. cb.call(context, child);
  68397. } else {
  68398. cb(child);
  68399. }
  68400. if (child.type === 'group') {
  68401. child.traverse(cb, context);
  68402. }
  68403. }
  68404. }
  68405. /**
  68406. * @function LevelRenderer.Group.prototype.addChildrenToStorage
  68407. * @description 把子图形添加到仓库。
  68408. * @param {LevelRenderer.Storage} storage - 图形仓库。
  68409. */
  68410. addChildrenToStorage(storage) {
  68411. for (var i = 0; i < this._children.length; i++) {
  68412. var child = this._children[i];
  68413. storage.addToMap(child);
  68414. if (child.type === 'group') {
  68415. child.addChildrenToStorage(storage);
  68416. }
  68417. }
  68418. }
  68419. /**
  68420. * @function LevelRenderer.Group.prototype.delChildrenFromStorage
  68421. * @description 从仓库把子图形删除。
  68422. * @param {LevelRenderer.Storage} storage - 图形仓库。
  68423. */
  68424. delChildrenFromStorage(storage) {
  68425. for (var i = 0; i < this._children.length; i++) {
  68426. var child = this._children[i];
  68427. storage.delFromMap(child.id);
  68428. if (child.type === 'group') {
  68429. child.delChildrenFromStorage(storage);
  68430. }
  68431. }
  68432. }
  68433. /**
  68434. * @function LevelRenderer.Group.prototype.modSelf
  68435. * @description 是否修改。
  68436. */
  68437. modSelf() {
  68438. this.__dirty = true;
  68439. }
  68440. }
  68441. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  68442. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68443. * This program are made available under the terms of the Apache License, Version 2.0
  68444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68445. /**
  68446. * @private
  68447. * @class LevelRenderer.Storage
  68448. * @category Visualization Theme
  68449. * @classdesc 内容(图像)仓库 (M) 。
  68450. */
  68451. class Storage {
  68452. constructor() {
  68453. /**
  68454. * @member {Object} LevelRenderer.Storage.prototype._elements
  68455. * @description 所有常规形状,id 索引的 map。
  68456. */
  68457. this._elements = {};
  68458. /**
  68459. * @member {Array} LevelRenderer.Storage.prototype._hoverElements
  68460. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  68461. *
  68462. */
  68463. this._hoverElements = [];
  68464. /**
  68465. * @member {Array} LevelRenderer.Storage.prototype._roots
  68466. * @description _roots。
  68467. *
  68468. */
  68469. this._roots = [];
  68470. /**
  68471. * @member {Array} LevelRenderer.Storage.prototype._shapeList
  68472. * @description _shapeList。
  68473. *
  68474. */
  68475. this._shapeList = [];
  68476. /**
  68477. * @member {number} LevelRenderer.Storage.prototype._shapeListOffset
  68478. * @description _shapeListOffset。默认值:0。
  68479. *
  68480. */
  68481. this._shapeListOffset = 0;
  68482. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  68483. }
  68484. /**
  68485. * @function LevelRenderer.Storage.prototype.destroy
  68486. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  68487. */
  68488. destroy() {
  68489. this.dispose();
  68490. this._shapeList = null;
  68491. this._shapeListOffset = null;
  68492. }
  68493. /**
  68494. * @function LevelRenderer.Storage.prototype.iterShape
  68495. * @description 遍历迭代器。
  68496. *
  68497. * @param {function} fun - 迭代回调函数,return true终止迭代。
  68498. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  68499. * @param {boolean} [hover=true] - 是否是高亮层图形。
  68500. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  68501. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  68502. * @return {LevelRenderer.Storage} this。
  68503. */
  68504. iterShape(fun, option) {
  68505. if (!option) {
  68506. var defaultIterateOption = {
  68507. hover: false,
  68508. normal: 'down',
  68509. update: false
  68510. };
  68511. option = defaultIterateOption;
  68512. }
  68513. if (option.hover) {
  68514. // 高亮层数据遍历
  68515. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  68516. var el = this._hoverElements[i];
  68517. el.updateTransform();
  68518. if (fun(el)) {
  68519. return this;
  68520. }
  68521. }
  68522. }
  68523. if (option.update) {
  68524. this.updateShapeList();
  68525. }
  68526. // 遍历: 'down' | 'up'
  68527. switch (option.normal) {
  68528. case 'down':
  68529. {
  68530. // 降序遍历,高层优先
  68531. let l = this._shapeList.length;
  68532. while (l--) {
  68533. if (fun(this._shapeList[l])) {
  68534. return this;
  68535. }
  68536. }
  68537. break;
  68538. }
  68539. // case 'up':
  68540. default:
  68541. {
  68542. // 升序遍历,底层优先
  68543. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  68544. if (fun(this._shapeList[i])) {
  68545. return this;
  68546. }
  68547. }
  68548. break;
  68549. }
  68550. }
  68551. return this;
  68552. }
  68553. /**
  68554. * @function LevelRenderer.Storage.prototype.getHoverShapes
  68555. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  68556. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  68557. */
  68558. getHoverShapes(update) {
  68559. // hoverConnect
  68560. var hoverElements = [], len = this._hoverElements.length;
  68561. for (let i = 0; i < len; i++) {
  68562. hoverElements.push(this._hoverElements[i]);
  68563. var target = this._hoverElements[i].hoverConnect;
  68564. if (target) {
  68565. var shape;
  68566. target = target instanceof Array ? target : [target];
  68567. for (var j = 0, k = target.length; j < k; j++) {
  68568. shape = target[j].id ? target[j] : this.get(target[j]);
  68569. if (shape) {
  68570. hoverElements.push(shape);
  68571. }
  68572. }
  68573. }
  68574. }
  68575. hoverElements.sort(Storage.shapeCompareFunc);
  68576. if (update) {
  68577. for (let i = 0, l = hoverElements.length; i < l; i++) {
  68578. hoverElements[i].updateTransform();
  68579. }
  68580. }
  68581. return hoverElements;
  68582. }
  68583. /**
  68584. * @function LevelRenderer.Storage.prototype.getShapeList
  68585. * @description 返回所有图形的绘制队列。
  68586. *
  68587. * @param {boolean} [update=false] - 是否在返回前更新该数组。详见:<LevelRenderer.Shape> updateShapeList。
  68588. * @return {LevelRenderer.Shape} 图形。
  68589. */
  68590. getShapeList(update) {
  68591. if (update) {
  68592. this.updateShapeList();
  68593. }
  68594. return this._shapeList;
  68595. }
  68596. /**
  68597. * @function LevelRenderer.Storage.prototype.updateShapeList
  68598. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  68599. */
  68600. updateShapeList() {
  68601. this._shapeListOffset = 0;
  68602. var rootsLen = this._roots.length;
  68603. for (let i = 0; i < rootsLen; i++) {
  68604. let root = this._roots[i];
  68605. this._updateAndAddShape(root);
  68606. }
  68607. this._shapeList.length = this._shapeListOffset;
  68608. var shapeListLen = this._shapeList.length;
  68609. for (let i = 0; i < shapeListLen; i++) {
  68610. this._shapeList[i].__renderidx = i;
  68611. }
  68612. this._shapeList.sort(Storage.shapeCompareFunc);
  68613. }
  68614. /**
  68615. * @function LevelRenderer.Storage.prototype._updateAndAddShape
  68616. * @description 更新并添加图形。
  68617. *
  68618. */
  68619. _updateAndAddShape(el, clipShapes) {
  68620. if (el.ignore) {
  68621. return;
  68622. }
  68623. el.updateTransform();
  68624. if (el.type == 'group') {
  68625. if (el.clipShape) {
  68626. // clipShape 的变换是基于 group 的变换
  68627. el.clipShape.parent = el;
  68628. el.clipShape.updateTransform();
  68629. // PENDING 效率影响
  68630. if (clipShapes) {
  68631. clipShapes = clipShapes.slice();
  68632. clipShapes.push(el.clipShape);
  68633. } else {
  68634. clipShapes = [el.clipShape];
  68635. }
  68636. }
  68637. for (var i = 0; i < el._children.length; i++) {
  68638. var child = el._children[i];
  68639. // Force to mark as dirty if group is dirty
  68640. child.__dirty = el.__dirty || child.__dirty;
  68641. this._updateAndAddShape(child, clipShapes);
  68642. }
  68643. // Mark group clean here
  68644. el.__dirty = false;
  68645. } else {
  68646. el.__clipShapes = clipShapes;
  68647. this._shapeList[this._shapeListOffset++] = el;
  68648. }
  68649. }
  68650. /**
  68651. * @function LevelRenderer.Storage.prototype.mod
  68652. * @description 修改图形(Shape)或者组(Group)。
  68653. *
  68654. * @param {string} elId - 唯一标识。
  68655. * @param {Object} params - 参数。
  68656. * @return {LevelRenderer.Storage} this。
  68657. */
  68658. mod(elId, params) {
  68659. var el = this._elements[elId];
  68660. if (el) {
  68661. el.modSelf();
  68662. if (params) {
  68663. // 如果第二个参数直接使用 shape
  68664. // parent, _storage, __startClip 三个属性会有循环引用
  68665. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  68666. if (params.parent || params._storage || params.__startClip) {
  68667. var target = {};
  68668. for (var name in params) {
  68669. if (
  68670. name == 'parent'
  68671. || name == '_storage'
  68672. || name == '__startClip'
  68673. ) {
  68674. continue;
  68675. }
  68676. if (params.hasOwnProperty(name)) {
  68677. target[name] = params[name];
  68678. }
  68679. }
  68680. new levelRenderer_Util_Util().merge(el, target, true);
  68681. } else {
  68682. new levelRenderer_Util_Util().merge(el, params, true);
  68683. }
  68684. }
  68685. }
  68686. return this;
  68687. }
  68688. /**
  68689. * @function LevelRenderer.Storage.prototype.drift
  68690. * @description 移动指定的图形(Shape)的位置。
  68691. * @param {string} shapeId - 唯一标识。
  68692. * @param {number} dx
  68693. * @param {number} dy
  68694. * @return {LevelRenderer.Storage} this。
  68695. */
  68696. drift(shapeId, dx, dy) {
  68697. var shape = this._elements[shapeId];
  68698. if (shape) {
  68699. shape.needTransform = true;
  68700. if (shape.draggable === 'horizontal') {
  68701. dy = 0;
  68702. } else if (shape.draggable === 'vertical') {
  68703. dx = 0;
  68704. }
  68705. if (!shape.ondrift // ondrift
  68706. // 有onbrush并且调用执行返回false或undefined则继续
  68707. || (shape.ondrift && !shape.ondrift(dx, dy))
  68708. ) {
  68709. shape.drift(dx, dy);
  68710. }
  68711. }
  68712. return this;
  68713. }
  68714. /**
  68715. * @function LevelRenderer.Storage.prototype.addHover
  68716. * @description 添加高亮层数据。
  68717. * @param {LevelRenderer.Shape} shape - 图形。
  68718. * @return {LevelRenderer.Storage} this。
  68719. */
  68720. addHover(shape) {
  68721. shape.updateNeedTransform();
  68722. this._hoverElements.push(shape);
  68723. return this;
  68724. }
  68725. /**
  68726. * @function LevelRenderer.Storage.prototype.delHover
  68727. * @description 清空高亮层数据。
  68728. * @return {LevelRenderer.Storage} this。
  68729. */
  68730. delHover() {
  68731. this._hoverElements = [];
  68732. return this;
  68733. }
  68734. /**
  68735. * @function LevelRenderer.Storage.prototype.hasHoverShape
  68736. * @description 是否有图形在高亮层里。
  68737. * @return {boolean} 是否有图形在高亮层里。
  68738. */
  68739. hasHoverShape() {
  68740. return this._hoverElements.length > 0;
  68741. }
  68742. /**
  68743. * @function LevelRenderer.Storage.prototype.addRoot
  68744. * @description 添加图形(Shape)或者组(Group)到根节点。
  68745. *
  68746. * @param {(LevelRenderer.Shape/LevelRenderer.Group)} el - 图形。
  68747. *
  68748. */
  68749. addRoot(el) {
  68750. if (el instanceof Group) {
  68751. el.addChildrenToStorage(this);
  68752. }
  68753. this.addToMap(el);
  68754. this._roots.push(el);
  68755. }
  68756. /**
  68757. * @function LevelRenderer.Storage.prototype.delRoot
  68758. * @description 删除指定的图形(Shape)或者组(Group)。
  68759. *
  68760. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 ID 数组。如果为空清空整个Storage。
  68761. *
  68762. */
  68763. delRoot(elId) {
  68764. if (typeof(elId) == 'undefined') {
  68765. // 不指定elId清空
  68766. for (var i = 0; i < this._roots.length; i++) {
  68767. var root = this._roots[i];
  68768. if (root instanceof Group) {
  68769. root.delChildrenFromStorage(this);
  68770. }
  68771. }
  68772. this._elements = {};
  68773. this._hoverElements = [];
  68774. this._roots = [];
  68775. return;
  68776. }
  68777. if (elId instanceof Array) {
  68778. var elIdLen = elId.length;
  68779. for (let i = 0; i < elIdLen; i++) {
  68780. this.delRoot(elId[i]);
  68781. }
  68782. return;
  68783. }
  68784. var el;
  68785. if (typeof(elId) == 'string') {
  68786. el = this._elements[elId];
  68787. } else {
  68788. el = elId;
  68789. }
  68790. var idx = new levelRenderer_Util_Util().indexOf(this._roots, el);
  68791. if (idx >= 0) {
  68792. this.delFromMap(el.id);
  68793. this._roots.splice(idx, 1);
  68794. if (el instanceof Group) {
  68795. el.delChildrenFromStorage(this);
  68796. }
  68797. }
  68798. }
  68799. /**
  68800. * @function LevelRenderer.Storage.prototype.addToMap
  68801. * @description 添加图形到 map。
  68802. *
  68803. * @param {LevelRenderer.Shape} el - 图形。
  68804. * @return {LevelRenderer.Storage} this。
  68805. */
  68806. addToMap(el) {
  68807. if (el instanceof Group) {
  68808. el._storage = this;
  68809. }
  68810. el.modSelf();
  68811. this._elements[el.id] = el;
  68812. return this;
  68813. }
  68814. /**
  68815. * @function LevelRenderer.Storage.prototype.get
  68816. * @description 获取指定图形。
  68817. *
  68818. * @param {string} elId - 图形 id。
  68819. * @return {LevelRenderer.Shape} 图形。
  68820. */
  68821. get(elId) {
  68822. return this._elements[elId];
  68823. }
  68824. /**
  68825. * @function LevelRenderer.Storage.prototype.delFromMap
  68826. * @description 从 map 中删除指定图形。
  68827. *
  68828. * @param {string} elId - 图形id。
  68829. * @return {LevelRenderer.Storage} this。
  68830. */
  68831. delFromMap(elId) {
  68832. var el = this._elements[elId];
  68833. if (el) {
  68834. delete this._elements[elId];
  68835. if (el instanceof Group) {
  68836. el._storage = null;
  68837. }
  68838. }
  68839. return this;
  68840. }
  68841. /**
  68842. * @function LevelRenderer.Storage.prototype.dispose
  68843. * @description 清空并且释放 Storage。
  68844. */
  68845. dispose() {
  68846. this._elements = null;
  68847. // this._renderList = null;
  68848. this._roots = null;
  68849. this._hoverElements = null;
  68850. }
  68851. static shapeCompareFunc(a, b) {
  68852. if (a.zlevel == b.zlevel) {
  68853. if (a.z == b.z) {
  68854. return a.__renderidx - b.__renderidx;
  68855. }
  68856. return a.z - b.z;
  68857. }
  68858. return a.zlevel - b.zlevel;
  68859. }
  68860. }
  68861. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  68862. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68863. * This program are made available under the terms of the Apache License, Version 2.0
  68864. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68865. /**
  68866. * @private
  68867. * @class LevelRenderer.Painter
  68868. * @category Visualization Theme
  68869. * @classdesc Painter 绘图模块。
  68870. * @param {HTMLElement} root - 绘图区域(DIV)。
  68871. * @param {LevelRenderer.Storage} storage - Storage 实例。
  68872. */
  68873. class Painter {
  68874. constructor(root, storage) {
  68875. /**
  68876. * @member {HTMLElement} LevelRenderer.Painter.prototype.root
  68877. * @description 绘图容器。
  68878. *
  68879. */
  68880. this.root = root;
  68881. /**
  68882. * @member {Array} LevelRenderer.Painter.prototype.storage
  68883. * @description 图形仓库。
  68884. *
  68885. */
  68886. this.storage = storage;
  68887. /**
  68888. * @member {HTMLElement} LevelRenderer.Painter.prototype._domRoot
  68889. * @description 容器根 dom 对象。
  68890. *
  68891. */
  68892. this._domRoot = null;
  68893. /**
  68894. * @member {Object} LevelRenderer.Painter.prototype._layers
  68895. * @description 绘制层对象。
  68896. *
  68897. */
  68898. this._layers = {};
  68899. /**
  68900. * @member {Array} LevelRenderer.Painter.prototype._zlevelList
  68901. * @description 层列表。
  68902. *
  68903. */
  68904. this._zlevelList = [];
  68905. /**
  68906. * @member {Object} LevelRenderer.Painter.prototype._layerConfig
  68907. * @description 绘制层配置对象。
  68908. *
  68909. */
  68910. this._layerConfig = {};
  68911. /**
  68912. * @member {Object} LevelRenderer.Painter.prototype._bgDom
  68913. * @description 背景层 Canvas (Dom)。
  68914. *
  68915. */
  68916. this._bgDom = null;
  68917. /**
  68918. * @member {function} LevelRenderer.Painter.prototype.shapeToImage
  68919. * @description 形状转图像函数。
  68920. *
  68921. */
  68922. this.shapeToImage = null;
  68923. // retina 屏幕优化
  68924. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  68925. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  68926. this.root.innerHTML = '';
  68927. this._width = this._getWidth(); // 宽,缓存记录
  68928. this._height = this._getHeight(); // 高,缓存记录
  68929. var domRoot = document.createElement('div');
  68930. this._domRoot = domRoot;
  68931. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  68932. domRoot.style.position = 'relative';
  68933. domRoot.style.overflow = 'hidden';
  68934. domRoot.style.width = this._width + 'px';
  68935. domRoot.style.height = this._height + 'px';
  68936. this.root.appendChild(domRoot);
  68937. this.shapeToImage = this._createShapeToImageProcessor();
  68938. // 创建各层canvas
  68939. // 背景
  68940. //this._bgDom = Painter.createDom('bg', 'div', this);
  68941. this._bgDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  68942. domRoot.appendChild(this._bgDom);
  68943. this._bgDom.onselectstart = returnFalse;
  68944. this._bgDom.style['-webkit-user-select'] = 'none';
  68945. this._bgDom.style['user-select'] = 'none';
  68946. this._bgDom.style['-webkit-touch-callout'] = 'none';
  68947. // 高亮
  68948. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  68949. var hoverLayer = new PaintLayer(Util_Util.createUniqueID("_highLightLayer_"), this);
  68950. this._layers['hover'] = hoverLayer;
  68951. domRoot.appendChild(hoverLayer.dom);
  68952. hoverLayer.initContext();
  68953. hoverLayer.dom.onselectstart = returnFalse;
  68954. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  68955. hoverLayer.dom.style['user-select'] = 'none';
  68956. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  68957. var me = this;
  68958. this.updatePainter = function (shapeList, callback) {
  68959. me.refreshShapes(shapeList, callback);
  68960. };
  68961. // 返回false的方法,用于避免页面被选中
  68962. function returnFalse() {
  68963. return false;
  68964. }
  68965. /* eslint-disable */
  68966. // 什么都不干的空方法
  68967. function doNothing() { //NOSONAR
  68968. }
  68969. /* eslint-enable */
  68970. }
  68971. /**
  68972. * @function LevelRenderer.Painter.prototype.destroy
  68973. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  68974. */
  68975. destroy() {
  68976. this.dispose();
  68977. this._zlevelList = null;
  68978. this._layerConfig = null;
  68979. this._bgDom = null;
  68980. this.shapeToImage = null;
  68981. }
  68982. /**
  68983. * @function LevelRenderer.Painter.prototype.render
  68984. * @description 渲染。首次绘图,创建各种 dom 和 context。
  68985. *
  68986. * @param {function} callback - 绘画结束后的回调函数。
  68987. * @return {LevelRenderer.Painter} this。
  68988. */
  68989. render(callback) {
  68990. // TODO
  68991. this.refresh(callback, true);
  68992. return this;
  68993. }
  68994. /**
  68995. * @function LevelRenderer.Painter.prototype.refresh
  68996. * @description 刷新。
  68997. *
  68998. * @param {function} callback - 刷新结束后的回调函数。
  68999. * @param {boolean} paintAll - 强制绘制所有 shape。
  69000. * @return {LevelRenderer.Painter} this。
  69001. */
  69002. refresh(callback, paintAll) {
  69003. var list = this.storage.getShapeList(true);
  69004. this._paintList(list, paintAll);
  69005. if (typeof callback == 'function') {
  69006. callback();
  69007. }
  69008. return this;
  69009. }
  69010. /**
  69011. * Method: _paintList
  69012. * 按列表绘制图形。
  69013. */
  69014. _paintList(list, paintAll) {
  69015. if (typeof(paintAll) == 'undefined') {
  69016. paintAll = false;
  69017. }
  69018. this._updateLayerStatus(list);
  69019. var currentLayer;
  69020. var currentZLevel;
  69021. var ctx;
  69022. for (var id in this._layers) {
  69023. if (id !== 'hover') {
  69024. this._layers[id].unusedCount++;
  69025. this._layers[id].updateTransform();
  69026. }
  69027. }
  69028. var invTransform = [];
  69029. for (var i = 0, l = list.length; i < l; i++) {
  69030. var shape = list[i];
  69031. if (currentZLevel !== shape.zlevel) {
  69032. if (currentLayer && currentLayer.needTransform) {
  69033. ctx.restore();
  69034. }
  69035. currentLayer = this.getLayer(shape.zlevel);
  69036. ctx = currentLayer.ctx;
  69037. currentZLevel = shape.zlevel;
  69038. // Reset the count
  69039. currentLayer.unusedCount = 0;
  69040. if (currentLayer.dirty || paintAll) {
  69041. currentLayer.clear();
  69042. }
  69043. if (currentLayer.needTransform) {
  69044. ctx.save();
  69045. currentLayer.setTransform(ctx);
  69046. }
  69047. }
  69048. // Start group clipping
  69049. if (ctx && shape.__startClip) {
  69050. var clipShape = shape.__startClip;
  69051. ctx.save();
  69052. // Set transform
  69053. if (clipShape.needTransform) {
  69054. let m = clipShape.transform;
  69055. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  69056. ctx.transform(
  69057. m[0], m[1],
  69058. m[2], m[3],
  69059. m[4], m[5]
  69060. );
  69061. }
  69062. ctx.beginPath();
  69063. clipShape.buildPath(ctx, clipShape.style);
  69064. ctx.clip();
  69065. // Transform back
  69066. if (clipShape.needTransform) {
  69067. let m = invTransform;
  69068. ctx.transform(
  69069. m[0], m[1],
  69070. m[2], m[3],
  69071. m[4], m[5]
  69072. );
  69073. }
  69074. }
  69075. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  69076. if (
  69077. !shape.onbrush
  69078. || (shape.onbrush && !shape.onbrush(ctx, false))
  69079. ) {
  69080. if (Config.catchBrushException) {
  69081. try {
  69082. shape.brush(ctx, false, this.updatePainter);
  69083. } catch (error) {
  69084. SUtil_SUtil.Util_log(
  69085. error,
  69086. 'brush error of ' + shape.type,
  69087. shape
  69088. );
  69089. }
  69090. } else {
  69091. shape.brush(ctx, false, this.updatePainter);
  69092. }
  69093. }
  69094. }
  69095. // Stop group clipping
  69096. if (ctx && shape.__stopClip) {
  69097. ctx.restore();
  69098. }
  69099. shape.__dirty = false;
  69100. }
  69101. if (ctx && currentLayer && currentLayer.needTransform) {
  69102. ctx.restore();
  69103. }
  69104. for (let id in this._layers) {
  69105. if (id !== 'hover') {
  69106. var layer = this._layers[id];
  69107. layer.dirty = false;
  69108. // 删除过期的层
  69109. // PENDING
  69110. // if (layer.unusedCount >= 500) {
  69111. // this.delLayer(id);
  69112. // }
  69113. if (layer.unusedCount == 1) {
  69114. layer.clear();
  69115. }
  69116. }
  69117. }
  69118. }
  69119. /**
  69120. * @function LevelRenderer.Painter.prototype.getLayer
  69121. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  69122. *
  69123. * @param {number} zlevel - zlevel。
  69124. * @return {LevelRenderer.Painter} this。
  69125. */
  69126. getLayer(zlevel) {
  69127. // Change draw layer
  69128. var currentLayer = this._layers[zlevel];
  69129. if (!currentLayer) {
  69130. var len = this._zlevelList.length;
  69131. var prevLayer = null;
  69132. var i = -1;
  69133. if (len > 0 && zlevel > this._zlevelList[0]) {
  69134. for (i = 0; i < len - 1; i++) {
  69135. if (
  69136. this._zlevelList[i] < zlevel
  69137. && this._zlevelList[i + 1] > zlevel
  69138. ) {
  69139. break;
  69140. }
  69141. }
  69142. prevLayer = this._layers[this._zlevelList[i]];
  69143. }
  69144. this._zlevelList.splice(i + 1, 0, zlevel);
  69145. // Create a new layer
  69146. //currentLayer = new PaintLayer(zlevel, this);
  69147. currentLayer = new PaintLayer(Util_Util.createUniqueID("_levelLayer_" + zlevel), this);
  69148. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  69149. if (prevDom.nextSibling) {
  69150. prevDom.parentNode.insertBefore(
  69151. currentLayer.dom,
  69152. prevDom.nextSibling
  69153. );
  69154. } else {
  69155. prevDom.parentNode.appendChild(
  69156. currentLayer.dom
  69157. );
  69158. }
  69159. currentLayer.initContext();
  69160. this._layers[zlevel] = currentLayer;
  69161. if (this._layerConfig[zlevel]) {
  69162. new levelRenderer_Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  69163. }
  69164. currentLayer.updateTransform();
  69165. }
  69166. return currentLayer;
  69167. }
  69168. /**
  69169. * @function LevelRenderer.Painter.prototype.getLayers
  69170. * @description 获取所有已创建的层。
  69171. * @return {Array.<Painter.Layer>} 已创建的层
  69172. */
  69173. getLayers() {
  69174. return this._layers;
  69175. }
  69176. /**
  69177. * Method: _updateLayerStatus
  69178. * 更新绘制层状态。
  69179. */
  69180. _updateLayerStatus(list) {
  69181. var layers = this._layers;
  69182. var elCounts = {};
  69183. for (let z in layers) {
  69184. if (z !== 'hover') {
  69185. elCounts[z] = layers[z].elCount;
  69186. layers[z].elCount = 0;
  69187. }
  69188. }
  69189. for (let i = 0; i < list.length; i++) {
  69190. var shape = list[i];
  69191. var zlevel = shape.zlevel;
  69192. var layer = layers[zlevel];
  69193. if (layer) {
  69194. layer.elCount++;
  69195. // 已经被标记为需要刷新
  69196. if (layer.dirty) {
  69197. continue;
  69198. }
  69199. layer.dirty = shape.__dirty;
  69200. }
  69201. }
  69202. // 层中的元素数量有发生变化
  69203. for (let z in layers) {
  69204. if (z !== 'hover') {
  69205. if (elCounts[z] !== layers[z].elCount) {
  69206. layers[z].dirty = true;
  69207. }
  69208. }
  69209. }
  69210. }
  69211. /**
  69212. * @function LevelRenderer.Painter.prototype.refreshShapes
  69213. * @description 更新的图形元素列表。
  69214. *
  69215. * @param {number} shapeList - 需要更新的图形元素列表。
  69216. * @param {number} callback - 视图更新后回调函数。
  69217. * @return {LevelRenderer.Painter} this。
  69218. */
  69219. refreshShapes(shapeList, callback) {
  69220. for (var i = 0, l = shapeList.length; i < l; i++) {
  69221. var shape = shapeList[i];
  69222. this.storage.mod(shape.id);
  69223. }
  69224. this.refresh(callback);
  69225. return this;
  69226. }
  69227. /**
  69228. * @function LevelRenderer.Painter.prototype.clear
  69229. * @description 清除 hover 层外所有内容。
  69230. * @return {LevelRenderer.Painter} this。
  69231. */
  69232. clear() {
  69233. for (var k in this._layers) {
  69234. if (k == 'hover') {
  69235. continue;
  69236. }
  69237. this._layers[k].clear();
  69238. }
  69239. return this;
  69240. }
  69241. /**
  69242. * @function LevelRenderer.Painter.prototype.modLayer
  69243. * @description 修改指定 zlevel 的绘制参数。
  69244. *
  69245. * @param {string} zlevel - zlevel。
  69246. * @param {Object} config - 配置对象。
  69247. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  69248. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  69249. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  69250. * @param {Array.<number>} config.position - 层的平移。
  69251. * @param {Array.<number>} config.rotation - 层的旋转。
  69252. * @param {Array.<number>} config.scale - 层的缩放。
  69253. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  69254. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  69255. *
  69256. */
  69257. modLayer(zlevel, config) {
  69258. if (config) {
  69259. if (!this._layerConfig[zlevel]) {
  69260. this._layerConfig[zlevel] = config;
  69261. } else {
  69262. new levelRenderer_Util_Util().merge(this._layerConfig[zlevel], config, true);
  69263. }
  69264. var layer = this._layers[zlevel];
  69265. if (layer) {
  69266. new levelRenderer_Util_Util().merge(layer, this._layerConfig[zlevel], true);
  69267. }
  69268. }
  69269. }
  69270. /**
  69271. * @function LevelRenderer.Painter.prototype.delLayer
  69272. * @description 删除指定层。
  69273. *
  69274. * @param {string} zlevel - 层所在的 zlevel。
  69275. */
  69276. delLayer(zlevel) {
  69277. var layer = this._layers[zlevel];
  69278. if (!layer) {
  69279. return;
  69280. }
  69281. // Save config
  69282. this.modLayer(zlevel, {
  69283. position: layer.position,
  69284. rotation: layer.rotation,
  69285. scale: layer.scale
  69286. });
  69287. layer.dom.parentNode.removeChild(layer.dom);
  69288. delete this._layers[zlevel];
  69289. this._zlevelList.splice(new levelRenderer_Util_Util().indexOf(this._zlevelList, zlevel), 1);
  69290. }
  69291. /**
  69292. * @function LevelRenderer.Painter.prototype.refreshHover
  69293. * @description 刷新 hover 层。
  69294. * @return {LevelRenderer.Painter} this。
  69295. */
  69296. refreshHover() {
  69297. this.clearHover();
  69298. var list = this.storage.getHoverShapes(true);
  69299. for (var i = 0, l = list.length; i < l; i++) {
  69300. this._brushHover(list[i]);
  69301. }
  69302. this.storage.delHover();
  69303. return this;
  69304. }
  69305. /**
  69306. * @function LevelRenderer.Painter.prototype.clearHover
  69307. * @description 清除 hover 层所有内容。
  69308. * @return {LevelRenderer.Painter} this。
  69309. */
  69310. clearHover() {
  69311. var hover = this._layers.hover;
  69312. hover && hover.clear();
  69313. return this;
  69314. }
  69315. /**
  69316. * @function LevelRenderer.Painter.prototype.resize
  69317. * @description 区域大小变化后重绘。
  69318. * @return {LevelRenderer.Painter} this。
  69319. */
  69320. resize() {
  69321. var domRoot = this._domRoot;
  69322. domRoot.style.display = 'none';
  69323. var width = this._getWidth();
  69324. var height = this._getHeight();
  69325. domRoot.style.display = '';
  69326. // 优化没有实际改变的resize
  69327. if (this._width != width || height != this._height) {
  69328. this._width = width;
  69329. this._height = height;
  69330. domRoot.style.width = width + 'px';
  69331. domRoot.style.height = height + 'px';
  69332. for (var id in this._layers) {
  69333. this._layers[id].resize(width, height);
  69334. }
  69335. this.refresh(null, true);
  69336. }
  69337. return this;
  69338. }
  69339. /**
  69340. * @function LevelRenderer.Painter.prototype.clearLayer
  69341. * @description 清除指定的一个层。
  69342. * @param {number} zLevel - 层。
  69343. */
  69344. clearLayer(zLevel) {
  69345. var layer = this._layers[zLevel];
  69346. if (layer) {
  69347. layer.clear();
  69348. }
  69349. }
  69350. /**
  69351. * @function LevelRenderer.Painter.prototype.dispose
  69352. * @description 释放。
  69353. *
  69354. */
  69355. dispose() {
  69356. this.root.innerHTML = '';
  69357. this.root = null;
  69358. this.storage = null;
  69359. this._domRoot = null;
  69360. this._layers = null;
  69361. }
  69362. /**
  69363. * @function LevelRenderer.Painter.prototype.getDomHover
  69364. * @description 获取 Hover 层的 Dom。
  69365. */
  69366. getDomHover() {
  69367. return this._layers.hover.dom;
  69368. }
  69369. /**
  69370. * @function LevelRenderer.Painter.prototype.toDataURL
  69371. * @description 图像导出。
  69372. * @param {string} type - 图片类型。
  69373. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  69374. * @param {Object} args
  69375. * @return {string} 图片的Base64 url。
  69376. */
  69377. toDataURL(type, backgroundColor, args) {
  69378. //var imageDom = Painter.createDom('image', 'canvas', this);
  69379. var imageDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  69380. this._bgDom.appendChild(imageDom);
  69381. var ctx = imageDom.getContext('2d');
  69382. Painter.devicePixelRatio != 1
  69383. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  69384. ctx.fillStyle = backgroundColor || '#fff';
  69385. ctx.rect(
  69386. 0, 0,
  69387. this._width * Painter.devicePixelRatio,
  69388. this._height * Painter.devicePixelRatio
  69389. );
  69390. ctx.fill();
  69391. var self = this;
  69392. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  69393. this.storage.iterShape(
  69394. function (shape) {
  69395. if (!shape.invisible) {
  69396. if (!shape.onbrush // 没有onbrush
  69397. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  69398. || (shape.onbrush && !shape.onbrush(ctx, false))
  69399. ) {
  69400. if (Config.catchBrushException) {
  69401. try {
  69402. shape.brush(ctx, false, self.updatePainter);
  69403. } catch (error) {
  69404. SUtil_SUtil.Util_log(
  69405. error,
  69406. 'brush error of ' + shape.type,
  69407. shape
  69408. );
  69409. }
  69410. } else {
  69411. shape.brush(ctx, false, self.updatePainter);
  69412. }
  69413. }
  69414. }
  69415. },
  69416. {normal: 'up', update: true}
  69417. );
  69418. var image = imageDom.toDataURL(type, args);
  69419. ctx = null;
  69420. this._bgDom.removeChild(imageDom);
  69421. return image;
  69422. }
  69423. /**
  69424. * @function LevelRenderer.Painter.prototype.getWidth
  69425. * @description 获取绘图区域宽度。
  69426. * @return {number} 绘图区域宽度。
  69427. */
  69428. getWidth() {
  69429. return this._width;
  69430. }
  69431. /**
  69432. * @function LevelRenderer.Painter.prototype.getHeight
  69433. * @description 获取绘图区域高度。
  69434. * @return {number} 绘图区域高度。
  69435. */
  69436. getHeight() {
  69437. return this._height;
  69438. }
  69439. /**
  69440. * Method: _getWidth
  69441. *
  69442. */
  69443. _getWidth() {
  69444. var root = this.root;
  69445. var stl = root.currentStyle
  69446. || document.defaultView.getComputedStyle(root);
  69447. return ((root.clientWidth || parseInt(stl.width, 10))
  69448. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  69449. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  69450. }
  69451. /**
  69452. * Method: _getHeight
  69453. *
  69454. */
  69455. _getHeight() {
  69456. var root = this.root;
  69457. var stl = root.currentStyle
  69458. || document.defaultView.getComputedStyle(root);
  69459. return ((root.clientHeight || parseInt(stl.height, 10))
  69460. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  69461. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  69462. }
  69463. /**
  69464. * Method: _brushHover
  69465. *
  69466. */
  69467. _brushHover(shape) {
  69468. var ctx = this._layers.hover.ctx;
  69469. if (!shape.onbrush // 没有onbrush
  69470. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  69471. || (shape.onbrush && !shape.onbrush(ctx, true))
  69472. ) {
  69473. var layer = this.getLayer(shape.zlevel);
  69474. if (layer.needTransform) {
  69475. ctx.save();
  69476. layer.setTransform(ctx);
  69477. }
  69478. // Retina 优化
  69479. if (Config.catchBrushException) {
  69480. try {
  69481. shape.brush(ctx, true, this.updatePainter);
  69482. } catch (error) {
  69483. SUtil_SUtil.Util_log(
  69484. error, 'hoverBrush error of ' + shape.type, shape
  69485. );
  69486. }
  69487. } else {
  69488. shape.brush(ctx, true, this.updatePainter);
  69489. }
  69490. if (layer.needTransform) {
  69491. ctx.restore();
  69492. }
  69493. }
  69494. }
  69495. /**
  69496. * Method: _shapeToImage
  69497. *
  69498. */
  69499. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  69500. var canvas = document.createElement('canvas');
  69501. var ctx = canvas.getContext('2d');
  69502. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  69503. canvas.style.width = width + 'px';
  69504. canvas.style.height = height + 'px';
  69505. canvas.setAttribute('width', width * _devicePixelRatio);
  69506. canvas.setAttribute('height', height * _devicePixelRatio);
  69507. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  69508. var shapeTransform = {
  69509. position: shape.position,
  69510. rotation: shape.rotation,
  69511. scale: shape.scale
  69512. };
  69513. shape.position = [0, 0, 0];
  69514. shape.rotation = 0;
  69515. shape.scale = [1, 1];
  69516. if (shape) {
  69517. shape.brush(ctx, false);
  69518. }
  69519. var imgShape = new SmicImage({
  69520. id: id,
  69521. style: {
  69522. x: 0,
  69523. y: 0,
  69524. image: canvas
  69525. }
  69526. });
  69527. if (shapeTransform.position != null) {
  69528. imgShape.position = shape.position = shapeTransform.position;
  69529. }
  69530. if (shapeTransform.rotation != null) {
  69531. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  69532. }
  69533. if (shapeTransform.scale != null) {
  69534. imgShape.scale = shape.scale = shapeTransform.scale;
  69535. }
  69536. return imgShape;
  69537. }
  69538. /**
  69539. * Method: _createShapeToImageProcessor
  69540. *
  69541. */
  69542. _createShapeToImageProcessor() {
  69543. var me = this;
  69544. return function (id, e, width, height) {
  69545. return me._shapeToImage(
  69546. id, e, width, height, Painter.devicePixelRatio
  69547. );
  69548. };
  69549. }
  69550. // SMIC-方法扩展 - start
  69551. /**
  69552. * @function LevelRenderer.Painter.prototype.updateHoverLayer
  69553. * @description 更新设置显示高亮图层。
  69554. * @param {Array} shapes - 图形数组。
  69555. */
  69556. updateHoverLayer(shapes) {
  69557. if (!(shapes instanceof Array)) {
  69558. return this;
  69559. }
  69560. //清除高亮
  69561. this.clearHover();
  69562. this.storage.delHover();
  69563. for (var i = 0; i < shapes.length; i++) {
  69564. this.storage.addHover(shapes[i]);
  69565. this._brushHover(shapes[i]);
  69566. }
  69567. }
  69568. /**
  69569. * @function LevelRenderer.Painter.prototype.createDom
  69570. * @description 创建 Dom。
  69571. *
  69572. * @param {string} id - Dom id
  69573. * @param {string} type - Dom type
  69574. * @param {LevelRenderer.Painter} painter - Painter 实例。
  69575. * @return {Object} Dom
  69576. */
  69577. static createDom(id, type, painter) {
  69578. var newDom = document.createElement(type);
  69579. var width = painter._width;
  69580. var height = painter._height;
  69581. // 没append呢,请原谅我这样写,清晰~
  69582. newDom.style.position = 'absolute';
  69583. newDom.style.left = 0;
  69584. newDom.style.top = 0;
  69585. newDom.style.width = width + 'px';
  69586. newDom.style.height = height + 'px';
  69587. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  69588. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  69589. // id不作为索引用,避免可能造成的重名,定义为私有属性
  69590. //newDom.setAttribute('data-zr-dom-id', id);
  69591. newDom.setAttribute('id', id);
  69592. return newDom;
  69593. }
  69594. }
  69595. /**
  69596. * @private
  69597. * @class Painter.Layer
  69598. * @classdesc 绘制层类。
  69599. * @extends LevelRenderer.Transformable
  69600. */
  69601. class PaintLayer extends Transformable {
  69602. /**
  69603. * @function Painter.Layer.constructor
  69604. * @description 构造函数。
  69605. *
  69606. * @param {string} id - id。
  69607. * @param {LevelRenderer.Painter} painter - Painter 实例。
  69608. *
  69609. */
  69610. constructor(id, painter) {
  69611. super(id, painter);
  69612. /**
  69613. * @member {Object} Painter.Layer.prototype.dom
  69614. * @description dom。
  69615. */
  69616. this.dom = null;
  69617. /**
  69618. * @member {Object} Painter.Layer.prototype.domBack
  69619. * @description domBack。
  69620. */
  69621. this.domBack = null;
  69622. /**
  69623. * @member {Object} Painter.Layer.prototype.ctxBack
  69624. * @description ctxBack。
  69625. */
  69626. this.ctxBack = null;
  69627. /**
  69628. * @member {LevelRenderer.Painter} Painter.Layer.prototype.painter
  69629. * @description painter。
  69630. */
  69631. this.painter = painter;
  69632. /**
  69633. * @member {number} Painter.Layer.prototype.unusedCount
  69634. * @description unusedCount。
  69635. */
  69636. this.unusedCount = 0;
  69637. /**
  69638. * @member {Object} Painter.Layer.prototype.config
  69639. * @description config。
  69640. */
  69641. this.config = null;
  69642. /**
  69643. * @member {boolean} Painter.Layer.prototype.dirty
  69644. * @description dirty。
  69645. */
  69646. this.dirty = true;
  69647. /**
  69648. * @member {number} Painter.Layer.prototype.elCount
  69649. * @description elCount。
  69650. */
  69651. this.elCount = 0;
  69652. // Configs
  69653. /**
  69654. * @member {string} Painter.Layer.prototype.clearColor
  69655. * @description 每次清空画布的颜色。默认值:0;
  69656. */
  69657. this.clearColor = 0;
  69658. /**
  69659. * @member {boolean} Painter.Layer.prototype.motionBlur
  69660. * @description 是否开启动态模糊。默认值:false;
  69661. */
  69662. this.motionBlur = false;
  69663. /**
  69664. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  69665. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  69666. */
  69667. this.lastFrameAlpha = 0.7;
  69668. /**
  69669. * @member {boolean} Painter.Layer.prototype.zoomable
  69670. * @description 层是否支持鼠标平移操作。默认值:false;
  69671. */
  69672. this.zoomable = false;
  69673. /**
  69674. * @member {boolean} Painter.Layer.prototype.panable
  69675. * @description 层是否支持鼠标缩放操作。默认值:false;
  69676. */
  69677. this.panable = false;
  69678. /**
  69679. * @member {number} Painter.Layer.prototype.maxZoom
  69680. * @description maxZoom。默认值:Infinity。
  69681. */
  69682. this.maxZoom = Infinity;
  69683. /**
  69684. * @member {number} Painter.Layer.prototype.minZoom
  69685. * @description minZoom。默认值:0。
  69686. */
  69687. this.minZoom = 0;
  69688. /**
  69689. * @member {number} Painter.Layer.prototype.ctx
  69690. * @description Canvas 上下文。
  69691. */
  69692. this.ctx = null;
  69693. this.dom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  69694. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  69695. this.dom.style['-webkit-user-select'] = 'none';
  69696. this.dom.style['user-select'] = 'none';
  69697. this.dom.style['-webkit-touch-callout'] = 'none';
  69698. // Function
  69699. // 返回false的方法,用于避免页面被选中
  69700. function returnFalse() {
  69701. return false;
  69702. }
  69703. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  69704. }
  69705. /**
  69706. * @function Painter.Layer.prototype.destroy
  69707. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  69708. */
  69709. destroy() {
  69710. this.dom = null;
  69711. this.domBack = null;
  69712. this.ctxBack = null;
  69713. this.painter = null;
  69714. this.unusedCount = null;
  69715. this.config = null;
  69716. this.dirty = null;
  69717. this.elCount = null;
  69718. this.clearColor = null;
  69719. this.motionBlur = null;
  69720. this.lastFrameAlpha = null;
  69721. this.zoomable = null;
  69722. this.panable = null;
  69723. this.maxZoom = null;
  69724. this.minZoom = null;
  69725. this.ctx = null;
  69726. Transformable.destroy.apply(this, arguments);
  69727. }
  69728. /**
  69729. * @function Painter.Layer.prototype.initContext
  69730. * @description 初始化 Canvan 2D 上下文。
  69731. */
  69732. initContext() {
  69733. this.ctx = this.dom.getContext('2d');
  69734. if (Painter.devicePixelRatio != 1) {
  69735. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  69736. }
  69737. }
  69738. /**
  69739. * @function Painter.Layer.prototype.createBackBuffer
  69740. * @description 创建备份缓冲。
  69741. */
  69742. createBackBuffer() {
  69743. this.domBack = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  69744. this.ctxBack = this.domBack.getContext('2d');
  69745. if (Painter.devicePixelRatio != 1) {
  69746. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  69747. }
  69748. }
  69749. /**
  69750. * @function Painter.Layer.prototype.resize
  69751. * @description 改变大小。
  69752. *
  69753. * @param {number} width - 宽。
  69754. * @param {number} height - 高。
  69755. */
  69756. resize(width, height) {
  69757. this.dom.style.width = width + 'px';
  69758. this.dom.style.height = height + 'px';
  69759. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  69760. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  69761. if (Painter.devicePixelRatio != 1) {
  69762. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  69763. }
  69764. if (this.domBack) {
  69765. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  69766. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  69767. if (Painter.devicePixelRatio != 1) {
  69768. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  69769. }
  69770. }
  69771. }
  69772. /**
  69773. * @function Painter.Layer.prototype.clear
  69774. * @description 清空该层画布。
  69775. */
  69776. clear() {
  69777. var dom = this.dom;
  69778. var ctx = this.ctx;
  69779. var width = dom.width;
  69780. var height = dom.height;
  69781. var haveClearColor = this.clearColor;
  69782. var haveMotionBLur = this.motionBlur;
  69783. var lastFrameAlpha = this.lastFrameAlpha;
  69784. if (haveMotionBLur) {
  69785. if (!this.domBack) {
  69786. this.createBackBuffer();
  69787. }
  69788. this.ctxBack.globalCompositeOperation = 'copy';
  69789. this.ctxBack.drawImage(
  69790. dom, 0, 0,
  69791. width / Painter.devicePixelRatio,
  69792. height / Painter.devicePixelRatio
  69793. );
  69794. }
  69795. if (haveClearColor) {
  69796. ctx.save();
  69797. ctx.fillStyle = this.config.clearColor;
  69798. ctx.fillRect(
  69799. 0, 0,
  69800. width / Painter.devicePixelRatio,
  69801. height / Painter.devicePixelRatio
  69802. );
  69803. ctx.restore();
  69804. } else {
  69805. ctx.clearRect(
  69806. 0, 0,
  69807. width / Painter.devicePixelRatio,
  69808. height / Painter.devicePixelRatio
  69809. );
  69810. }
  69811. if (haveMotionBLur) {
  69812. var domBack = this.domBack;
  69813. ctx.save();
  69814. ctx.globalAlpha = lastFrameAlpha;
  69815. ctx.drawImage(
  69816. domBack, 0, 0,
  69817. width / Painter.devicePixelRatio,
  69818. height / Painter.devicePixelRatio
  69819. );
  69820. ctx.restore();
  69821. }
  69822. }
  69823. }
  69824. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  69825. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69826. * This program are made available under the terms of the Apache License, Version 2.0
  69827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69828. /**
  69829. * @private
  69830. * @class LevelRenderer.Handler
  69831. * @category Visualization Theme
  69832. * @classdesc Handler控制模块。
  69833. * @extends {LevelRenderer.Eventful}
  69834. * @param {HTMLElement} root - 绘图区域。
  69835. * @param {LevelRenderer.Storage} storage - Storage 实例。
  69836. * @param {LevelRenderer.Painter} painter - Painter 实例。
  69837. */
  69838. class Handler extends Eventful {
  69839. constructor(root, storage, painter) {
  69840. super(root, storage, painter);
  69841. /**
  69842. * @member {HTMLElement} LevelRenderer.Handler.prototype.root
  69843. * @description 绘图区域
  69844. */
  69845. this.root = root;
  69846. /**
  69847. * @member {LevelRenderer.Storage} LevelRenderer.Handler.prototype.storage
  69848. * @description Storage 实例
  69849. */
  69850. this.storage = storage;
  69851. /**
  69852. * @member {LevelRenderer.Painter} LevelRenderer.Handler.prototype.Painter
  69853. * @description Painter 实例
  69854. */
  69855. this.painter = painter;
  69856. /**
  69857. * @member {number} [LevelRenderer.Handler.prototype._lastX=0]
  69858. * @description 上一次鼠标位置x坐标值
  69859. */
  69860. this._lastX = 0;
  69861. /**
  69862. * @member {number} [LevelRenderer.Handler.prototype._lastY=0]
  69863. * @description 上一次鼠标位置y坐标值
  69864. */
  69865. this._lastY = 0;
  69866. /**
  69867. * @member {number} [LevelRenderer.Handler.prototype._mouseX=0]
  69868. * @description 当前鼠标位置x坐标值
  69869. */
  69870. this._mouseX = 0;
  69871. /**
  69872. * @member {number} [LevelRenderer.Handler.prototype._mouseY=0]
  69873. * @description 当前鼠标位置y坐标值
  69874. */
  69875. this._mouseY = 0;
  69876. /**
  69877. * @member {function} LevelRenderer.Handler.prototype._findHover
  69878. * @description 查找 Hover 图形
  69879. */
  69880. this._findHover = null;
  69881. /**
  69882. * @member {Object} LevelRenderer.Handler.prototype._domHover
  69883. * @description 高亮 DOM
  69884. */
  69885. this._domHover = null;
  69886. // 各种事件标识的私有变量
  69887. // this._hasfound = false; // 是否找到 hover 图形元素
  69888. // this._lastHover = null; // 最后一个 hover 图形元素
  69889. // this._mouseDownTarget = null;
  69890. // this._draggingTarget = null; // 当前被拖拽的图形元素
  69891. // this._isMouseDown = false;
  69892. // this._isDragging = false;
  69893. // this._lastMouseDownMoment;
  69894. // this._lastTouchMoment;
  69895. // this._lastDownButton;
  69896. this._findHover = bind3Arg(findHover, this);
  69897. this._domHover = painter.getDomHover();
  69898. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  69899. var domHandlers = {
  69900. /**
  69901. * Method: resize
  69902. * 窗口大小改变响应函数。
  69903. *
  69904. * Parameters:
  69905. * event - {Event} event。
  69906. *
  69907. */
  69908. resize: function (event) {
  69909. event = event || window.event;
  69910. this._lastHover = null;
  69911. this._isMouseDown = 0;
  69912. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  69913. this.dispatch(Config.EVENT.RESIZE, event);
  69914. },
  69915. /**
  69916. * Method: click
  69917. * 点击响应函数。
  69918. *
  69919. * Parameters:
  69920. * event - {Event} event。
  69921. *
  69922. */
  69923. click: function (event) {
  69924. event = this._zrenderEventFixed(event);
  69925. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  69926. var _lastHover = this._lastHover;
  69927. if ((_lastHover && _lastHover.clickable)
  69928. || !_lastHover
  69929. ) {
  69930. // 判断没有发生拖拽才触发click事件
  69931. if (this._clickThreshold < 10) {
  69932. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  69933. }
  69934. }
  69935. this._mousemoveHandler(event);
  69936. },
  69937. /**
  69938. * Method: dblclick
  69939. * 双击响应函数。
  69940. *
  69941. * Parameters:
  69942. * event - {Event} event。
  69943. *
  69944. */
  69945. dblclick: function (event) {
  69946. event = event || window.event;
  69947. event = this._zrenderEventFixed(event);
  69948. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  69949. var _lastHover = this._lastHover;
  69950. if ((_lastHover && _lastHover.clickable)
  69951. || !_lastHover
  69952. ) {
  69953. // 判断没有发生拖拽才触发dblclick事件
  69954. if (this._clickThreshold < 5) {
  69955. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  69956. }
  69957. }
  69958. this._mousemoveHandler(event);
  69959. },
  69960. /**
  69961. * Method: mousewheel
  69962. * 鼠标滚轮响应函数。
  69963. *
  69964. * Parameters:
  69965. * event - {Event} event。
  69966. *
  69967. */
  69968. mousewheel: function (event) {
  69969. event = this._zrenderEventFixed(event);
  69970. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  69971. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  69972. var delta = event.wheelDelta // Webkit
  69973. || -event.detail; // Firefox
  69974. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  69975. var layers = this.painter.getLayers();
  69976. var needsRefresh = false;
  69977. for (var z in layers) {
  69978. if (z !== 'hover') {
  69979. var layer = layers[z];
  69980. var pos = layer.position;
  69981. if (layer.zoomable) {
  69982. layer.__zoom = layer.__zoom || 1;
  69983. var newZoom = layer.__zoom;
  69984. newZoom *= scale;
  69985. newZoom = Math.max(
  69986. Math.min(layer.maxZoom, newZoom),
  69987. layer.minZoom
  69988. );
  69989. scale = newZoom / layer.__zoom;
  69990. layer.__zoom = newZoom;
  69991. // Keep the mouse center when scaling
  69992. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  69993. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  69994. layer.scale[0] *= scale;
  69995. layer.scale[1] *= scale;
  69996. layer.dirty = true;
  69997. needsRefresh = true;
  69998. }
  69999. }
  70000. }
  70001. if (needsRefresh) {
  70002. this.painter.refresh();
  70003. }
  70004. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  70005. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  70006. this._mousemoveHandler(event);
  70007. },
  70008. /**
  70009. * Method: mousemove
  70010. * 鼠标(手指)移动响应函数。
  70011. *
  70012. * Parameters:
  70013. * event - {Event} event。
  70014. *
  70015. */
  70016. mousemove: function (event) {
  70017. // 拖拽不触发click事件
  70018. this._clickThreshold++;
  70019. event = this._zrenderEventFixed(event);
  70020. this._lastX = this._mouseX;
  70021. this._lastY = this._mouseY;
  70022. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  70023. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  70024. var dx = this._mouseX - this._lastX;
  70025. var dy = this._mouseY - this._lastY;
  70026. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  70027. // 避免手抖点击误认为拖拽
  70028. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  70029. this._processDragStart(event);
  70030. // }
  70031. this._hasfound = 0;
  70032. this._event = event;
  70033. this._iterateAndFindHover();
  70034. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  70035. if (!this._hasfound) {
  70036. // 过滤首次拖拽产生的mouseout和dragLeave
  70037. if (!this._draggingTarget
  70038. || (this._lastHover && this._lastHover != this._draggingTarget)
  70039. ) {
  70040. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  70041. this._processOutShape(event);
  70042. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  70043. this._processDragLeave(event);
  70044. }
  70045. this._lastHover = null;
  70046. this.storage.delHover();
  70047. this.painter.clearHover();
  70048. }
  70049. // set cursor for root element
  70050. var cursor = '';
  70051. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  70052. if (this._draggingTarget) {
  70053. this.storage.drift(this._draggingTarget.id, dx, dy);
  70054. this._draggingTarget.modSelf();
  70055. this.storage.addHover(this._draggingTarget);
  70056. } else if (this._isMouseDown) {
  70057. // Layer dragging
  70058. var layers = this.painter.getLayers();
  70059. var needsRefresh = false;
  70060. for (var z in layers) {
  70061. if (z !== 'hover') {
  70062. var layer = layers[z];
  70063. if (layer.panable) {
  70064. // PENDING
  70065. cursor = 'move';
  70066. // Keep the mouse center when scaling
  70067. layer.position[0] += dx;
  70068. layer.position[1] += dy;
  70069. needsRefresh = true;
  70070. layer.dirty = true;
  70071. }
  70072. }
  70073. }
  70074. if (needsRefresh) {
  70075. this.painter.refresh();
  70076. }
  70077. }
  70078. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  70079. cursor = 'move';
  70080. } else if (this._hasfound && this._lastHover.clickable) {
  70081. cursor = 'pointer';
  70082. }
  70083. this.root.style.cursor = cursor;
  70084. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  70085. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  70086. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  70087. this.painter.refreshHover();
  70088. }
  70089. },
  70090. /**
  70091. * Method: mouseout
  70092. * 鼠标(手指)离开响应函数。
  70093. *
  70094. * Parameters:
  70095. * event - {Event} event。
  70096. *
  70097. */
  70098. mouseout: function (event) {
  70099. event = this._zrenderEventFixed(event);
  70100. var element = event.toElement || event.relatedTarget;
  70101. if (element != this.root) {
  70102. while (element && element.nodeType != 9) {
  70103. // 忽略包含在root中的dom引起的mouseOut
  70104. if (element == this.root) {
  70105. this._mousemoveHandler(event);
  70106. return;
  70107. }
  70108. element = element.parentNode;
  70109. }
  70110. }
  70111. event.zrenderX = this._lastX;
  70112. event.zrenderY = this._lastY;
  70113. this.root.style.cursor = '';
  70114. this._isMouseDown = 0;
  70115. this._processOutShape(event);
  70116. this._processDrop(event);
  70117. this._processDragEnd(event);
  70118. this.painter.refreshHover();
  70119. this.dispatch(Config.EVENT.GLOBALOUT, event);
  70120. },
  70121. /**
  70122. * Method: mousedown
  70123. * 鼠标(手指)按下响应函数。
  70124. *
  70125. * Parameters:
  70126. * event - {Event} event。
  70127. *
  70128. */
  70129. mousedown: function (event) {
  70130. // 重置 clickThreshold
  70131. this._clickThreshold = 0;
  70132. if (this._lastDownButton == 2) {
  70133. this._lastDownButton = event.button;
  70134. this._mouseDownTarget = null;
  70135. // 仅作为关闭右键菜单使用
  70136. return;
  70137. }
  70138. this._lastMouseDownMoment = new Date();
  70139. event = this._zrenderEventFixed(event);
  70140. this._isMouseDown = 1;
  70141. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  70142. this._mouseDownTarget = this._lastHover;
  70143. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  70144. this._lastDownButton = event.button;
  70145. },
  70146. /**
  70147. * Method: mouseup
  70148. * 鼠标(手指)抬起响应函数。
  70149. *
  70150. * Parameters:
  70151. * event - {Event} event。
  70152. *
  70153. */
  70154. mouseup: function (event) {
  70155. event = this._zrenderEventFixed(event);
  70156. this.root.style.cursor = '';
  70157. this._isMouseDown = 0;
  70158. this._mouseDownTarget = null;
  70159. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  70160. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  70161. this._processDrop(event);
  70162. this._processDragEnd(event);
  70163. },
  70164. /**
  70165. * Method: touchstart
  70166. * Touch 开始响应函数。
  70167. *
  70168. * Parameters:
  70169. * event - {Event} event。
  70170. *
  70171. */
  70172. touchstart: function (event) {
  70173. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  70174. event = this._zrenderEventFixed(event, true);
  70175. this._lastTouchMoment = new Date();
  70176. // 平板补充一次findHover
  70177. this._mobildFindFixed(event);
  70178. this._mousedownHandler(event);
  70179. },
  70180. /**
  70181. * Method: touchmove
  70182. * Touch 移动响应函数。
  70183. *
  70184. * Parameters:
  70185. * event - {Event} event。
  70186. *
  70187. */
  70188. touchmove: function (event) {
  70189. event = this._zrenderEventFixed(event, true);
  70190. this._mousemoveHandler(event);
  70191. if (this._isDragging) {
  70192. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  70193. }
  70194. },
  70195. /**
  70196. * Method: touchend
  70197. * Touch 结束响应函数。
  70198. *
  70199. * Parameters:
  70200. * event - {Event} event。
  70201. *
  70202. */
  70203. touchend: function (event) {
  70204. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  70205. event = this._zrenderEventFixed(event, true);
  70206. this._mouseupHandler(event);
  70207. var now = new Date();
  70208. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  70209. this._mobildFindFixed(event);
  70210. this._clickHandler(event);
  70211. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  70212. this._dblclickHandler(event);
  70213. if (this._lastHover && this._lastHover.clickable) {
  70214. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  70215. }
  70216. }
  70217. this._lastClickMoment = now;
  70218. }
  70219. this.painter.clearHover();
  70220. }
  70221. };
  70222. initDomHandler(this);
  70223. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  70224. if (window.addEventListener) {
  70225. window.addEventListener('resize', this._resizeHandler);
  70226. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  70227. // mobile支持
  70228. root.addEventListener('touchstart', this._touchstartHandler);
  70229. root.addEventListener('touchmove', this._touchmoveHandler);
  70230. root.addEventListener('touchend', this._touchendHandler);
  70231. } else {
  70232. // mobile的click/move/up/down自己模拟
  70233. root.addEventListener('click', this._clickHandler);
  70234. root.addEventListener('dblclick', this._dblclickHandler);
  70235. root.addEventListener('mousewheel', this._mousewheelHandler);
  70236. root.addEventListener('mousemove', this._mousemoveHandler);
  70237. root.addEventListener('mousedown', this._mousedownHandler);
  70238. root.addEventListener('mouseup', this._mouseupHandler);
  70239. }
  70240. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  70241. root.addEventListener('mouseout', this._mouseoutHandler);
  70242. } else {
  70243. window.attachEvent('onresize', this._resizeHandler);
  70244. root.attachEvent('onclick', this._clickHandler);
  70245. //root.attachEvent('ondblclick ', this._dblclickHandler);
  70246. root.ondblclick = this._dblclickHandler;
  70247. root.attachEvent('onmousewheel', this._mousewheelHandler);
  70248. root.attachEvent('onmousemove', this._mousemoveHandler);
  70249. root.attachEvent('onmouseout', this._mouseoutHandler);
  70250. root.attachEvent('onmousedown', this._mousedownHandler);
  70251. root.attachEvent('onmouseup', this._mouseupHandler);
  70252. }
  70253. // 辅助函数 start
  70254. /**
  70255. * Method: bind1Arg
  70256. * bind 一个参数的 function。
  70257. *
  70258. * Parameters:
  70259. * handler - {function} 要 bind 的 function。
  70260. * context - {Object} 运行时 this 环境。
  70261. *
  70262. * Returns:
  70263. * {function}
  70264. */
  70265. function bind1Arg(handler, context) {
  70266. return function (e) {
  70267. return handler.call(context, e);
  70268. };
  70269. }
  70270. /*
  70271. // bind 两个参数的 function
  70272. function bind2Arg(handler, context) {
  70273. return function (arg1, arg2) {
  70274. return handler.call(context, arg1, arg2);
  70275. };
  70276. }
  70277. */
  70278. // bind 三个参数的 function
  70279. function bind3Arg(handler, context) {
  70280. return function (arg1, arg2, arg3) {
  70281. return handler.call(context, arg1, arg2, arg3);
  70282. };
  70283. }
  70284. /**
  70285. * Method: initDomHandler
  70286. * 为控制类实例初始化 dom 事件处理函数。
  70287. *
  70288. * Parameters:
  70289. * instance - {<LevelRenderer.Handler>} 控制类实例 。
  70290. *
  70291. * Returns:
  70292. * {function}
  70293. */
  70294. function initDomHandler(instance) {
  70295. var domHandlerNames = [
  70296. 'resize', 'click', 'dblclick',
  70297. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  70298. 'touchstart', 'touchend', 'touchmove'
  70299. ];
  70300. var len = domHandlerNames.length;
  70301. while (len--) {
  70302. var name = domHandlerNames[len];
  70303. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  70304. }
  70305. }
  70306. /**
  70307. * Method: findHover
  70308. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  70309. *
  70310. * Parameters:
  70311. * shape - {Object} 图形。
  70312. * x - {number} 鼠标 x。
  70313. * y - {number} 鼠标 y。
  70314. *
  70315. * Returns:
  70316. * {boolean} 是否找到图形。
  70317. *
  70318. */
  70319. function findHover(shape, x, y) {
  70320. var me = this;
  70321. if (
  70322. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  70323. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  70324. ) {
  70325. return false;
  70326. }
  70327. var event = me._event;
  70328. if (shape.isCover(x, y)) {
  70329. if (shape.hoverable) {
  70330. // SMIC-修改 - start
  70331. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  70332. if (shape.refDataID) {
  70333. var fid = shape.refDataID;
  70334. //me.painter.clearHover();
  70335. //me.storage.delHover();
  70336. var hoverGroup = null;
  70337. if (shape.refDataHoverGroup) {
  70338. hoverGroup = shape.refDataHoverGroup;
  70339. }
  70340. //查找同一个用户数据 feature 的所有图形
  70341. var shapeList = me.storage._shapeList;
  70342. for (var i = 0, len = shapeList.length; i < len; i++) {
  70343. var si = shapeList[i];
  70344. if (si.refDataID && fid === si.refDataID) {
  70345. if (hoverGroup) {
  70346. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  70347. me.storage.addHover(si);
  70348. }
  70349. } else {
  70350. me.storage.addHover(si);
  70351. }
  70352. }
  70353. }
  70354. }
  70355. } else {
  70356. me.storage.addHover(shape);
  70357. }
  70358. //初始代码:
  70359. // me.storage.addHover(shape);
  70360. // SMIC-修改 - end
  70361. }
  70362. // 查找是否在 clipShape 中
  70363. var p = shape.parent;
  70364. while (p) {
  70365. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  70366. // 已经被祖先 clip 掉了
  70367. return false;
  70368. }
  70369. p = p.parent;
  70370. }
  70371. if (me._lastHover != shape) {
  70372. me._processOutShape(event);
  70373. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  70374. me._processDragLeave(event);
  70375. me._lastHover = shape;
  70376. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  70377. me._processDragEnter(event);
  70378. }
  70379. me._processOverShape(event);
  70380. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  70381. me._processDragOver(event);
  70382. me._hasfound = 1;
  70383. return true; // 找到则中断迭代查找
  70384. }
  70385. return false;
  70386. }
  70387. // 辅助函数 end
  70388. }
  70389. /**
  70390. * @function LevelRenderer.Handler.prototype.destroy
  70391. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  70392. */
  70393. destroy() {
  70394. this.dispose();
  70395. this._lastX = null;
  70396. this._lastY = null;
  70397. this._mouseX = null;
  70398. this._mouseY = null;
  70399. this._findHover = null;
  70400. Eventful.prototype.destroy.apply(this, arguments);
  70401. }
  70402. /**
  70403. * @function LevelRenderer.Handler.prototype.on
  70404. * @description 自定义事件绑定。
  70405. * @param {string} eventName - 事件名称,resize、hover、drag等。
  70406. * @param {function} handler - 响应函数。
  70407. * @returns {LevelRenderer.Handler} this。
  70408. */
  70409. on(eventName, handler) {
  70410. this.bind(eventName, handler);
  70411. return this;
  70412. }
  70413. /**
  70414. * @function LevelRenderer.Handler.prototype.un
  70415. * @description 自定义事件解除绑定。
  70416. * @param {string} eventName - 事件名称,resize、hover、drag等。
  70417. * @param {function} handler - 响应函数。
  70418. * @returns {LevelRenderer.Handler} this。
  70419. */
  70420. un(eventName, handler) {
  70421. this.unbind(eventName, handler);
  70422. return this;
  70423. }
  70424. /**
  70425. * @function LevelRenderer.Handler.prototype.trigger
  70426. * @description 事件触发。
  70427. * @param {string} eventName - 事件名称,resize、hover、drag等。
  70428. * @param {event} eventArgs - dom事件对象。
  70429. */
  70430. trigger(eventName, eventArgs) {
  70431. var EVENT = Config.EVENT;
  70432. switch (eventName) {
  70433. case EVENT.RESIZE:
  70434. case EVENT.CLICK:
  70435. case EVENT.DBLCLICK:
  70436. case EVENT.MOUSEWHEEL:
  70437. case EVENT.MOUSEMOVE:
  70438. case EVENT.MOUSEDOWN:
  70439. case EVENT.MOUSEUP:
  70440. case EVENT.MOUSEOUT:
  70441. this['_' + eventName + 'Handler'](eventArgs);
  70442. break;
  70443. }
  70444. }
  70445. /**
  70446. * @function LevelRenderer.Handler.prototype.dispose
  70447. * @description 释放,解绑所有事件。
  70448. */
  70449. dispose() {
  70450. var root = this.root;
  70451. if (window.removeEventListener) {
  70452. window.removeEventListener('resize', this._resizeHandler);
  70453. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  70454. // mobile支持
  70455. root.removeEventListener('touchstart', this._touchstartHandler);
  70456. root.removeEventListener('touchmove', this._touchmoveHandler);
  70457. root.removeEventListener('touchend', this._touchendHandler);
  70458. } else {
  70459. // mobile的click自己模拟
  70460. root.removeEventListener('click', this._clickHandler);
  70461. root.removeEventListener('dblclick', this._dblclickHandler);
  70462. root.removeEventListener('mousewheel', this._mousewheelHandler);
  70463. root.removeEventListener('mousemove', this._mousemoveHandler);
  70464. root.removeEventListener('mousedown', this._mousedownHandler);
  70465. root.removeEventListener('mouseup', this._mouseupHandler);
  70466. }
  70467. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  70468. root.removeEventListener('mouseout', this._mouseoutHandler);
  70469. } else {
  70470. window.detachEvent('onresize', this._resizeHandler);
  70471. root.detachEvent('onclick', this._clickHandler);
  70472. root.detachEvent('dblclick', this._dblclickHandler);
  70473. root.detachEvent('onmousewheel', this._mousewheelHandler);
  70474. root.detachEvent('onmousemove', this._mousemoveHandler);
  70475. root.detachEvent('onmouseout', this._mouseoutHandler);
  70476. root.detachEvent('onmousedown', this._mousedownHandler);
  70477. root.detachEvent('onmouseup', this._mouseupHandler);
  70478. }
  70479. this.root = null;
  70480. this._domHover = null;
  70481. this.storage = null;
  70482. this.painter = null;
  70483. this.un();
  70484. }
  70485. /**
  70486. * Method: _processDragStart
  70487. * 拖拽开始。
  70488. *
  70489. * Parameters:
  70490. * event - {Object} 事件对象。
  70491. *
  70492. */
  70493. _processDragStart(event) {
  70494. var _lastHover = this._lastHover;
  70495. if (this._isMouseDown
  70496. && _lastHover
  70497. && _lastHover.draggable
  70498. && !this._draggingTarget
  70499. && this._mouseDownTarget == _lastHover
  70500. ) {
  70501. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  70502. if (_lastHover.dragEnableTime &&
  70503. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  70504. ) {
  70505. return;
  70506. }
  70507. var _draggingTarget = _lastHover;
  70508. this._draggingTarget = _draggingTarget;
  70509. this._isDragging = 1;
  70510. _draggingTarget.invisible = true;
  70511. this.storage.mod(_draggingTarget.id);
  70512. // 分发 Config.EVENT.DRAGSTART事件
  70513. this._dispatchAgency(
  70514. _draggingTarget,
  70515. Config.EVENT.DRAGSTART,
  70516. event
  70517. );
  70518. this.painter.refresh();
  70519. }
  70520. }
  70521. /**
  70522. * Method: _processDragEnter
  70523. * 拖拽进入目标元素。
  70524. *
  70525. * Parameters:
  70526. * event - {Object} 事件对象。
  70527. *
  70528. */
  70529. _processDragEnter(event) {
  70530. if (this._draggingTarget) {
  70531. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  70532. this._dispatchAgency(
  70533. this._lastHover,
  70534. Config.EVENT.DRAGENTER,
  70535. event,
  70536. this._draggingTarget
  70537. );
  70538. }
  70539. }
  70540. /**
  70541. * Method: _processDragOver
  70542. * 拖拽在目标元素上移动。
  70543. *
  70544. * Parameters:
  70545. * event - {Object} 事件对象。
  70546. *
  70547. */
  70548. _processDragOver(event) {
  70549. if (this._draggingTarget) {
  70550. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  70551. this._dispatchAgency(
  70552. this._lastHover,
  70553. Config.EVENT.DRAGOVER,
  70554. event,
  70555. this._draggingTarget
  70556. );
  70557. }
  70558. }
  70559. /**
  70560. * Method: _processDragLeave
  70561. * 拖拽离开目标元素。
  70562. *
  70563. * Parameters:
  70564. * event - {Object} 事件对象。
  70565. *
  70566. */
  70567. _processDragLeave(event) {
  70568. if (this._draggingTarget) {
  70569. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  70570. this._dispatchAgency(
  70571. this._lastHover,
  70572. Config.EVENT.DRAGLEAVE,
  70573. event,
  70574. this._draggingTarget
  70575. );
  70576. }
  70577. }
  70578. /**
  70579. * Method: _processDrop
  70580. * 拖拽在目标元素上完成。
  70581. *
  70582. * Parameters:
  70583. * event - {Object} 事件对象。
  70584. *
  70585. */
  70586. _processDrop(event) {
  70587. if (this._draggingTarget) {
  70588. this._draggingTarget.invisible = false;
  70589. this.storage.mod(this._draggingTarget.id);
  70590. this.painter.refresh();
  70591. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  70592. this._dispatchAgency(
  70593. this._lastHover,
  70594. Config.EVENT.DROP,
  70595. event,
  70596. this._draggingTarget
  70597. );
  70598. }
  70599. }
  70600. /**
  70601. * Method: _processDragEnd
  70602. * 拖拽结束。
  70603. *
  70604. * Parameters:
  70605. * event - {Object} 事件对象。
  70606. *
  70607. */
  70608. _processDragEnd(event) {
  70609. if (this._draggingTarget) {
  70610. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  70611. this._dispatchAgency(
  70612. this._draggingTarget,
  70613. Config.EVENT.DRAGEND,
  70614. event
  70615. );
  70616. this._lastHover = null;
  70617. }
  70618. this._isDragging = 0;
  70619. this._draggingTarget = null;
  70620. }
  70621. /**
  70622. * Method: _processOverShape
  70623. * 鼠标在某个图形元素上移动。
  70624. *
  70625. * Parameters:
  70626. * event - {Object} 事件对象。
  70627. *
  70628. */
  70629. _processOverShape(event) {
  70630. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  70631. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  70632. }
  70633. /**
  70634. * Method: _processOutShape
  70635. * 鼠标离开某个图形元素。
  70636. *
  70637. * Parameters:
  70638. * event - {Object} 事件对象。
  70639. *
  70640. */
  70641. _processOutShape(event) {
  70642. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  70643. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  70644. }
  70645. /**
  70646. * Method: _dispatchAgency
  70647. * 鼠标离开某个图形元素。
  70648. *
  70649. * Parameters:
  70650. * targetShape - {Object} 目标图形元素。
  70651. * eventName - {Object} 事件名称。
  70652. * event - {Object} 事件对象。
  70653. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  70654. *
  70655. */
  70656. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  70657. var eventHandler = 'on' + eventName;
  70658. var eventPacket = {
  70659. type: eventName,
  70660. event: event,
  70661. target: targetShape,
  70662. cancelBubble: false
  70663. };
  70664. var el = targetShape;
  70665. if (draggedShape) {
  70666. eventPacket.dragged = draggedShape;
  70667. }
  70668. while (el) {
  70669. el[eventHandler]
  70670. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  70671. el.dispatch(eventName, eventPacket);
  70672. el = el.parent;
  70673. if (eventPacket.cancelBubble) {
  70674. break;
  70675. }
  70676. }
  70677. if (targetShape) {
  70678. // 冒泡到顶级 zrender 对象
  70679. if (!eventPacket.cancelBubble) {
  70680. this.dispatch(eventName, eventPacket);
  70681. }
  70682. } else if (!draggedShape) {
  70683. // 无hover目标,无拖拽对象,原生事件分发
  70684. this.dispatch(eventName, {
  70685. type: eventName,
  70686. event: event
  70687. });
  70688. }
  70689. }
  70690. /**
  70691. * Method: _iterateAndFindHover
  70692. * 迭代寻找 hover shape。
  70693. *
  70694. */
  70695. _iterateAndFindHover() {
  70696. var invTransform = SUtil_SUtil.Util_matrix.create();
  70697. var list = this.storage.getShapeList();
  70698. var currentZLevel;
  70699. var currentLayer;
  70700. var tmp = [0, 0];
  70701. for (var i = list.length - 1; i >= 0; i--) {
  70702. var shape = list[i];
  70703. if (currentZLevel !== shape.zlevel) {
  70704. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  70705. tmp[0] = this._mouseX;
  70706. tmp[1] = this._mouseY;
  70707. if (currentLayer.needTransform) {
  70708. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  70709. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  70710. }
  70711. }
  70712. if (this._findHover(shape, tmp[0], tmp[1])) {
  70713. break;
  70714. }
  70715. }
  70716. }
  70717. /**
  70718. * Method: _mobildFindFixed
  70719. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  70720. *
  70721. * Parameters:
  70722. * event - {Object} 事件对象。
  70723. *
  70724. */
  70725. _mobildFindFixed(event) {
  70726. // touch指尖错觉的尝试偏移量配置
  70727. var MOBILE_TOUCH_OFFSETS = [
  70728. {x: 10},
  70729. {x: -20},
  70730. {x: 10, y: 10},
  70731. {y: -20}
  70732. ];
  70733. this._lastHover = null;
  70734. this._mouseX = event.zrenderX;
  70735. this._mouseY = event.zrenderY;
  70736. this._event = event;
  70737. this._iterateAndFindHover();
  70738. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  70739. var offset = MOBILE_TOUCH_OFFSETS[i];
  70740. offset.x && (this._mouseX += offset.x);
  70741. offset.y && (this._mouseX += offset.y);
  70742. this._iterateAndFindHover();
  70743. }
  70744. if (this._lastHover) {
  70745. event.zrenderX = this._mouseX;
  70746. event.zrenderY = this._mouseY;
  70747. }
  70748. }
  70749. /**
  70750. * Method: _zrenderEventFixed
  70751. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  70752. *
  70753. * Parameters:
  70754. * event - {Object} 事件。
  70755. * isTouch - {boolean} 是否触摸。
  70756. *
  70757. */
  70758. _zrenderEventFixed(event, isTouch) {
  70759. if (event.zrenderFixed) {
  70760. return event;
  70761. }
  70762. if (!isTouch) {
  70763. event = event || window.event;
  70764. // 进入对象优先~
  70765. var target = event.toElement
  70766. || event.relatedTarget
  70767. || event.srcElement
  70768. || event.target;
  70769. if (target && target != this._domHover) {
  70770. event.zrenderX = (typeof event.offsetX != 'undefined'
  70771. ? event.offsetX
  70772. : event.layerX)
  70773. + target.offsetLeft;
  70774. event.zrenderY = (typeof event.offsetY != 'undefined'
  70775. ? event.offsetY
  70776. : event.layerY)
  70777. + target.offsetTop;
  70778. }
  70779. } else {
  70780. var touch = event.type != 'touchend'
  70781. ? event.targetTouches[0]
  70782. : event.changedTouches[0];
  70783. if (touch) {
  70784. var rBounding = this.root.getBoundingClientRect();
  70785. // touch事件坐标是全屏的~
  70786. event.zrenderX = touch.clientX - rBounding.left;
  70787. event.zrenderY = touch.clientY - rBounding.top;
  70788. }
  70789. }
  70790. event.zrenderFixed = 1;
  70791. return event;
  70792. }
  70793. // SMIC-方法扩展 - start
  70794. /**
  70795. * @function LevelRenderer.Handler.prototype.getLastHoverOne
  70796. * @description 获取单个高亮图形
  70797. */
  70798. getLastHoverOne() {
  70799. if (this._lastHover) {
  70800. return this._lastHover;
  70801. }
  70802. return null;
  70803. }
  70804. // SMIC-方法扩展 - end
  70805. }
  70806. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  70807. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70808. * This program are made available under the terms of the Apache License, Version 2.0
  70809. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70810. /**
  70811. * @class LevelRenderer.Animation.easing
  70812. * @category Visualization Theme
  70813. * @classdesc 缓动
  70814. * @private
  70815. */
  70816. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  70817. // http://sole.github.io/tween.js/examples/03_graphs.html
  70818. class Easing {
  70819. constructor() {
  70820. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  70821. }
  70822. /**
  70823. * @function LevelRenderer.Animation.easing.destroy
  70824. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70825. */
  70826. destroy() {
  70827. }
  70828. /**
  70829. * @function LevelRenderer.Animation.easing.Linear
  70830. * @description 线性缓动
  70831. * @param {number} k - 参数
  70832. * @return {number} 输入值
  70833. */
  70834. Linear(k) {
  70835. return k;
  70836. }
  70837. /**
  70838. * @function LevelRenderer.Animation.easing.QuadraticIn
  70839. * @description 二次方的缓动(t^2)
  70840. * @param {number} k - 参数
  70841. * @return {number} 二次方的缓动的值
  70842. */
  70843. QuadraticIn(k) {
  70844. return k * k;
  70845. }
  70846. /**
  70847. * @function LevelRenderer.Animation.easing.QuadraticOut
  70848. * @description 返回按二次方缓动退出的值
  70849. * @param {number} k - 参数
  70850. * @return {number} 按二次方缓动退出的值
  70851. */
  70852. QuadraticOut(k) {
  70853. return k * (2 - k);
  70854. }
  70855. /**
  70856. * @function LevelRenderer.Animation.easing.QuadraticInOut
  70857. * @description 返回按二次方缓动进入和退出的值
  70858. * @param {number} k - 参数
  70859. * @return {number} 按二次方缓动进入和退出的值
  70860. */
  70861. QuadraticInOut(k) {
  70862. if ((k *= 2) < 1) {
  70863. return 0.5 * k * k;
  70864. }
  70865. return -0.5 * (--k * (k - 2) - 1);
  70866. }
  70867. /**
  70868. * @function LevelRenderer.Animation.easing.CubicIn
  70869. * @description 三次方的缓动(t^3)
  70870. * @param {number} k - 参数
  70871. * @return {number} 按三次方缓动的值
  70872. */
  70873. CubicIn(k) {
  70874. return k * k * k;
  70875. }
  70876. /**
  70877. * @function LevelRenderer.Animation.easing.CubicOut
  70878. * @description 返回按三次方缓动退出的值
  70879. * @param {number} k - 参数
  70880. * @return {number} 按三次方缓动退出的值
  70881. */
  70882. CubicOut(k) {
  70883. return --k * k * k + 1;
  70884. }
  70885. /**
  70886. * @function LevelRenderer.Animation.easing.CubicInOut
  70887. * @description 返回按三次方缓动进入退出的值
  70888. * @param {number} k - 参数
  70889. * @return {number} 按三次方缓动进入退出的值
  70890. */
  70891. CubicInOut(k) {
  70892. if ((k *= 2) < 1) {
  70893. return 0.5 * k * k * k;
  70894. }
  70895. return 0.5 * ((k -= 2) * k * k + 2);
  70896. }
  70897. /**
  70898. * @function LevelRenderer.Animation.easing.QuarticIn
  70899. * @description 返回按四次方缓动进入的值
  70900. * @param {number} k - 参数
  70901. * @return {number} 按四次方缓动进入的值
  70902. */
  70903. QuarticIn(k) {
  70904. return k * k * k * k;
  70905. }
  70906. /**
  70907. * @function LevelRenderer.Animation.easing.QuarticOut
  70908. * @description 返回按四次方缓动退出的值
  70909. * @param {number} k - 参数
  70910. * @return {number} 按四次方缓动退出的值
  70911. */
  70912. QuarticOut(k) {
  70913. return 1 - (--k * k * k * k);
  70914. }
  70915. /**
  70916. * @function LevelRenderer.Animation.easing.QuarticInOut
  70917. * @description 返回按四次方缓动进入退出的值
  70918. * @param {number} k - 参数
  70919. * @return {number} 按四次方缓动进入退出的值
  70920. */
  70921. QuarticInOut(k) {
  70922. if ((k *= 2) < 1) {
  70923. return 0.5 * k * k * k * k;
  70924. }
  70925. return -0.5 * ((k -= 2) * k * k * k - 2);
  70926. }
  70927. // 五次方的缓动(t^5)
  70928. /**
  70929. * @function LevelRenderer.Animation.easing.QuinticIn
  70930. * @description 返回按五次方缓动的值
  70931. * @param {number} k - 参数
  70932. * @return {number} 按五次方缓动的值
  70933. */
  70934. QuinticIn(k) {
  70935. return k * k * k * k * k;
  70936. }
  70937. /**
  70938. * @function LevelRenderer.Animation.easing.QuinticOut
  70939. * @description 返回按五次方缓动退出的值
  70940. * @param {number} k - 参数
  70941. * @return {number} 按五次方缓动退出的值
  70942. */
  70943. QuinticOut(k) {
  70944. return --k * k * k * k * k + 1;
  70945. }
  70946. /**
  70947. * @function LevelRenderer.Animation.easing.QuinticInOut
  70948. * @description 返回按五次方缓动进入退出的值
  70949. * @param {number} k - 参数
  70950. * @return {number} 按五次方缓动进入退出的值
  70951. */
  70952. QuinticInOut(k) {
  70953. if ((k *= 2) < 1) {
  70954. return 0.5 * k * k * k * k * k;
  70955. }
  70956. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  70957. }
  70958. // 正弦曲线的缓动(sin(t))
  70959. /**
  70960. * @function LevelRenderer.Animation.easing.SinusoidalIn
  70961. * @description 返回按正弦曲线的缓动进入的值
  70962. * @param {number} k - 参数
  70963. * @return {number} 按正弦曲线的缓动进入的值
  70964. */
  70965. SinusoidalIn(k) {
  70966. return 1 - Math.cos(k * Math.PI / 2);
  70967. }
  70968. /**
  70969. * @function LevelRenderer.Animation.easing.SinusoidalOut
  70970. * @description 返回按正弦曲线的缓动退出的值
  70971. * @param {number} k - 参数
  70972. * @return {number} 按正弦曲线的缓动退出的值
  70973. */
  70974. SinusoidalOut(k) {
  70975. return Math.sin(k * Math.PI / 2);
  70976. }
  70977. /**
  70978. * @function LevelRenderer.Animation.easing.SinusoidalInOut
  70979. * @description 返回按正弦曲线的缓动进入退出的值
  70980. * @param {number} k - 参数
  70981. * @return {number} 按正弦曲线的缓动进入退出的值
  70982. */
  70983. SinusoidalInOut(k) {
  70984. return 0.5 * (1 - Math.cos(Math.PI * k));
  70985. }
  70986. // 指数曲线的缓动(2^t)
  70987. /**
  70988. * @function LevelRenderer.Animation.easing.ExponentialIn
  70989. * @description 返回按指数曲线的缓动进入的值
  70990. * @param {number} k - 参数
  70991. * @return {number} 按指数曲线的缓动进入的值
  70992. */
  70993. ExponentialIn(k) {
  70994. return k === 0 ? 0 : Math.pow(1024, k - 1);
  70995. }
  70996. /**
  70997. * @function LevelRenderer.Animation.easing.ExponentialOut
  70998. * @description 返回按指数曲线的缓动退出的值
  70999. * @param {number} k - 参数
  71000. * @return {number} 按指数曲线的缓动退出的值
  71001. */
  71002. ExponentialOut(k) {
  71003. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  71004. }
  71005. /**
  71006. * @function LevelRenderer.Animation.easing.ExponentialInOut
  71007. * @description 返回按指数曲线的缓动进入退出的值
  71008. * @param {number} k - 参数
  71009. * @return {number} 按指数曲线的缓动进入退出的值
  71010. */
  71011. ExponentialInOut(k) {
  71012. if (k === 0) {
  71013. return 0;
  71014. }
  71015. if (k === 1) {
  71016. return 1;
  71017. }
  71018. if ((k *= 2) < 1) {
  71019. return 0.5 * Math.pow(1024, k - 1);
  71020. }
  71021. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  71022. }
  71023. // 圆形曲线的缓动(sqrt(1-t^2))
  71024. /**
  71025. * @function LevelRenderer.Animation.easing.CircularIn
  71026. * @description 返回按圆形曲线的缓动进入的值
  71027. * @param {number} k - 参数
  71028. * @return {number} 按圆形曲线的缓动进入的值
  71029. */
  71030. CircularIn(k) {
  71031. return 1 - Math.sqrt(1 - k * k);
  71032. }
  71033. /**
  71034. * @function LevelRenderer.Animation.easing.CircularOut
  71035. * @description 返回按圆形曲线的缓动退出的值
  71036. * @param {number} k - 参数
  71037. * @return {number} 按圆形曲线的缓动退出的值
  71038. */
  71039. CircularOut(k) {
  71040. return Math.sqrt(1 - (--k * k));
  71041. }
  71042. /**
  71043. * @function LevelRenderer.Animation.easing.CircularInOut
  71044. * @description 返回按圆形曲线的缓动进入退出的值
  71045. * @param {number} k - 参数
  71046. * @return {number} 按圆形曲线的缓动进入退出的值
  71047. */
  71048. CircularInOut(k) {
  71049. if ((k *= 2) < 1) {
  71050. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  71051. }
  71052. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  71053. }
  71054. // 创建类似于弹簧在停止前来回振荡的动画
  71055. /**
  71056. * @function LevelRenderer.Animation.easing.ElasticIn
  71057. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  71058. * @param {number} k - 参数
  71059. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  71060. */
  71061. ElasticIn(k) {
  71062. var s;
  71063. var a = 0.1;
  71064. var p = 0.4;
  71065. if (k === 0) {
  71066. return 0;
  71067. }
  71068. if (k === 1) {
  71069. return 1;
  71070. }
  71071. if (a < 1) {
  71072. a = 1;
  71073. s = p / 4;
  71074. } else {
  71075. s = p * Math.asin(1 / a) / (2 * Math.PI);
  71076. }
  71077. return -(a * Math.pow(2, 10 * (k -= 1)) *
  71078. Math.sin((k - s) * (2 * Math.PI) / p));
  71079. }
  71080. /**
  71081. * @function LevelRenderer.Animation.easing.ElasticOut
  71082. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  71083. * @param {number} k - 参数
  71084. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  71085. */
  71086. ElasticOut(k) {
  71087. var s;
  71088. var a = 0.1;
  71089. var p = 0.4;
  71090. if (k === 0) {
  71091. return 0;
  71092. }
  71093. if (k === 1) {
  71094. return 1;
  71095. }
  71096. if (a < 1) {
  71097. a = 1;
  71098. s = p / 4;
  71099. } else {
  71100. s = p * Math.asin(1 / a) / (2 * Math.PI);
  71101. }
  71102. return (a * Math.pow(2, -10 * k) *
  71103. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  71104. }
  71105. /**
  71106. * @function LevelRenderer.Animation.easing.ElasticInOut
  71107. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  71108. * @param {number} k - 参数
  71109. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  71110. */
  71111. ElasticInOut(k) {
  71112. var s;
  71113. var a = 0.1;
  71114. var p = 0.4;
  71115. if (k === 0) {
  71116. return 0;
  71117. }
  71118. if (k === 1) {
  71119. return 1;
  71120. }
  71121. if (a < 1) {
  71122. a = 1;
  71123. s = p / 4;
  71124. } else {
  71125. s = p * Math.asin(1 / a) / (2 * Math.PI);
  71126. }
  71127. if ((k *= 2) < 1) {
  71128. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  71129. * Math.sin((k - s) * (2 * Math.PI) / p));
  71130. }
  71131. return a * Math.pow(2, -10 * (k -= 1))
  71132. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  71133. }
  71134. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  71135. /**
  71136. * @function LevelRenderer.Animation.easing.BackIn
  71137. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  71138. * @param {number} k - 参数
  71139. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  71140. */
  71141. BackIn(k) {
  71142. var s = 1.70158;
  71143. return k * k * ((s + 1) * k - s);
  71144. }
  71145. /**
  71146. * @function LevelRenderer.Animation.easing.BackOut
  71147. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  71148. * @param {number} k - 参数
  71149. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  71150. */
  71151. BackOut(k) {
  71152. var s = 1.70158;
  71153. return --k * k * ((s + 1) * k + s) + 1;
  71154. }
  71155. /**
  71156. * @function LevelRenderer.Animation.easing.BackInOut
  71157. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  71158. * @param {number} k - 参数
  71159. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  71160. */
  71161. BackInOut(k) {
  71162. var s = 1.70158 * 1.525;
  71163. if ((k *= 2) < 1) {
  71164. return 0.5 * (k * k * ((s + 1) * k - s));
  71165. }
  71166. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  71167. }
  71168. // 创建弹跳效果
  71169. /**
  71170. * @function LevelRenderer.Animation.easing.BounceIn
  71171. * @description 返回按弹跳效果的缓动进入的值
  71172. * @param {number} k - 参数
  71173. * @return {number} 按弹跳效果的缓动进入的值
  71174. */
  71175. BounceIn(k) {
  71176. return 1 - this.BounceOut(1 - k);
  71177. }
  71178. /**
  71179. * @function LevelRenderer.Animation.easing.BounceOut
  71180. * @description 返回按弹跳效果的缓动退出的值
  71181. * @param {number} k - 参数
  71182. * @return {number} 按弹跳效果的缓动退出的值
  71183. */
  71184. BounceOut(k) {
  71185. if (k < (1 / 2.75)) {
  71186. return 7.5625 * k * k;
  71187. } else if (k < (2 / 2.75)) {
  71188. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  71189. } else if (k < (2.5 / 2.75)) {
  71190. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  71191. } else {
  71192. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  71193. }
  71194. }
  71195. /**
  71196. * @function LevelRenderer.Animation.easing.BounceInOut
  71197. * @description 返回按弹跳效果的缓动进入退出的值
  71198. * @param {number} k - 参数
  71199. * @return {number} 按弹跳效果的缓动进入退出的值
  71200. */
  71201. BounceInOut(k) {
  71202. if (k < 0.5) {
  71203. return this.BounceIn(k * 2) * 0.5;
  71204. }
  71205. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  71206. }
  71207. }
  71208. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  71209. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71210. * This program are made available under the terms of the Apache License, Version 2.0
  71211. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71212. /**
  71213. * @class LevelRenderer.Animation.Clip
  71214. * @category Visualization Theme
  71215. * @classdesc 动画片段
  71216. * @param {Object} options - 参数。
  71217. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  71218. * @param {number} [options.life=1000] - 动画时长。
  71219. * @param {number} [options.delay=0] - 动画延迟时间。
  71220. * @param {boolean} [options.loop=true] - 是否循环。
  71221. * @param {number} [options.gap=0] - 循环的间隔时间。
  71222. * @param {Object} options.onframe - 帧。
  71223. * @param {boolean} options.easing - 是否消除。
  71224. * @param {boolean} options.ondestroy - 是否销毁。
  71225. * @param {boolean} options.onrestart - 是否重播。
  71226. * @private
  71227. */
  71228. class Clip {
  71229. constructor(options) {
  71230. this._targetPool = options.target || {};
  71231. if (!(this._targetPool instanceof Array)) {
  71232. this._targetPool = [this._targetPool];
  71233. }
  71234. // 生命周期
  71235. this._life = options.life || 1000;
  71236. // 延时
  71237. this._delay = options.delay || 0;
  71238. // 开始时间
  71239. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  71240. // 结束时间
  71241. this._endTime = this._startTime + this._life * 1000;
  71242. // 是否循环
  71243. this.loop = typeof options.loop == 'undefined'
  71244. ? false : options.loop;
  71245. this.gap = options.gap || 0;
  71246. this.easing = options.easing || 'Linear';
  71247. this.onframe = options.onframe;
  71248. this.ondestroy = options.ondestroy;
  71249. this.onrestart = options.onrestart;
  71250. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  71251. }
  71252. /**
  71253. * @function LevelRenderer.Animation.Clip.prototype.destroy
  71254. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  71255. */
  71256. destroy() {
  71257. }
  71258. step(time) {
  71259. var easing = new Easing();
  71260. var percent = (time - this._startTime) / this._life;
  71261. // 还没开始
  71262. if (percent < 0) {
  71263. return;
  71264. }
  71265. percent = Math.min(percent, 1);
  71266. var easingFunc = typeof this.easing == 'string'
  71267. ? easing[this.easing]
  71268. : this.easing;
  71269. var schedule = typeof easingFunc === 'function'
  71270. ? easingFunc(percent)
  71271. : percent;
  71272. this.fire('frame', schedule);
  71273. // 结束
  71274. if (percent == 1) {
  71275. if (this.loop) {
  71276. this.restart();
  71277. // 重新开始周期
  71278. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  71279. return 'restart';
  71280. }
  71281. // 动画完成将这个控制器标识为待删除
  71282. // 在Animation.update中进行批量删除
  71283. this._needsRemove = true;
  71284. return 'destroy';
  71285. }
  71286. return null;
  71287. }
  71288. restart() {
  71289. var time = new Date().getTime();
  71290. var remainder = (time - this._startTime) % this._life;
  71291. this._startTime = new Date().getTime() - remainder + this.gap;
  71292. }
  71293. fire(eventType, arg) {
  71294. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  71295. if (this['on' + eventType]) {
  71296. this['on' + eventType](this._targetPool[i], arg);
  71297. }
  71298. }
  71299. }
  71300. }
  71301. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  71302. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71303. * This program are made available under the terms of the Apache License, Version 2.0
  71304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71305. /**
  71306. * @class LevelRenderer.Animation
  71307. * @classdesc 动画主类, 调度和管理所有动画控制器
  71308. * @category Visualization Theme
  71309. * @extends {LevelRenderer.Eventful}
  71310. * @param {Object} options - 动画参数。
  71311. * @param {Object} options.onframe - onframe。
  71312. * @param {Object} options.stage - stage。
  71313. * @example 例如:
  71314. * (start code)
  71315. * var animation = new LevelRenderer.Animation();
  71316. * var obj = {
  71317. * x: 100,
  71318. * y: 100
  71319. * };
  71320. * animation.animate(node.position)
  71321. * .when(1000, {
  71322. * x: 500,
  71323. * y: 500
  71324. * })
  71325. * .when(2000, {
  71326. * x: 100,
  71327. * y: 100
  71328. * })
  71329. * .start('spline');
  71330. * (end)
  71331. * @private
  71332. */
  71333. class Animation extends Eventful {
  71334. constructor(options) {
  71335. super(options);
  71336. options = options || {};
  71337. /**
  71338. * @member {Object} LevelRenderer.Animation.prototype.stage
  71339. * @description stage。
  71340. */
  71341. this.stage = {};
  71342. /**
  71343. * @member {Object} LevelRenderer.Animation.prototype.onframe
  71344. * @description onframe。
  71345. */
  71346. this.onframe = function () {
  71347. };
  71348. /**
  71349. * @member {Array} LevelRenderer.Animation.prototype._clips
  71350. * @description _clips。
  71351. */
  71352. this._clips = [];
  71353. /**
  71354. * @member {boolean} LevelRenderer.Animation.prototype._running
  71355. * @description _running。
  71356. */
  71357. this._running = false;
  71358. /**
  71359. * @member {number} LevelRenderer.Animation.prototype._time
  71360. * @description _time。
  71361. */
  71362. this._time = 0;
  71363. Util_Util.extend(this, options);
  71364. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  71365. }
  71366. /**
  71367. * @function LevelRenderer.Animation.prototype.add
  71368. * @description 添加动画片段。
  71369. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  71370. */
  71371. add(clip) {
  71372. this._clips.push(clip);
  71373. }
  71374. /**
  71375. * @function LevelRenderer.Animation.prototype.remove
  71376. * @description 删除动画片段。
  71377. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  71378. */
  71379. remove(clip) {
  71380. var idx = new levelRenderer_Util_Util().indexOf(this._clips, clip);
  71381. if (idx >= 0) {
  71382. this._clips.splice(idx, 1);
  71383. }
  71384. }
  71385. /**
  71386. * @function LevelRenderer.Animation.prototype.update
  71387. * @description 更新动画片段。
  71388. */
  71389. _update() {
  71390. var time = new Date().getTime();
  71391. var delta = time - this._time;
  71392. var clips = this._clips;
  71393. var len = clips.length;
  71394. var deferredEvents = [];
  71395. var deferredClips = [];
  71396. for (let i = 0; i < len; i++) {
  71397. var clip = clips[i];
  71398. var e = clip.step(time);
  71399. // Throw out the events need to be called after
  71400. // stage.update, like destroy
  71401. if (e) {
  71402. deferredEvents.push(e);
  71403. deferredClips.push(clip);
  71404. }
  71405. }
  71406. if (this.stage.update) {
  71407. this.stage.update();
  71408. }
  71409. // Remove the finished clip
  71410. for (let i = 0; i < len;) {
  71411. if (clips[i]._needsRemove) {
  71412. clips[i] = clips[len - 1];
  71413. clips.pop();
  71414. len--;
  71415. } else {
  71416. i++;
  71417. }
  71418. }
  71419. len = deferredEvents.length;
  71420. for (let i = 0; i < len; i++) {
  71421. deferredClips[i].fire(deferredEvents[i]);
  71422. }
  71423. this._time = time;
  71424. this.onframe(delta);
  71425. this.dispatch('frame', delta);
  71426. }
  71427. /**
  71428. * @function LevelRenderer.Animation.prototype.start
  71429. * @description 开始运行动画。
  71430. */
  71431. start() {
  71432. var requestAnimationFrame = window.requestAnimationFrame
  71433. || window.msRequestAnimationFrame
  71434. || window.mozRequestAnimationFrame
  71435. || window.webkitRequestAnimationFrame
  71436. || function (func) {
  71437. setTimeout(func, 16);
  71438. };
  71439. var self = this;
  71440. this._running = true;
  71441. function step() {
  71442. if (self._running) {
  71443. self._update();
  71444. requestAnimationFrame(step);
  71445. }
  71446. }
  71447. this._time = new Date().getTime();
  71448. requestAnimationFrame(step);
  71449. }
  71450. /**
  71451. * @function LevelRenderer.Animation.prototype.stop
  71452. * @description 停止运行动画。
  71453. */
  71454. stop() {
  71455. this._running = false;
  71456. }
  71457. /**
  71458. * @function LevelRenderer.Animation.prototype.clear
  71459. * @description 清除所有动画片段。
  71460. */
  71461. clear() {
  71462. this._clips = [];
  71463. }
  71464. /**
  71465. * @function LevelRenderer.Animation.prototype.animate
  71466. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  71467. * @param {Object} target - 目标对象。
  71468. * @param {Object} options - 动画参数选项。
  71469. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  71470. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  71471. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  71472. * @returns {LevelRenderer.Animation.Animator} Animator。
  71473. */
  71474. animate(target, options) {
  71475. options = options || {};
  71476. var deferred = new Animator(
  71477. target,
  71478. options.loop,
  71479. options.getter,
  71480. options.setter
  71481. );
  71482. deferred.animation = this;
  71483. return deferred;
  71484. }
  71485. static _interpolateNumber(p0, p1, percent) {
  71486. return (p1 - p0) * percent + p0;
  71487. }
  71488. static _interpolateArray(p0, p1, percent, out, arrDim) {
  71489. var len = p0.length;
  71490. if (arrDim == 1) {
  71491. for (let i = 0; i < len; i++) {
  71492. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  71493. }
  71494. } else {
  71495. var len2 = p0[0].length;
  71496. for (let i = 0; i < len; i++) {
  71497. for (let j = 0; j < len2; j++) {
  71498. out[i][j] = Animation._interpolateNumber(
  71499. p0[i][j], p1[i][j], percent
  71500. );
  71501. }
  71502. }
  71503. }
  71504. }
  71505. static _isArrayLike(data) {
  71506. switch (typeof data) {
  71507. case 'undefined':
  71508. case 'string':
  71509. return false;
  71510. }
  71511. return typeof data.length !== 'undefined';
  71512. }
  71513. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  71514. var len = p0.length;
  71515. if (arrDim == 1) {
  71516. for (let i = 0; i < len; i++) {
  71517. out[i] = Animation._catmullRomInterpolate(
  71518. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  71519. );
  71520. }
  71521. } else {
  71522. var len2 = p0[0].length;
  71523. for (let i = 0; i < len; i++) {
  71524. for (var j = 0; j < len2; j++) {
  71525. out[i][j] = Animation._catmullRomInterpolate(
  71526. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  71527. t, t2, t3
  71528. );
  71529. }
  71530. }
  71531. }
  71532. }
  71533. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  71534. var v0 = (p2 - p0) * 0.5;
  71535. var v1 = (p3 - p1) * 0.5;
  71536. return (2 * (p1 - p2) + v0 + v1) * t3
  71537. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  71538. + v0 * t + p1;
  71539. }
  71540. static _cloneValue(value) {
  71541. var arraySlice = Array.prototype.slice;
  71542. if (Animation._isArrayLike(value)) {
  71543. var len = value.length;
  71544. if (Animation._isArrayLike(value[0])) {
  71545. var ret = [];
  71546. for (var i = 0; i < len; i++) {
  71547. ret.push(arraySlice.call(value[i]));
  71548. }
  71549. return ret;
  71550. } else {
  71551. return arraySlice.call(value);
  71552. }
  71553. } else {
  71554. return value;
  71555. }
  71556. }
  71557. static rgba2String(rgba) {
  71558. rgba[0] = Math.floor(rgba[0]);
  71559. rgba[1] = Math.floor(rgba[1]);
  71560. rgba[2] = Math.floor(rgba[2]);
  71561. return 'rgba(' + rgba.join(',') + ')';
  71562. }
  71563. }
  71564. /**
  71565. * @class LevelRenderer.Animation.Animator
  71566. */
  71567. class Animator {
  71568. /**
  71569. * @function LevelRenderer.Animation.Animator.prototype.animate
  71570. * @description 构造函数
  71571. * @param {Object} target - 目标对象。
  71572. * @param {Object} options - 动画参数选项。
  71573. * @param {boolean} [loop=false] - 是否循环播放动画。
  71574. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  71575. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  71576. */
  71577. constructor(target, loop, getter, setter) {
  71578. /**
  71579. * @member {Object} LevelRenderer.Animation.Animator.prototype._tracks
  71580. * @description _tracks。
  71581. */
  71582. this._tracks = {};
  71583. /**
  71584. * @member {Object} LevelRenderer.Animation.Animator.prototype._target
  71585. * @description _target。
  71586. */
  71587. this._target = target;
  71588. /**
  71589. * @member {boolean} LevelRenderer.Animation.Animator.prototype._loop
  71590. * @description _loop。
  71591. */
  71592. this._loop = loop || false;
  71593. /**
  71594. * @member {function} LevelRenderer.Animation.Animator.prototype._getter
  71595. * @description _getter。
  71596. */
  71597. this._getter = getter || _defaultGetter;
  71598. /**
  71599. * @member {function} LevelRenderer.Animation.Animator.prototype._setter
  71600. * @description _setter。
  71601. */
  71602. this._setter = setter || _defaultSetter;
  71603. /**
  71604. * @member {number} LevelRenderer.Animation.Animator.prototype._clipCount
  71605. * @description _clipCount。
  71606. */
  71607. this._clipCount = 0;
  71608. /**
  71609. * @member {number} LevelRenderer.Animation.Animator.prototype._delay
  71610. * @description _delay。
  71611. */
  71612. this._delay = 0;
  71613. /**
  71614. * @member {Array} LevelRenderer.Animation.Animator.prototype._doneList
  71615. * @description _doneList。
  71616. */
  71617. this._doneList = [];
  71618. /**
  71619. * @member {Array} LevelRenderer.Animation.Animator.prototype._onframeList
  71620. * @description _onframeList。
  71621. */
  71622. this._onframeList = [];
  71623. /**
  71624. * @member {Array} LevelRenderer.Animation.Animator.prototype._clipList
  71625. * @description _clipList。
  71626. */
  71627. this._clipList = [];
  71628. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  71629. //Function
  71630. function _defaultGetter(target, key) {
  71631. return target[key];
  71632. }
  71633. function _defaultSetter(target, key, value) {
  71634. target[key] = value;
  71635. }
  71636. }
  71637. /**
  71638. * @function LevelRenderer.Animation.Animator.prototype.when
  71639. * @description 设置动画关键帧
  71640. * @param {number} time - 关键帧时间,单位是ms
  71641. * @param {Object} props - 关键帧的属性值,key-value表示
  71642. * @returns {LevelRenderer.Animation.Animator} Animator
  71643. */
  71644. when(time /* ms */, props) {
  71645. for (var propName in props) {
  71646. if (!this._tracks[propName]) {
  71647. this._tracks[propName] = [];
  71648. // If time is 0
  71649. // Then props is given initialize value
  71650. // Else
  71651. // Initialize value from current prop value
  71652. if (time !== 0) {
  71653. this._tracks[propName].push({
  71654. time: 0,
  71655. value: Animation._cloneValue(
  71656. this._getter(this._target, propName)
  71657. )
  71658. });
  71659. }
  71660. }
  71661. this._tracks[propName].push({
  71662. time: parseInt(time, 10),
  71663. value: props[propName]
  71664. });
  71665. }
  71666. return this;
  71667. }
  71668. /**
  71669. * @function LevelRenderer.Animation.Animator.prototype.during
  71670. * @description 添加动画每一帧的回调函数
  71671. * @param {RequestCallback} callback - 回调函数
  71672. * @returns {LevelRenderer.Animation.Animator} Animator
  71673. */
  71674. during(callback) {
  71675. this._onframeList.push(callback);
  71676. return this;
  71677. }
  71678. /**
  71679. * @function LevelRenderer.Animation.Animator.prototype.start
  71680. * @description 开始执行动画
  71681. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link LevelRenderer.Animation.easing}>。
  71682. * @returns {LevelRenderer.Animation.Animator} Animator
  71683. */
  71684. start(easing) {
  71685. var self = this;
  71686. var setter = this._setter;
  71687. var getter = this._getter;
  71688. var onFrameListLen = self._onframeList.length;
  71689. var useSpline = easing === 'spline';
  71690. var ondestroy = function () {
  71691. self._clipCount--;
  71692. if (self._clipCount === 0) {
  71693. // Clear all tracks
  71694. self._tracks = {};
  71695. var len = self._doneList.length;
  71696. for (var i = 0; i < len; i++) {
  71697. self._doneList[i].call(self);
  71698. }
  71699. }
  71700. };
  71701. var createTrackClip = function (keyframes, propName) {
  71702. var trackLen = keyframes.length;
  71703. if (!trackLen) {
  71704. return;
  71705. }
  71706. // Guess data type
  71707. var firstVal = keyframes[0].value;
  71708. var isValueArray = Animation._isArrayLike(firstVal);
  71709. var isValueColor = false;
  71710. // For vertices morphing
  71711. var arrDim = (
  71712. isValueArray
  71713. && Animation._isArrayLike(firstVal[0])
  71714. )
  71715. ? 2 : 1;
  71716. // Sort keyframe as ascending
  71717. keyframes.sort(function (a, b) {
  71718. return a.time - b.time;
  71719. });
  71720. var trackMaxTime = keyframes[trackLen - 1].time;
  71721. // Percents of each keyframe
  71722. var kfPercents = [];
  71723. // Value of each keyframe
  71724. var kfValues = [];
  71725. for (let i = 0; i < trackLen; i++) {
  71726. kfPercents.push(keyframes[i].time / trackMaxTime);
  71727. // Assume value is a color when it is a string
  71728. var value = keyframes[i].value;
  71729. if (typeof(value) == 'string') {
  71730. value = SUtil_SUtil.Util_color.toArray(value);
  71731. if (value.length === 0) { // Invalid color
  71732. value[0] = value[1] = value[2] = 0;
  71733. value[3] = 1;
  71734. }
  71735. isValueColor = true;
  71736. }
  71737. kfValues.push(value);
  71738. }
  71739. // Cache the key of last frame to speed up when
  71740. // animation playback is sequency
  71741. var cacheKey = 0;
  71742. var cachePercent = 0;
  71743. var start;
  71744. var i;
  71745. var w;
  71746. var p0;
  71747. var p1;
  71748. var p2;
  71749. var p3;
  71750. if (isValueColor) {
  71751. var rgba = [0, 0, 0, 0];
  71752. }
  71753. var onframe = function (target, percent) {
  71754. // Find the range keyframes
  71755. // kf1-----kf2---------current--------kf3
  71756. // find kf2 and kf3 and do interpolation
  71757. if (percent < cachePercent) {
  71758. // Start from next key
  71759. start = Math.min(cacheKey + 1, trackLen - 1);
  71760. for (i = start; i >= 0; i--) {
  71761. if (kfPercents[i] <= percent) {
  71762. break;
  71763. }
  71764. }
  71765. i = Math.min(i, trackLen - 2);
  71766. } else {
  71767. for (i = cacheKey; i < trackLen; i++) {
  71768. if (kfPercents[i] > percent) {
  71769. break;
  71770. }
  71771. }
  71772. i = Math.min(i - 1, trackLen - 2);
  71773. }
  71774. cacheKey = i;
  71775. cachePercent = percent;
  71776. var range = (kfPercents[i + 1] - kfPercents[i]);
  71777. if (range === 0) {
  71778. return;
  71779. } else {
  71780. w = (percent - kfPercents[i]) / range;
  71781. }
  71782. if (useSpline) {
  71783. p1 = kfValues[i];
  71784. p0 = kfValues[i === 0 ? i : i - 1];
  71785. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  71786. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  71787. if (isValueArray) {
  71788. Animation._catmullRomInterpolateArray(
  71789. p0, p1, p2, p3, w, w * w, w * w * w,
  71790. getter(target, propName),
  71791. arrDim
  71792. );
  71793. } else {
  71794. let value;
  71795. if (isValueColor) {
  71796. // value = LevelRenderer.Animation._catmullRomInterpolateArray(
  71797. // p0, p1, p2, p3, w, w * w, w * w * w,
  71798. // rgba, 1
  71799. // );
  71800. value = Animation.rgba2String(rgba);
  71801. } else {
  71802. value = Animation._catmullRomInterpolate(
  71803. p0, p1, p2, p3, w, w * w, w * w * w
  71804. );
  71805. }
  71806. setter(
  71807. target,
  71808. propName,
  71809. value
  71810. );
  71811. }
  71812. } else {
  71813. if (isValueArray) {
  71814. Animation._interpolateArray(
  71815. kfValues[i], kfValues[i + 1], w,
  71816. getter(target, propName),
  71817. arrDim
  71818. );
  71819. } else {
  71820. let value;
  71821. if (isValueColor) {
  71822. Animation._interpolateArray(
  71823. kfValues[i], kfValues[i + 1], w,
  71824. rgba, 1
  71825. );
  71826. value = Animation.rgba2String(rgba);
  71827. } else {
  71828. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  71829. }
  71830. setter(
  71831. target,
  71832. propName,
  71833. value
  71834. );
  71835. }
  71836. }
  71837. for (i = 0; i < onFrameListLen; i++) {
  71838. self._onframeList[i](target, percent);
  71839. }
  71840. };
  71841. var clip = new Clip({
  71842. target: self._target,
  71843. life: trackMaxTime,
  71844. loop: self._loop,
  71845. delay: self._delay,
  71846. onframe: onframe,
  71847. ondestroy: ondestroy
  71848. });
  71849. if (easing && easing !== 'spline') {
  71850. clip.easing = easing;
  71851. }
  71852. self._clipList.push(clip);
  71853. self._clipCount++;
  71854. self.animation.add(clip);
  71855. };
  71856. for (var propName in this._tracks) {
  71857. createTrackClip(this._tracks[propName], propName);
  71858. }
  71859. return this;
  71860. }
  71861. /**
  71862. * @function LevelRenderer.Animation.Animator.prototype.stop
  71863. * @description 停止动画
  71864. */
  71865. stop() {
  71866. for (var i = 0; i < this._clipList.length; i++) {
  71867. var clip = this._clipList[i];
  71868. this.animation.remove(clip);
  71869. }
  71870. this._clipList = [];
  71871. }
  71872. /**
  71873. * @function LevelRenderer.Animation.Animator.prototype.delay
  71874. * @description 设置动画延迟开始的时间
  71875. * @param {number} time - 时间,单位ms
  71876. * @returns {LevelRenderer.Animation.Animator} Animator
  71877. */
  71878. delay(time) {
  71879. this._delay = time;
  71880. return this;
  71881. }
  71882. /**
  71883. * @function LevelRenderer.Animation.Animator.prototype.done
  71884. * @description 添加动画结束的回调
  71885. * @param {function} cb - Function
  71886. * @returns {LevelRenderer.Animation.Animator} Animator
  71887. */
  71888. done(cb) {
  71889. if (cb) {
  71890. this._doneList.push(cb);
  71891. }
  71892. return this;
  71893. }
  71894. }
  71895. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  71896. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71897. * This program are made available under the terms of the Apache License, Version 2.0
  71898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71899. /**
  71900. * @private
  71901. * @class LevelRenderer.Render
  71902. * @category Visualization Theme
  71903. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  71904. * @param {string} id - 唯一标识。
  71905. * @param {HTMLElement} dom - Dom 对象。
  71906. */
  71907. class Render {
  71908. constructor(id, dom) {
  71909. /**
  71910. * @member {string} LevelRenderer.Render.prototype.id
  71911. * @description 唯一标识。
  71912. */
  71913. this.id = id;
  71914. /**
  71915. * @member {LevelRenderer.Storage} LevelRenderer.Render.prototype.storage
  71916. * @description 图形仓库对象。
  71917. */
  71918. this.storage = new Storage();
  71919. /**
  71920. * @member {LevelRenderer.Painter} LevelRenderer.Render.prototype.painter
  71921. * @description 绘制器对象。
  71922. *
  71923. */
  71924. this.painter = new Painter(dom, this.storage);
  71925. /**
  71926. * @member {LevelRenderer.Handler} LevelRenderer.Render.prototype.handler
  71927. * @description 事件处理对象。
  71928. *
  71929. */
  71930. this.handler = new Handler(dom, this.storage, this.painter);
  71931. /**
  71932. * @member {Array} LevelRenderer.Render.prototype.animatingElements
  71933. * @description 动画控制数组。
  71934. *
  71935. */
  71936. this.animatingElements = [];
  71937. /**
  71938. * @member {LevelRenderer.animation.Animation} LevelRenderer.Render.prototype.animation
  71939. * @description 动画对象。
  71940. *
  71941. */
  71942. this.animation = new Animation({
  71943. stage: {
  71944. update: Render.getFrameCallback(this)
  71945. }
  71946. });
  71947. /**
  71948. * @member {boolean} LevelRenderer.Render.prototype._needsRefreshNextFrame
  71949. * @description 是否需要刷新下一帧。
  71950. *
  71951. */
  71952. this._needsRefreshNextFrame = false;
  71953. this.animation.start();
  71954. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  71955. }
  71956. /**
  71957. * @function LevelRenderer.Render.prototype.destory
  71958. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  71959. */
  71960. destroy() {
  71961. this.id = null;
  71962. this.storage = null;
  71963. this.painter = null;
  71964. this.handler = null;
  71965. this.animatingElements = null;
  71966. this.animation = null;
  71967. this._needsRefreshNextFrame = null;
  71968. }
  71969. /**
  71970. * @function LevelRenderer.Render.prototype.getId
  71971. * @description 获取实例唯一标识。
  71972. * @return {string} 实例唯一标识。
  71973. */
  71974. getId() {
  71975. return this.id;
  71976. }
  71977. /**
  71978. * @function LevelRenderer.Render.prototype.addShape
  71979. * @description 添加图形形状到根节点。
  71980. *
  71981. * @param {LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  71982. * @return {LevelRenderer.Render} this。
  71983. */
  71984. addShape(shape) {
  71985. this.storage.addRoot(shape);
  71986. return this;
  71987. }
  71988. /**
  71989. * @function LevelRenderer.Render.prototype.addGroup
  71990. * @description 添加组到根节点。
  71991. *
  71992. * (code)
  71993. * //添加组到根节点例子
  71994. * var render = new LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  71995. * render.clear();
  71996. * var g = new LevelRenderer.Group();
  71997. * g.addChild(new LevelRenderer.Shape.Circle({
  71998. * style: {
  71999. * x: 100,
  72000. * y: 100,
  72001. * r: 20,
  72002. * brushType: 'fill'
  72003. * }
  72004. * }));
  72005. * render.addGroup(g);
  72006. * render.render();
  72007. * (end)
  72008. *
  72009. * @param {LevelRenderer.Group} group - 组对象。
  72010. * @return {LevelRenderer.Render} this。
  72011. */
  72012. addGroup(group) {
  72013. this.storage.addRoot(group);
  72014. return this;
  72015. }
  72016. /**
  72017. * @function LevelRenderer.Render.prototype.delShape
  72018. * @description 从根节点删除图形形状。
  72019. *
  72020. * @param {string} shapeId - 图形对象唯一标识。
  72021. * @return {LevelRenderer.Render} this。
  72022. */
  72023. delShape(shapeId) {
  72024. this.storage.delRoot(shapeId);
  72025. return this;
  72026. }
  72027. /**
  72028. * @function LevelRenderer.Render.prototype.delGroup
  72029. * @description 从根节点删除组。
  72030. *
  72031. * @param {string} groupId - 组对象唯一标识。
  72032. * @return {LevelRenderer.Render} this。
  72033. */
  72034. delGroup(groupId) {
  72035. this.storage.delRoot(groupId);
  72036. return this;
  72037. }
  72038. /**
  72039. * @function LevelRenderer.Render.prototype.modShape
  72040. * @description 修改图形形状。
  72041. *
  72042. * @param {string} shapeId - 图形对象唯一标识。
  72043. * @param {LevelRenderer.Shape} shape - 图形对象。
  72044. * @return {LevelRenderer.Render} this。
  72045. */
  72046. modShape(shapeId, shape) {
  72047. this.storage.mod(shapeId, shape);
  72048. return this;
  72049. }
  72050. /**
  72051. * @function LevelRenderer.Render.prototype.modGroup
  72052. * @description 修改组。
  72053. *
  72054. * @param {string} groupId - 组对象唯一标识。
  72055. * @param {LevelRenderer.Group} group - 组对象。
  72056. * @return {LevelRenderer.Render} this。
  72057. */
  72058. modGroup(groupId, group) {
  72059. this.storage.mod(groupId, group);
  72060. return this;
  72061. }
  72062. /**
  72063. * @function LevelRenderer.Render.prototype.modLayer
  72064. * @description 修改指定 zlevel 的绘制配置项。
  72065. *
  72066. * @param {string} zLevel - 组对象唯一标识。
  72067. * @param {Object} config - 配置对象。
  72068. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  72069. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  72070. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  72071. * @param {Array.<number>} position - 层的平移。
  72072. * @param {Array.<number>} rotation - 层的旋转。
  72073. * @param {Array.<number>} scale - 层的缩放。
  72074. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  72075. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  72076. * @return {LevelRenderer.Render} this。
  72077. */
  72078. modLayer(zLevel, config) {
  72079. this.painter.modLayer(zLevel, config);
  72080. return this;
  72081. }
  72082. /**
  72083. * @function LevelRenderer.Render.prototype.addHoverShape
  72084. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  72085. *
  72086. * @param {LevelRenderer.Shape} shape - 图形对象。
  72087. * @return {LevelRenderer.Render} this。
  72088. */
  72089. addHoverShape(shape) {
  72090. this.storage.addHover(shape);
  72091. return this;
  72092. }
  72093. /**
  72094. * @function LevelRenderer.Render.prototype.render
  72095. * @description 渲染。
  72096. *
  72097. * @callback {function} callback - 渲染结束后回调函数。
  72098. * @return {LevelRenderer.Render} this。
  72099. */
  72100. render(callback) {
  72101. this.painter.render(callback);
  72102. this._needsRefreshNextFrame = false;
  72103. return this;
  72104. }
  72105. /**
  72106. * @function LevelRenderer.Render.prototype.refresh
  72107. * @description 视图更新。
  72108. *
  72109. * @callback {function} callback - 视图更新后回调函数。
  72110. * @return {LevelRenderer.Render} this。
  72111. */
  72112. refresh(callback) {
  72113. this.painter.refresh(callback);
  72114. this._needsRefreshNextFrame = false;
  72115. return this;
  72116. }
  72117. /**
  72118. * @function LevelRenderer.Render.prototype.refreshNextFrame
  72119. * @description 标记视图在浏览器下一帧需要绘制。
  72120. * @return {LevelRenderer.Render} this。
  72121. */
  72122. refreshNextFrame() {
  72123. this._needsRefreshNextFrame = true;
  72124. return this;
  72125. }
  72126. /**
  72127. * @function LevelRenderer.Render.prototype.refreshHover
  72128. * @description 绘制(视图更新)高亮层。
  72129. * @callback {function} callback - 视图更新后回调函数。
  72130. * @return {LevelRenderer.Render} this。
  72131. */
  72132. refreshHover(callback) {
  72133. this.painter.refreshHover(callback);
  72134. return this;
  72135. }
  72136. /**
  72137. * @function LevelRenderer.Render.prototype.refreshShapes
  72138. * @description 视图更新。
  72139. *
  72140. * @param {Array.<LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  72141. * @callback {function} callback - 视图更新后回调函数。
  72142. * @return {LevelRenderer.Render} this。
  72143. */
  72144. refreshShapes(shapeList, callback) {
  72145. this.painter.refreshShapes(shapeList, callback);
  72146. return this;
  72147. }
  72148. /**
  72149. * @function LevelRenderer.Render.prototype.resize
  72150. * @description 调整视图大小。
  72151. * @return {LevelRenderer.Render} this。
  72152. */
  72153. resize() {
  72154. this.painter.resize();
  72155. return this;
  72156. }
  72157. /**
  72158. * @function LevelRenderer.Render.prototype.animate
  72159. * @description 动画。
  72160. *
  72161. * @example
  72162. * zr.animate(circle.id, 'style', false)
  72163. * .when(1000, {x: 10} )
  72164. * .done(function(){ // Animation done })
  72165. * .start()
  72166. *
  72167. *
  72168. * @param {Array.<(LevelRenderer.Shape/LevelRenderer.Group)>} el - 动画对象。
  72169. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<LevelRenderer.Group>,path需为空字符串。
  72170. * @param {function} loop - 动画是否循环。
  72171. * @return {LevelRenderer.animation.Animator} Animator。
  72172. */
  72173. animate(el, path, loop) {
  72174. if (typeof(el) === 'string') {
  72175. el = this.storage.get(el);
  72176. }
  72177. if (el) {
  72178. var target;
  72179. if (path) {
  72180. var pathSplitted = path.split('.');
  72181. var prop = el;
  72182. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  72183. if (!prop) {
  72184. continue;
  72185. }
  72186. prop = prop[pathSplitted[i]];
  72187. }
  72188. if (prop) {
  72189. target = prop;
  72190. }
  72191. } else {
  72192. target = el;
  72193. }
  72194. if (!target) {
  72195. SUtil_SUtil.Util_log(
  72196. 'Property "'
  72197. + path
  72198. + '" is not existed in element '
  72199. + el.id
  72200. );
  72201. return;
  72202. }
  72203. var animatingElements = this.animatingElements;
  72204. if (typeof el.__aniCount === 'undefined') {
  72205. // 正在进行的动画记数
  72206. el.__aniCount = 0;
  72207. }
  72208. if (el.__aniCount === 0) {
  72209. animatingElements.push(el);
  72210. }
  72211. el.__aniCount++;
  72212. return this.animation.animate(target, {loop: loop})
  72213. .done(function () {
  72214. el.__aniCount--;
  72215. if (el.__aniCount === 0) {
  72216. // 从animatingElements里移除
  72217. var idx = new levelRenderer_Util_Util().indexOf(animatingElements, el);
  72218. animatingElements.splice(idx, 1);
  72219. }
  72220. });
  72221. } else {
  72222. SUtil_SUtil.Util_log('Element not existed');
  72223. }
  72224. }
  72225. /**
  72226. * @function LevelRenderer.Render.prototype.clearAnimation
  72227. * @description 停止所有动画。
  72228. *
  72229. */
  72230. clearAnimation() {
  72231. this.animation.clear();
  72232. }
  72233. /**
  72234. * @function LevelRenderer.Render.prototype.getWidth
  72235. * @description 获取视图宽度。
  72236. * @return {number} 视图宽度。
  72237. */
  72238. getWidth() {
  72239. return this.painter.getWidth();
  72240. }
  72241. /**
  72242. * @function LevelRenderer.Render.prototype.getHeight
  72243. * @description 获取视图高度。
  72244. * @return {number} 视图高度。
  72245. */
  72246. getHeight() {
  72247. return this.painter.getHeight();
  72248. }
  72249. /**
  72250. * @function LevelRenderer.Render.prototype.toDataURL
  72251. * @description 图像导出。
  72252. *
  72253. * @param {string} type - 类型。
  72254. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  72255. * @param {string} args - 参数。
  72256. * @return {string} 图片的 Base64 url。
  72257. */
  72258. toDataURL(type, backgroundColor, args) {
  72259. return this.painter.toDataURL(type, backgroundColor, args);
  72260. }
  72261. /**
  72262. * @function LevelRenderer.Render.prototype.shapeToImage
  72263. * @description 将常规 shape 转成 image shape。
  72264. *
  72265. * @param {LevelRenderer.Shape} e - 图形。
  72266. * @param {number} width - 宽度。
  72267. * @param {number} height - 高度。
  72268. * @return {Object} image shape。
  72269. */
  72270. shapeToImage(e, width, height) {
  72271. var id = Util_Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  72272. return this.painter.shapeToImage(id, e, width, height);
  72273. }
  72274. /**
  72275. * @function LevelRenderer.Render.prototype.on
  72276. * @description 事件绑定。
  72277. *
  72278. * @param {string} eventName - 事件名称。
  72279. * @param {function} eventHandler - 响应函数。
  72280. * @return {LevelRenderer.Render} this。
  72281. */
  72282. on(eventName, eventHandler) {
  72283. this.handler.on(eventName, eventHandler);
  72284. return this;
  72285. }
  72286. /**
  72287. * @function LevelRenderer.Render.prototype.un
  72288. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  72289. *
  72290. * @param {string} eventName - 事件名称。
  72291. * @param {function} eventHandler - 响应函数。
  72292. * @return {LevelRenderer.Render} this。
  72293. */
  72294. un(eventName, eventHandler) {
  72295. this.handler.un(eventName, eventHandler);
  72296. return this;
  72297. }
  72298. /**
  72299. * @function LevelRenderer.Render.prototype.trigger
  72300. * @description 事件触发。
  72301. *
  72302. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  72303. * @param {event} event - event dom事件对象。
  72304. * @return {LevelRenderer.Render} this。
  72305. */
  72306. trigger(eventName, event) {
  72307. this.handler.trigger(eventName, event);
  72308. this.handler.dispatch(eventName, event);
  72309. return this;
  72310. }
  72311. /**
  72312. * @function LevelRenderer.Render.prototype.clear
  72313. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  72314. * @return {LevelRenderer.Render} this。
  72315. */
  72316. clear() {
  72317. this.storage.delRoot();
  72318. this.painter.clear();
  72319. return this;
  72320. }
  72321. /**
  72322. * @function LevelRenderer.Render.prototype.dispose
  72323. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  72324. */
  72325. dispose() {
  72326. this.animation.stop();
  72327. this.clear();
  72328. this.storage.dispose();
  72329. this.painter.dispose();
  72330. this.handler.dispose();
  72331. this.animation = null;
  72332. this.animatingElements = null;
  72333. this.storage = null;
  72334. this.painter = null;
  72335. this.handler = null;
  72336. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  72337. // zrender.delInstance(this.id);
  72338. }
  72339. // SMIC-方法扩展 - start
  72340. /**
  72341. * @function LevelRenderer.Render.prototype.updateHoverShapes
  72342. * @description 更新设置显示高亮图层。
  72343. *
  72344. * @param {Array.<LevelRenderer.Shape>} shapes - 图形数组。
  72345. * @return {LevelRenderer.Render} this。
  72346. */
  72347. updateHoverShapes(shapes) {
  72348. this.painter.updateHoverLayer(shapes);
  72349. return this;
  72350. }
  72351. /**
  72352. * @function LevelRenderer.Render.prototype.getAllShapes
  72353. * @description 获取所有图形。
  72354. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  72355. */
  72356. getAllShapes() {
  72357. return this.storage._shapeList;
  72358. }
  72359. /**
  72360. * @function LevelRenderer.Render.prototype.clearAll
  72361. * @description 清除高亮和图形图层。
  72362. * @return {LevelRenderer.Render} this。
  72363. */
  72364. clearAll() {
  72365. this.clear();
  72366. this.painter.clearHover();
  72367. return this;
  72368. }
  72369. /**
  72370. * @function LevelRenderer.Render.prototype.getHoverOne
  72371. * @description 获取单个高亮图形,当前鼠标对应。
  72372. * @return {LevelRenderer.Shape} 高亮图形。
  72373. */
  72374. getHoverOne() {
  72375. return this.handler.getLastHoverOne();
  72376. }
  72377. static getFrameCallback(renderInstance) {
  72378. return function () {
  72379. var animatingElements = renderInstance.animatingElements;
  72380. //animatingElements instanceof Array 临时解决 destory 报错
  72381. if (animatingElements instanceof Array) {
  72382. for (var i = 0, l = animatingElements.length; i < l; i++) {
  72383. renderInstance.storage.mod(animatingElements[i].id);
  72384. }
  72385. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  72386. renderInstance.refresh();
  72387. }
  72388. }
  72389. };
  72390. }
  72391. // SMIC-方法扩展 - end
  72392. }
  72393. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  72394. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72395. * This program are made available under the terms of the Apache License, Version 2.0
  72396. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72397. /**
  72398. * @class LevelRenderer
  72399. * @deprecatedclass SuperMap.LevelRenderer
  72400. * @category Visualization Theme
  72401. * @classdesc LevelRenderer 渲染器
  72402. * @example
  72403. * //在渲染器上加上图形
  72404. * var levelRenderer = new LevelRenderer();
  72405. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  72406. * zr.clear();
  72407. * zr.addShape(new LevelRenderer.Shape.Circle({
  72408. * style:{
  72409. * x : 100,
  72410. * y : 100,
  72411. * r : 50,
  72412. * brushType: 'fill'
  72413. * }
  72414. * }));
  72415. * zr.render();
  72416. * @private
  72417. */
  72418. class LevelRenderer {
  72419. constructor() {
  72420. /**
  72421. * @member {Object} LevelRenderer.prototype._instances
  72422. * @description LevelRenderer 实例 map 索引
  72423. */
  72424. LevelRenderer._instances = {};
  72425. // 工具
  72426. LevelRenderer.Tool = {};
  72427. /**
  72428. * @member {string} LevelRenderer.prototype.version
  72429. * @description 版本。zRender(Baidu)的版本号
  72430. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  72431. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  72432. */
  72433. this.version = '2.0.4';
  72434. this.CLASS_NAME = "SuperMap.LevelRenderer";
  72435. }
  72436. /**
  72437. * @function LevelRenderer.prototype.destroy
  72438. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  72439. */
  72440. destroy() {
  72441. this.dispose();
  72442. this.version = null;
  72443. }
  72444. /**
  72445. * @function LevelRenderer.prototype.init
  72446. * @description 创建 LevelRenderer 实例。
  72447. * @param {HTMLElement} dom - 绘图容器。
  72448. * @returns {LevelRenderer} LevelRenderer 实例。
  72449. */
  72450. init(dom) {
  72451. var zr = new Render(Util_Util.createUniqueID("LRenderer_"), dom);
  72452. LevelRenderer._instances[zr.id] = zr;
  72453. return zr;
  72454. }
  72455. /**
  72456. * @function LevelRenderer.prototype.dispose
  72457. * @description LevelRenderer 实例销毁。
  72458. * 可以通过 zrender.dispose(zr) 销毁指定 LevelRenderer.Render 实例。
  72459. * 也可以通过 zr.dispose() 直接销毁
  72460. * @param {LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  72461. * @returns {LevelRenderer} this。
  72462. */
  72463. dispose(zr) {
  72464. if (zr) {
  72465. zr.dispose();
  72466. this.delInstance(zr.id);
  72467. } else {
  72468. for (var key in LevelRenderer._instances) {
  72469. LevelRenderer._instances[key].dispose();
  72470. }
  72471. LevelRenderer._instances = {};
  72472. }
  72473. return this;
  72474. }
  72475. /**
  72476. * @function LevelRenderer.prototype.getInstance
  72477. * @description 获取 LevelRenderer.Render 实例。
  72478. * @param {string} id - ZRender对象索引。
  72479. * @returns {LevelRenderer.Render} LevelRenderer.Render 实例。
  72480. */
  72481. getInstance(id) {
  72482. return LevelRenderer._instances[id];
  72483. }
  72484. /**
  72485. * @function LevelRenderer.prototype.delInstance
  72486. * @description 删除 zrender 实例,LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  72487. * @param {string} id - ZRender对象索引。
  72488. * @param {string} id - LevelRenderer.Render 对象索引。
  72489. * @returns {LevelRenderer} this。
  72490. */
  72491. delInstance(id) {
  72492. delete LevelRenderer._instances[id];
  72493. return this;
  72494. }
  72495. }
  72496. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  72497. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72498. * This program are made available under the terms of the Apache License, Version 2.0
  72499. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72500. /**
  72501. * @private
  72502. * @class LevelRenderer.Shape.SmicEllipse
  72503. * @category Visualization Theme
  72504. * @classdesc 椭圆。
  72505. * @extends LevelRenderer.Shape
  72506. * @example
  72507. * var shape = new LevelRenderer.Shape.SmicEllipse({
  72508. * style: {
  72509. * x: 100,
  72510. * y: 100,
  72511. * a: 40,
  72512. * b: 20,
  72513. * brushType: 'both',
  72514. * color: 'blue',
  72515. * strokeColor: 'red',
  72516. * lineWidth: 3,
  72517. * text: 'SmicEllipse'
  72518. * }
  72519. * });
  72520. * levelRenderer.addShape(shape);
  72521. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  72522. *
  72523. */
  72524. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  72525. constructor(options) {
  72526. super(options);
  72527. /**
  72528. * @member {string} LevelRenderer.Shape.SmicEllipse.prototype.type
  72529. * @description 图形类型。
  72530. */
  72531. this.type = 'smicellipse';
  72532. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72533. this.refOriginalPosition = [0, 0];
  72534. }
  72535. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  72536. }
  72537. /**
  72538. * @function LevelRenderer.Shape.SmicEllipse.prototype.destroy
  72539. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72540. */
  72541. destroy() {
  72542. this.type = null;
  72543. super.destroy();
  72544. }
  72545. /**
  72546. * @function LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  72547. * @description 构建椭圆的 Path。
  72548. *
  72549. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  72550. * @param {Object} style - style。
  72551. *
  72552. */
  72553. buildPath(ctx, style) {
  72554. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72555. this.refOriginalPosition = [0, 0];
  72556. }
  72557. var __OP = this.refOriginalPosition;
  72558. var k = 0.5522848;
  72559. var x = style.x + __OP[0];
  72560. var y = style.y + __OP[1];
  72561. var a = style.a;
  72562. var b = style.b;
  72563. var ox = a * k; // 水平控制点偏移量
  72564. var oy = b * k; // 垂直控制点偏移量
  72565. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  72566. ctx.moveTo(x - a, y);
  72567. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  72568. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  72569. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  72570. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  72571. ctx.closePath();
  72572. }
  72573. /**
  72574. * @function LevelRenderer.Shape.SmicEllipse.prototype.getRect
  72575. * @description 计算返回椭圆包围盒矩形
  72576. *
  72577. * @param {Object} style - style
  72578. * @return {Object} 边框对象。包含属性:x,y,width,height。
  72579. *
  72580. */
  72581. getRect(style) {
  72582. if (style.__rect) {
  72583. return style.__rect;
  72584. }
  72585. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72586. this.refOriginalPosition = [0, 0];
  72587. }
  72588. var __OP = this.refOriginalPosition;
  72589. var lineWidth;
  72590. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  72591. lineWidth = style.lineWidth || 1;
  72592. } else {
  72593. lineWidth = 0;
  72594. }
  72595. style.__rect = {
  72596. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  72597. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  72598. width: style.a * 2 + lineWidth,
  72599. height: style.b * 2 + lineWidth
  72600. };
  72601. return style.__rect;
  72602. }
  72603. }
  72604. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  72605. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72606. * This program are made available under the terms of the Apache License, Version 2.0
  72607. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72608. /**
  72609. * @private
  72610. * @class LevelRenderer.Shape.SmicIsogon
  72611. * @category Visualization Theme
  72612. * @classdesc 正多边形。
  72613. * @extends LevelRenderer.Shape
  72614. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  72615. */
  72616. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  72617. constructor(options) {
  72618. super(options);
  72619. /**
  72620. * @member {string} LevelRenderer.Shape.SmicIsogon.prototype.type
  72621. * @description 图形类型。
  72622. */
  72623. this.type = 'smicisogon';
  72624. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72625. this.refOriginalPosition = [0, 0];
  72626. }
  72627. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  72628. }
  72629. /**
  72630. * @function LevelRenderer.Shape.SmicIsogon.prototype.destroy
  72631. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72632. */
  72633. destroy() {
  72634. this.type = null;
  72635. super.destroy();
  72636. }
  72637. /**
  72638. * @function LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  72639. * @description 创建n角星(n>=3)路径。
  72640. *
  72641. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  72642. * @param {Object} style - style。
  72643. *
  72644. */
  72645. buildPath(ctx, style) {
  72646. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72647. this.refOriginalPosition = [0, 0];
  72648. }
  72649. var __OP = this.refOriginalPosition;
  72650. var sin = SUtil.Util_math.sin;
  72651. var cos = SUtil.Util_math.cos;
  72652. var PI = Math.PI;
  72653. var n = style.n;
  72654. if (!n || n < 2) {
  72655. return;
  72656. }
  72657. var x = style.x + __OP[0];
  72658. var y = style.y + __OP[1];
  72659. var r = style.r;
  72660. var dStep = 2 * PI / n;
  72661. var deg = -PI / 2;
  72662. var xStart = x + r * cos(deg);
  72663. var yStart = y + r * sin(deg);
  72664. deg += dStep;
  72665. // 记录边界点,用于判断insight
  72666. var pointList = style.pointList = [];
  72667. pointList.push([xStart, yStart]);
  72668. for (let i = 0, end = n - 1; i < end; i++) {
  72669. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  72670. deg += dStep;
  72671. }
  72672. pointList.push([xStart, yStart]);
  72673. // 绘制
  72674. ctx.moveTo(pointList[0][0], pointList[0][1]);
  72675. for (let i = 0; i < pointList.length; i++) {
  72676. ctx.lineTo(pointList[i][0], pointList[i][1]);
  72677. }
  72678. ctx.closePath();
  72679. return;
  72680. }
  72681. /**
  72682. * @function LevelRenderer.Shape.SmicIsogon.prototype.getRect
  72683. * @description 计算返回正多边形的包围盒矩形。
  72684. *
  72685. * @param {Object} style - style
  72686. * @return {Object} 边框对象。包含属性:x,y,width,height。
  72687. */
  72688. getRect(style) {
  72689. if (style.__rect) {
  72690. return style.__rect;
  72691. }
  72692. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72693. this.refOriginalPosition = [0, 0];
  72694. }
  72695. var __OP = this.refOriginalPosition;
  72696. var lineWidth;
  72697. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  72698. lineWidth = style.lineWidth || 1;
  72699. } else {
  72700. lineWidth = 0;
  72701. }
  72702. style.__rect = {
  72703. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  72704. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  72705. width: style.r * 2 + lineWidth,
  72706. height: style.r * 2 + lineWidth
  72707. };
  72708. return style.__rect;
  72709. }
  72710. }
  72711. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  72712. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72713. * This program are made available under the terms of the Apache License, Version 2.0
  72714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72715. /**
  72716. * @private
  72717. * @class LevelRenderer.Shape.SmicRing
  72718. * @category Visualization Theme
  72719. * @classdesc 圆环。
  72720. * @extends LevelRenderer.Shape
  72721. * @example
  72722. * var shape = new LevelRenderer.Shape.SmicRing({
  72723. * style: {
  72724. * x: 100,
  72725. * y: 100,
  72726. * r0: 30,
  72727. * r: 50
  72728. * }
  72729. * });
  72730. * levelRenderer.addShape(shape);
  72731. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  72732. */
  72733. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  72734. constructor(options) {
  72735. super(options);
  72736. /**
  72737. * @member {string} LevelRenderer.Shape.SmicRing.prototype.type
  72738. * @description 图形类型。
  72739. */
  72740. this.type = 'smicring';
  72741. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72742. this.refOriginalPosition = [0, 0];
  72743. }
  72744. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  72745. }
  72746. /**
  72747. * @function LevelRenderer.Shape.SmicRing.prototype.destroy
  72748. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72749. */
  72750. destroy() {
  72751. this.type = null;
  72752. super.destroy();
  72753. }
  72754. /**
  72755. * @function LevelRenderer.Shape.SmicRing.prototype.buildPath
  72756. * @description 创建圆环路径。
  72757. *
  72758. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  72759. * @param {Object} style - style。
  72760. *
  72761. */
  72762. buildPath(ctx, style) {
  72763. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72764. this.refOriginalPosition = [0, 0];
  72765. }
  72766. var __OP = this.refOriginalPosition;
  72767. // 非零环绕填充优化
  72768. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  72769. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  72770. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  72771. return;
  72772. }
  72773. /**
  72774. * @function LevelRenderer.Shape.SmicRing.prototype.getRect
  72775. * @description 计算返回圆环包围盒矩阵
  72776. *
  72777. * @param {Object} style - style
  72778. * @return {Object} 边框对象。包含属性:x,y,width,height。
  72779. */
  72780. getRect(style) {
  72781. if (style.__rect) {
  72782. return style.__rect;
  72783. }
  72784. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72785. this.refOriginalPosition = [0, 0];
  72786. }
  72787. var __OP = this.refOriginalPosition;
  72788. var lineWidth;
  72789. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  72790. lineWidth = style.lineWidth || 1;
  72791. } else {
  72792. lineWidth = 0;
  72793. }
  72794. style.__rect = {
  72795. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  72796. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  72797. width: style.r * 2 + lineWidth,
  72798. height: style.r * 2 + lineWidth
  72799. };
  72800. return style.__rect;
  72801. }
  72802. }
  72803. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  72804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72805. * This program are made available under the terms of the Apache License, Version 2.0
  72806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72807. /**
  72808. * @private
  72809. * @class LevelRenderer.Shape.SmicStar
  72810. * @category Visualization Theme
  72811. * @classdesc n 角星(n>3)。
  72812. * @extends LevelRenderer.Shape
  72813. * @example
  72814. * var shape = new LevelRenderer.Shape.SmicStar({
  72815. * style: {
  72816. * x: 200,
  72817. * y: 100,
  72818. * r: 150,
  72819. * n: 5,
  72820. * text: '五角星'
  72821. * }
  72822. * });
  72823. * levelRenderer.addShape(shape);
  72824. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  72825. *
  72826. */
  72827. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  72828. constructor(options) {
  72829. super(options);
  72830. /**
  72831. * @member {string} LevelRenderer.Shape.SmicStar.prototype.type
  72832. * @description 图形类型。
  72833. */
  72834. this.type = 'smicstar';
  72835. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72836. this.refOriginalPosition = [0, 0];
  72837. }
  72838. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  72839. }
  72840. /**
  72841. * @function LevelRenderer.Shape.SmicStar.prototype.destroy
  72842. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72843. */
  72844. destroy() {
  72845. this.type = null;
  72846. super.destroy();
  72847. }
  72848. /**
  72849. * @function LevelRenderer.Shape.SmicStar.prototype.buildPath
  72850. * @description 创建n 角星(n>3)路径。
  72851. *
  72852. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  72853. * @param {Object} style - style。
  72854. *
  72855. */
  72856. buildPath(ctx, style) {
  72857. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72858. this.refOriginalPosition = [0, 0];
  72859. }
  72860. var __OP = this.refOriginalPosition;
  72861. var n = style.n;
  72862. if (!n || n < 2) {
  72863. return;
  72864. }
  72865. var sin = SUtil.Util_math.sin;
  72866. var cos = SUtil.Util_math.cos;
  72867. var PI = Math.PI;
  72868. var x = style.x + __OP[0];
  72869. var y = style.y + __OP[1];
  72870. var r = style.r;
  72871. var r0 = style.r0;
  72872. // 如果未指定内部顶点外接圆半径,则自动计算
  72873. if (r0 == null) {
  72874. r0 = n > 4
  72875. // 相隔的外部顶点的连线的交点,
  72876. // 被取为内部交点,以此计算r0
  72877. ? r * cos(2 * PI / n) / cos(PI / n)
  72878. // 二三四角星的特殊处理
  72879. : r / 3;
  72880. }
  72881. var dStep = PI / n;
  72882. var deg = -PI / 2;
  72883. var xStart = x + r * cos(deg);
  72884. var yStart = y + r * sin(deg);
  72885. deg += dStep;
  72886. // 记录边界点,用于判断inside
  72887. var pointList = style.pointList = [];
  72888. pointList.push([xStart, yStart]);
  72889. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  72890. ri = i % 2 === 0 ? r0 : r;
  72891. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  72892. deg += dStep;
  72893. }
  72894. pointList.push([xStart, yStart]);
  72895. // 绘制
  72896. ctx.moveTo(pointList[0][0], pointList[0][1]);
  72897. for (let i = 0; i < pointList.length; i++) {
  72898. ctx.lineTo(pointList[i][0], pointList[i][1]);
  72899. }
  72900. ctx.closePath();
  72901. return;
  72902. }
  72903. /**
  72904. * @function LevelRenderer.Shape.SmicStar.prototype.getRect
  72905. * @description 返回 n 角星包围盒矩形。
  72906. *
  72907. * @param {Object} style - style
  72908. * @return {Object} 边框对象。包含属性:x,y,width,height。
  72909. */
  72910. getRect(style) {
  72911. if (style.__rect) {
  72912. return style.__rect;
  72913. }
  72914. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  72915. this.refOriginalPosition = [0, 0];
  72916. }
  72917. var __OP = this.refOriginalPosition;
  72918. var lineWidth;
  72919. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  72920. lineWidth = style.lineWidth || 1;
  72921. } else {
  72922. lineWidth = 0;
  72923. }
  72924. style.__rect = {
  72925. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  72926. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  72927. width: style.r * 2 + lineWidth,
  72928. height: style.r * 2 + lineWidth
  72929. };
  72930. return style.__rect;
  72931. }
  72932. }
  72933. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  72934. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72935. * This program are made available under the terms of the Apache License, Version 2.0
  72936. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72937. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/Transform.js
  72938. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72939. * This program are made available under the terms of the Apache License, Version 2.0
  72940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72941. function wrap(source, min, max) {
  72942. if (source === max || source === min) {
  72943. return source;
  72944. }
  72945. let len = max - min;
  72946. return ((source - min) % len + len) % len + min
  72947. }
  72948. function rad(angle) {
  72949. return angle * Math.PI / 180;
  72950. }
  72951. var Projection = {
  72952. R: 6378137,
  72953. minZoom: 0,
  72954. maxZoom: 22,
  72955. nativeMaxZoom: 19,
  72956. RAD: Math.PI / 180,
  72957. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  72958. MAX_LATITUDE: 85.0511287798,
  72959. project: function (lngLat) {
  72960. const rad = this.RAD,
  72961. metersPerDegree = this.METERS_PER_DEGREE,
  72962. max = this.MAX_LATITUDE;
  72963. let ll = (lngLat instanceof Array)
  72964. ? {lng: lngLat[0], lat: lngLat[1]}
  72965. : {lng: lngLat.lng, lat: lngLat.lat};
  72966. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  72967. let c;
  72968. if (lat === 0) {
  72969. c = 0;
  72970. } else {
  72971. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  72972. }
  72973. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  72974. },
  72975. unproject: function (point) {
  72976. const x = point.x,
  72977. y = point.y;
  72978. const rad = this.RAD,
  72979. metersPerDegree = this.METERS_PER_DEGREE;
  72980. let c;
  72981. if (y === 0) {
  72982. c = 0;
  72983. } else {
  72984. c = y / metersPerDegree;
  72985. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  72986. }
  72987. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  72988. },
  72989. locate: function (lngLat, dx, dy) {
  72990. if (!lngLat) {
  72991. return null;
  72992. }
  72993. dx = !dx ? 0 : dx;
  72994. dy = !dy ? 0 : dy;
  72995. if (!dx && !dy) {
  72996. return lngLat;
  72997. }
  72998. let lng = lngLat.lng;
  72999. if (dx !== 0) {
  73000. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  73001. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  73002. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  73003. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  73004. }
  73005. let lat = lngLat.lat;
  73006. if (dy !== 0) {
  73007. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  73008. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  73009. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  73010. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  73011. }
  73012. return {lng, lat};
  73013. },
  73014. getResolution: function (zoom) {
  73015. if (!this.resolutions) {
  73016. var resolutions = [];
  73017. var d = 2 * 6378137 * Math.PI;
  73018. for (var i = 0; i <= this.maxZoom; i++) {
  73019. resolutions[i] = d / (256 * Math.pow(2, i));
  73020. }
  73021. this.resolutions = resolutions;
  73022. }
  73023. let z = (zoom | 0), length = this.resolutions.length;
  73024. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  73025. const res = this.resolutions[z];
  73026. if ((zoom | 0) !== zoom && z !== length - 1) {
  73027. const next = this.resolutions[z + 1];
  73028. return res + (next - res) * (zoom - z);
  73029. }
  73030. return res;
  73031. }
  73032. };
  73033. var Transform = {
  73034. matrix: [1, -1, 0, 0],
  73035. projection: Projection,
  73036. project: function (lngLat) {
  73037. return this.projection.project(lngLat);
  73038. },
  73039. unproject: function (point) {
  73040. return this.projection.unproject(point);
  73041. },
  73042. lngLatToPoint: function (lngLat, zoom) {
  73043. var pt = this.project(lngLat);
  73044. return this.transform(pt, this.projection.getResolution(zoom));
  73045. },
  73046. locate: function (lngLat, dx, dy) {
  73047. return this.projection.locate(lngLat, dx, dy);
  73048. },
  73049. transform: function (point, scale) {
  73050. return {
  73051. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  73052. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  73053. };
  73054. }
  73055. };
  73056. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  73057. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73058. * This program are made available under the terms of the Apache License, Version 2.0
  73059. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73060. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  73061. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73062. * This program are made available under the terms of the Apache License, Version 2.0
  73063. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73064. /**
  73065. * @description 该文件用于存储一些公用常量
  73066. * @private
  73067. */
  73068. const FileTypes = {
  73069. EXCEL: "EXCEL",
  73070. CSV: "CSV",
  73071. ISERVER: "ISERVER",
  73072. GEOJSON: "GEOJSON",
  73073. JSON: 'JSON'
  73074. };
  73075. const FileConfig = {
  73076. fileMaxSize: 10 * 1024 * 1024
  73077. };
  73078. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  73079. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73080. * This program are made available under the terms of the Apache License, Version 2.0
  73081. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73082. /**
  73083. * @class FileModel
  73084. * @deprecatedclass SuperMap.FileModel
  73085. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  73086. * @category Components OpenFile
  73087. * @private
  73088. */
  73089. class FileModel {
  73090. constructor(options) {
  73091. this.FileTypes = FileTypes;
  73092. this.FileConfig = FileConfig;
  73093. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  73094. }
  73095. /**
  73096. * @function FileModel.prototype.set
  73097. * @description 设置属性值
  73098. * @param {string} key - 属性名称
  73099. * @param {string|Object} value - 属性值
  73100. */
  73101. set(key, value) {
  73102. this[key] = value;
  73103. }
  73104. /**
  73105. * @function FileModel.prototype.get
  73106. * @description 获取数据值
  73107. * @param {string} key - 属性名称
  73108. * @returns {string|Object} value - 返回属性值
  73109. */
  73110. get(key) {
  73111. return this[key];
  73112. }
  73113. }
  73114. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  73115. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73116. * This program are made available under the terms of the Apache License, Version 2.0
  73117. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73118. /**
  73119. * @class MessageBox
  73120. * @aliasclass Components.MessageBox
  73121. * @deprecatedclass SuperMap.Components.MessageBox
  73122. * @version 9.1.1
  73123. * @classdesc 组件信息提示框。
  73124. * @category Components Common
  73125. * @usage
  73126. */
  73127. class MessageBox {
  73128. constructor() {
  73129. this._initView();
  73130. }
  73131. _initView() {
  73132. //原生js形式
  73133. const messageBoxContainer = document.createElement("div");
  73134. messageBoxContainer.hidden = true;
  73135. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  73136. //图标
  73137. const iconContainer = document.createElement("div");
  73138. iconContainer.setAttribute("class", "icon");
  73139. this.icon = document.createElement("span");
  73140. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  73141. iconContainer.appendChild(this.icon);
  73142. messageBoxContainer.appendChild(iconContainer);
  73143. //内容:
  73144. const messageBox = document.createElement("div");
  73145. messageBox.setAttribute("class", "component-messagebox");
  73146. messageBox.innerHTML = "";
  73147. messageBoxContainer.appendChild(messageBox);
  73148. this.messageBox = messageBox;
  73149. //关闭按钮
  73150. const cancelContainer = document.createElement("div");
  73151. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  73152. const cancelBtn = document.createElement("button");
  73153. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  73154. cancelBtn.innerHTML = "x";
  73155. cancelBtn.onclick = this.closeView.bind(this);
  73156. cancelContainer.appendChild(cancelBtn);
  73157. messageBoxContainer.appendChild(cancelContainer);
  73158. this.messageBoxContainer = messageBoxContainer;
  73159. document.body.appendChild(this.messageBoxContainer);
  73160. }
  73161. /**
  73162. * @function MessageBox.prototype.closeView
  73163. * @description 关闭提示框。
  73164. */
  73165. closeView() {
  73166. this.messageBoxContainer.hidden = true;
  73167. }
  73168. /**
  73169. * @function MessageBox.prototype.showView
  73170. * @description 显示提示框。
  73171. * @param {string} message - 提示框显示内容。
  73172. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  73173. */
  73174. showView(message, type = 'warring') {
  73175. //设置提示框的样式:
  73176. if (type === "success") {
  73177. this.icon.setAttribute("class", "supermapol-icons-message-success");
  73178. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  73179. } else if (type === "failure") {
  73180. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  73181. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  73182. } else if (type === "warring") {
  73183. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  73184. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  73185. }
  73186. this.messageBox.innerHTML = message;
  73187. this.messageBoxContainer.hidden = false;
  73188. }
  73189. }
  73190. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  73191. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  73192. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  73193. 
  73194. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73195. * This program are made available under the terms of the Apache License, Version 2.0
  73196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73197. /**
  73198. * Namespace: SuperMap.Lang["en"]
  73199. * Dictionary for English. Keys for entries are used in calls to
  73200. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  73201. * strings formatted for use with <SuperMap.String.format> calls.
  73202. */
  73203. let en = {
  73204. 'title_dataFlowService': 'Data Flow Service',
  73205. 'title_distributedAnalysis': 'Distributed Analysis',
  73206. 'title_clientComputing': 'Client Computing',
  73207. 'title_dataServiceQuery': 'Data Service Query',
  73208. 'title_searchCity':'Search city',
  73209. 'title_searchLayer':' Search layer',
  73210. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  73211. 'text_displayFeaturesInfo': 'Display feature information',
  73212. 'text_subscribe': 'subscribe',
  73213. 'text_cancelSubscribe': 'unsubscribe',
  73214. 'text_densityAnalysis': 'Density Analysis',
  73215. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  73216. 'text_option_selectDataset':'Please select a dataset',
  73217. 'text_label_dataset': 'Dataset',
  73218. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  73219. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  73220. 'text_label_analyticalMethod': 'Analytical method',
  73221. 'text_option_quadrilateral': 'Quadrilateral',
  73222. 'text_option_hexagon': 'hexagon',
  73223. 'text_label_meshType': 'Mesh type',
  73224. 'text_option_notSet': 'Not set',
  73225. 'text_label_weightField': 'Weight field',
  73226. 'text_label_gridSizeInMeters': 'Grid size',
  73227. 'text_label_searchRadius': 'Search radius',
  73228. 'text_label_queryRange': 'Scope of analysis',
  73229. 'text_label_areaUnit': 'Area unit',
  73230. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  73231. 'text_option_logarithm': 'Logarithm',
  73232. 'text_option_equalCountingSegment': 'Equal counting segment',
  73233. 'text_option_squareRootSegmentation': 'Square root segmentation',
  73234. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  73235. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  73236. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  73237. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  73238. 'text_option_rainbowGradient': 'Rainbow gradient',
  73239. 'text_option_spectralGradient': 'Spectral gradient',
  73240. 'text_option_terrainGradient': 'Terrain gradient',
  73241. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  73242. 'text_label_resultLayerName': 'Result layer name',
  73243. 'text_chooseFile': 'Open File',
  73244. 'text_isoline': 'Isoline',
  73245. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  73246. 'text_buffer': 'Buffer',
  73247. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  73248. 'text_label_analysisLayer': 'Analysis layer',
  73249. 'text_label_extractField': 'Extract field',
  73250. 'text_label_extractedValue': 'Extracted value',
  73251. 'text_label_distanceAttenuation': 'Distance attenuation',
  73252. 'text_label_gridSize': 'gridSize',
  73253. 'text_label_bufferRadius': 'Buffer radius',
  73254. 'text_label_defaultkilometers': 'Default 10 kilometers',
  73255. 'text_label_kilometer': 'kilometer',
  73256. 'text_label_unit': 'unit',
  73257. 'text_retainOriginal': 'Retain original object field',
  73258. 'text_mergeBuffer': 'Merge buffer',
  73259. 'text_label_color': 'Color',
  73260. 'text_label_buffer': '[Buffer]',
  73261. 'text_label_isolines': '[Isolines]',
  73262. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  73263. 'text_label_queryModel': 'Query mode',
  73264. 'text_label_IDArrayOfFeatures': 'ID array of features',
  73265. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  73266. 'text_label_bufferDistance': 'Buffer distance',
  73267. 'text_label_queryRange1': 'Query range',
  73268. 'text_label_spatialQueryMode': 'Spatial query mode',
  73269. 'text_label_featureFilter': 'Feature filter',
  73270. 'text_label_geometricObject': 'Geometric object',
  73271. 'text_label_queryMode': 'Query mode',
  73272. 'text_label_searchTips': 'Search for city locations or layer features',
  73273. 'text_label_chooseSearchLayers': 'Select a query layer',
  73274. 'text_loadSearchCriteria': 'Load search criteria',
  73275. 'text_saveSearchCriteria': 'Save search criteria',
  73276. "btn_analyze": "Analyze",
  73277. "btn_analyzing": "Analyzing",
  73278. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  73279. "btn_cancelAnalysis": "Cancel",
  73280. "btn_query": "Query",
  73281. "btn_querying": "Querying",
  73282. "btn_emptyTheRresultLayer": "Clear all result layers",
  73283. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  73284. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  73285. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  73286. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  73287. 'msg_selectDataset': 'Please select a data set!',
  73288. 'msg_setTheWeightField': 'Please set the weight field!',
  73289. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  73290. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  73291. 'msg_openFileFail': 'Failed to open file!',
  73292. 'msg_fileTypeUnsupported': 'File format is not supported!',
  73293. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  73294. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  73295. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  73296. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  73297. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  73298. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  73299. 'msg_getFeatureField':"No related vector features found!",
  73300. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  73301. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  73302. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  73303. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  73304. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  73305. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  73306. 'msg_getdatafailed': 'Failed to get data!'
  73307. };
  73308. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  73309. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73310. * This program are made available under the terms of the Apache License, Version 2.0
  73311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73312. /**
  73313. * Namespace: SuperMap.Lang["zh-CN"]
  73314. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  73315. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  73316. * strings formatted for use with <SuperMap.String.format> calls.
  73317. */
  73318. let zh = {
  73319. 'title_dataFlowService': '数据流服务',
  73320. 'title_distributedAnalysis': '分布式分析',
  73321. 'title_clientComputing': '客户端计算',
  73322. 'title_dataServiceQuery': '数据服务查询',
  73323. 'title_searchCity':'搜索城市',
  73324. 'title_searchLayer':'搜索图层',
  73325. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  73326. 'text_displayFeaturesInfo': '显示要素信息',
  73327. 'text_subscribe': '订阅',
  73328. 'text_cancelSubscribe': '取消订阅',
  73329. 'text_densityAnalysis': '密度分析',
  73330. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  73331. 'text_option_selectDataset':'请选择数据集',
  73332. 'text_label_dataset': '数据集',
  73333. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  73334. 'text_option_nuclearDensityAnalysis': '核密度分析',
  73335. 'text_label_analyticalMethod': '分析方法',
  73336. 'text_option_quadrilateral': '四边形',
  73337. 'text_option_hexagon': '六边形',
  73338. 'text_label_meshType': '网格面类型',
  73339. 'text_option_notSet': '未设置',
  73340. 'text_label_weightField': '权重字段',
  73341. 'text_label_gridSizeInMeters': '网格大小',
  73342. 'text_label_searchRadius': '搜索半径',
  73343. 'text_label_queryRange': '分析范围',
  73344. 'text_label_areaUnit': '面积单位',
  73345. 'text_option_equidistantSegmentation': '等距离分段',
  73346. 'text_option_logarithm': '对数',
  73347. 'text_option_equalCountingSegment': '等计数分段',
  73348. 'text_option_squareRootSegmentation': '平方根分段',
  73349. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  73350. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  73351. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  73352. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  73353. 'text_option_rainbowGradient': '彩虹渐变',
  73354. 'text_option_spectralGradient': '光谱渐变',
  73355. 'text_option_terrainGradient': '地形渐变',
  73356. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  73357. 'text_label_resultLayerName': '结果图层名称',
  73358. 'text_chooseFile': '选择文件',
  73359. 'text_isoline': '等值线',
  73360. 'text_extractDiscreteValue': '提取离散值生成曲线',
  73361. 'text_buffer': '缓冲区',
  73362. 'text_specifyTheDistance': '指定距离创建周边区域',
  73363. 'text_label_analysisLayer': '分析图层',
  73364. 'text_label_extractField': '提取字段',
  73365. 'text_label_extractedValue': '提取值',
  73366. 'text_label_distanceAttenuation': '距离衰减',
  73367. 'text_label_gridSize': '栅格大小',
  73368. 'text_label_bufferRadius': '缓冲半径',
  73369. 'text_label_defaultkilometers': '默认10千米',
  73370. 'text_option_kilometer': '千米',
  73371. 'text_label_unit': '单位',
  73372. 'text_retainOriginal': '保留原对象字段属性',
  73373. 'text_mergeBuffer': '合并缓冲区',
  73374. 'text_label_color': '颜色',
  73375. 'text_label_buffer': '[缓冲区]',
  73376. 'text_label_isolines': '[等值线]',
  73377. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  73378. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  73379. 'text_label_maxFeatures': '最多可返回的要素数量',
  73380. 'text_label_bufferDistance': '缓冲区距离',
  73381. 'text_label_queryRange1': '查询范围',
  73382. 'text_label_spatialQueryMode': '空间查询模式',
  73383. 'text_label_featureFilter': '要素过滤器',
  73384. 'text_label_geometricObject': '几何对象',
  73385. 'text_label_queryMode': '查询模式',
  73386. 'text_label_searchTips': '搜索城市地点或图层要素',
  73387. 'text_label_chooseSearchLayers': '选择查询图层',
  73388. 'text_loadSearchCriteria': '加载搜索条件',
  73389. 'text_saveSearchCriteria': '保存搜索条件',
  73390. "btn_analyze": "分析",
  73391. "btn_analyzing": "分析中",
  73392. "btn_emptyTheAnalysisLayer": "清空分析图层",
  73393. "btn_cancelAnalysis": "取消",
  73394. "btn_query": "查询",
  73395. "btn_querying": "查询中",
  73396. "btn_emptyTheRresultLayer": "清除所有结果图层",
  73397. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  73398. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  73399. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  73400. 'msg_selectDataset': '请选择数据集!',
  73401. 'msg_setTheWeightField': '请设置权重字段!',
  73402. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  73403. 'msg_resultIsEmpty': '分析的结果为空!',
  73404. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  73405. 'msg_openFileFail': '打开文件失败!',
  73406. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  73407. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  73408. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  73409. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  73410. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  73411. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  73412. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  73413. 'msg_getFeatureField':"未查找到相关矢量要素!",
  73414. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  73415. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  73416. 'msg_crsunsupport':'不支持当前地图的坐标系',
  73417. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  73418. 'msg_jsonResolveFiled': 'json格式解析失败!',
  73419. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  73420. 'msg_getdatafailed': '获取数据失败!'
  73421. };
  73422. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  73423. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73424. * This program are made available under the terms of the Apache License, Version 2.0
  73425. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73426. /**
  73427. * @name Lang
  73428. * @namespace
  73429. * @category BaseTypes Internationalization
  73430. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  73431. * @usage
  73432. * ```
  73433. * // 浏览器
  73434. * <script type="text/javascript" src="{cdn}"></script>
  73435. * <script>
  73436. * const result = {namespace}.Lang.getCode();
  73437. *
  73438. * // 弃用的写法
  73439. * const result = SuperMap.Lang.getCode();
  73440. *
  73441. * </script>
  73442. *
  73443. * // ES6 Import
  73444. * import { Lang } from '{npm}';
  73445. *
  73446. * const result = Lang.getCode();
  73447. *
  73448. * ```
  73449. */
  73450. let Lang = {
  73451. 'en-US': en,
  73452. "zh-CN": zh,
  73453. /**
  73454. * @member {string} Lang.code
  73455. * @description 当前所使用的语言类型。
  73456. */
  73457. code: null,
  73458. /**
  73459. * @member {string} [Lang.defaultCode='en-US']
  73460. * @description 默认使用的语言类型。
  73461. */
  73462. defaultCode: "en-US",
  73463. /**
  73464. * @function Lang.getCode
  73465. * @description 获取当前的语言代码。
  73466. * @returns {string} 当前的语言代码。
  73467. */
  73468. getCode: function () {
  73469. if (!Lang.code) {
  73470. Lang.setCode();
  73471. }
  73472. return Lang.code;
  73473. },
  73474. /**
  73475. * @function Lang.setCode
  73476. * @description 设置语言代码。
  73477. * @param {string} code - 此参数遵循IETF规范。
  73478. */
  73479. setCode: function () {
  73480. var lang = this.getLanguageFromCookie();
  73481. if (!lang) {
  73482. lang = Lang.defaultCode;
  73483. if (navigator.appName === 'Netscape') {
  73484. lang = navigator.language;
  73485. } else {
  73486. lang = navigator.browserLanguage;
  73487. }
  73488. }
  73489. if (lang.indexOf('zh') === 0) {
  73490. lang = 'zh-CN';
  73491. }
  73492. if (lang.indexOf('en') === 0) {
  73493. lang = 'en-US';
  73494. }
  73495. Lang.code = lang;
  73496. },
  73497. /**
  73498. * @function Lang.getLanguageFromCookie
  73499. * @description 从 cookie 中获取语言类型。
  73500. */
  73501. getLanguageFromCookie() {
  73502. var name = 'language=';
  73503. var ca = document.cookie.split(';');
  73504. for (var i = 0; i < ca.length; i++) {
  73505. var c = ca[i];
  73506. while (c.charAt(0) === ' ') {
  73507. c = c.substring(1)
  73508. }
  73509. if (c.indexOf(name) !== -1) {
  73510. return c.substring(name.length, c.length)
  73511. }
  73512. }
  73513. return "";
  73514. },
  73515. /**
  73516. * @function Lang.i18n
  73517. * @description 从当前语言字符串的字典查找 key。
  73518. * @param {string} key - 字典中 i18n 字符串值的关键字。
  73519. * @returns {string} 国际化的字符串。
  73520. */
  73521. i18n: function (key) {
  73522. var dictionary = Lang[Lang.getCode()];
  73523. var message = dictionary && dictionary[key];
  73524. if (!message) {
  73525. // Message not found, fall back to message key
  73526. message = key;
  73527. }
  73528. return message;
  73529. }
  73530. };
  73531. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  73532. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  73533. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  73534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73535. * This program are made available under the terms of the Apache License, Version 2.0
  73536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73537. /**
  73538. * @name FileReaderUtil
  73539. * @namespace
  73540. * @category Components OpenFile
  73541. * @description 组件读取文件工具类。
  73542. * @version 9.1.1
  73543. * @type {{rABS: (boolean|*), rABF: (boolean|*), rAT: (boolean|*), readFile: (function(*, *=, *=, *=, *=)), readTextFile: (function(*, *=, *=, *=)), readXLSXFile: (function(*, *=, *=, *=)), processDataToGeoJson: (function(string, Object): GeoJSONObject), processExcelDataToGeoJson: (function(Object): GeoJSONObject), isXField: (function(*)), isYField: (function(*)), string2Csv: (function(*, *=))}}
  73544. * @usage
  73545. * ```
  73546. * // 浏览器
  73547. * <script type="text/javascript" src="{cdn}"></script>
  73548. * <script>
  73549. * const result = {namespace}.Components.FileReaderUtil.isXField(data);
  73550. *
  73551. * // 弃用的写法
  73552. * const result = SuperMap.Components.FileReaderUtil.isXField(data);
  73553. *
  73554. * </script>
  73555. *
  73556. * // ES6 Import
  73557. * import { FileReaderUtil } from '{npm}';
  73558. *
  73559. * const result = FileReaderUtil.isXField(data);
  73560. * ```
  73561. */
  73562. let FileReaderUtil = {
  73563. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  73564. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  73565. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  73566. /**
  73567. * @function FileReaderUtil.prototype.readFile
  73568. * @description 读取文件。
  73569. * @param {string} fileType - 当前读取的文件类型。
  73570. *
  73571. * @param {Object} file - 读取回来的文件内容对象。
  73572. * @param {function} success - 读取文件成功回调函数。
  73573. * @param {function} failed - 读取文件失败回调函数。
  73574. * @param {Object} context - 回调重定向对象。
  73575. */
  73576. readFile(fileType, file, success, failed, context) {
  73577. if (FileTypes.JSON === fileType || FileTypes.GEOJSON === fileType) {
  73578. this.readTextFile(file, success, failed, context)
  73579. } else if (FileTypes.EXCEL === fileType || FileTypes.CSV === fileType) {
  73580. this.readXLSXFile(file, success, failed, context)
  73581. }
  73582. },
  73583. /**
  73584. * @description 读取文本文件。
  73585. * @param {Object} file 文件内容对象。
  73586. * @param {function} success 读取文件成功回调函数。
  73587. * @param {function} failed 读取文件失败回调函数。
  73588. * @param {Object} context - 回调重定向对象。
  73589. */
  73590. readTextFile(file, success, failed, context) {
  73591. let reader = new FileReader();
  73592. reader.onloadend = function (evt) {
  73593. success && success.call(context, evt.target.result);
  73594. };
  73595. reader.onerror = function (error) {
  73596. failed && failed.call(context, error)
  73597. };
  73598. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  73599. },
  73600. /**
  73601. * @description 读取excel或csv文件。
  73602. * @param {Object} file 文件内容对象。
  73603. * @param {function} success 读取文件成功回调函数。
  73604. * @param {function} failed 读取文件失败回调函数。
  73605. * @param {Object} context - 回调重定向对象。
  73606. */
  73607. readXLSXFile(file, success, failed, context) {
  73608. let reader = new FileReader();
  73609. reader.onloadend = function (evt) {
  73610. let xLSXData = new Uint8Array(evt.target.result);
  73611. let workbook = external_function_try_return_XLSX_catch_e_return_namespaceObject.read(xLSXData, {type: "array"});
  73612. try {
  73613. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  73614. //暂时只读取第一个sheets的内容
  73615. let sheetName = workbook.SheetNames[0];
  73616. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_namespaceObject.utils.sheet_to_csv(workbook.Sheets[sheetName]);
  73617. success && success.call(context, xLSXCSVString);
  73618. }
  73619. } catch (error) {
  73620. failed && failed.call(context, error);
  73621. }
  73622. };
  73623. reader.onerror = function (error) {
  73624. failed && failed.call(context, error)
  73625. };
  73626. this.rABF && reader.readAsArrayBuffer(file.file);
  73627. },
  73628. /**
  73629. * @function FileReaderUtil.prototype.processDataToGeoJson
  73630. * @description 将读取回来得数据统一处理为 GeoJSON 格式。
  73631. * @param {string} type - 文件类型。
  73632. * @param {Object} data - 读取返回的数据对象。
  73633. * @param {function} success - 数据处理成功的回调。
  73634. * @param {function} failed - 数据处理失败的回调。
  73635. * @param {Object} context - 回调重定向对象。
  73636. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  73637. * @private
  73638. */
  73639. processDataToGeoJson(type, data, success, failed, context) {
  73640. let geojson = null;
  73641. if (type === "EXCEL" || type === "CSV") {
  73642. geojson = this.processExcelDataToGeoJson(data);
  73643. success && success.call(context, geojson);
  73644. } else if (type === 'JSON' || type === 'GEOJSON') {
  73645. let result = data;
  73646. //geojson、json未知,通过类容来判断
  73647. if ((typeof result) === "string") {
  73648. result = JSON.parse(result);
  73649. }
  73650. if (result.type === 'ISERVER') {
  73651. geojson = result.data.recordsets[0].features;
  73652. } else if (result.type === 'FeatureCollection') {
  73653. //geojson
  73654. geojson = result;
  73655. } else {
  73656. //不支持数据
  73657. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  73658. }
  73659. success && success.call(context, geojson);
  73660. } else {
  73661. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  73662. }
  73663. },
  73664. /**
  73665. * @function FileReaderUtil.prototype.processExcelDataToGeoJson
  73666. * @description 表格文件数据处理。
  73667. * @param {Object} data - 读取的表格文件数据。
  73668. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  73669. * @private
  73670. */
  73671. processExcelDataToGeoJson(data) {
  73672. //处理为对象格式转化
  73673. let dataContent = this.string2Csv(data);
  73674. let fieldCaptions = dataContent.colTitles;
  73675. //位置属性处理
  73676. let xfieldIndex = -1,
  73677. yfieldIndex = -1;
  73678. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  73679. if (this.isXField(fieldCaptions[i])) {
  73680. xfieldIndex = i;
  73681. }
  73682. if (this.isYField(fieldCaptions[i])) {
  73683. yfieldIndex = i;
  73684. }
  73685. }
  73686. // feature 构建后期支持坐标系 4326/3857
  73687. let features = [];
  73688. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  73689. let row = dataContent.rows[i];
  73690. //if (featureFrom === "LonLat") {
  73691. let x = Number(row[xfieldIndex]),
  73692. y = Number(row[yfieldIndex]);
  73693. //属性信息
  73694. let attributes = {};
  73695. for (let index in dataContent.colTitles) {
  73696. let key = dataContent.colTitles[index];
  73697. attributes[key] = dataContent.rows[i][index];
  73698. }
  73699. //目前csv 只支持处理点,所以先生成点类型的 geojson
  73700. let feature = {
  73701. "type": "Feature",
  73702. "geometry": {
  73703. "type": "Point",
  73704. "coordinates": [x, y]
  73705. },
  73706. "properties": attributes
  73707. };
  73708. features.push(feature);
  73709. }
  73710. return features;
  73711. },
  73712. /**
  73713. * @description 判断是否地理X坐标。
  73714. * @param {string} data 字段名。
  73715. */
  73716. isXField(data) {
  73717. var lowerdata = data.toLowerCase();
  73718. return (lowerdata === "x" || lowerdata === "smx" ||
  73719. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  73720. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  73721. },
  73722. /**
  73723. * @description 判断是否地理Y坐标。
  73724. * @param {string} data 字段名。
  73725. */
  73726. isYField(data) {
  73727. var lowerdata = data.toLowerCase();
  73728. return (lowerdata === "y" || lowerdata === "smy" ||
  73729. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  73730. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  73731. },
  73732. /**
  73733. * @description 字符串转为dataEditor 支持的csv格式数据。
  73734. * @param {string} string 待转化的字符串。
  73735. * @param {boolean} withoutTitle 是否需要列标题。
  73736. */
  73737. string2Csv(string, withoutTitle) {
  73738. // let rows = string.split('\r\n');
  73739. let rows = string.split('\n');
  73740. let result = {};
  73741. if (!withoutTitle) {
  73742. result["colTitles"] = rows[0].split(',');
  73743. } else {
  73744. result["colTitles"] = [];
  73745. }
  73746. result['rows'] = [];
  73747. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  73748. rows[i] && result['rows'].push(rows[i].split(','));
  73749. }
  73750. return result;
  73751. }
  73752. };
  73753. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  73754. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73755. * This program are made available under the terms of the Apache License, Version 2.0
  73756. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73757. /**
  73758. * @class ChartModel
  73759. * @classdesc 图表组件数据模型
  73760. * @private
  73761. * @param {Object} datasets - 数据来源。
  73762. * @category Components Chart
  73763. * @fires ChartModel#getdatafailed
  73764. */
  73765. class ChartModel {
  73766. constructor(datasets) {
  73767. this.datasets = datasets;
  73768. this.EVENT_TYPES = ['getdatafailed'];
  73769. this.events = new Events(this, null, this.EVENT_TYPES);
  73770. }
  73771. /**
  73772. * @private
  73773. * @function ChartModel.prototype.getDatasetInfo
  73774. * @description 获得数据集数据。
  73775. * @param {string} datasetUrl - 数据集资源地址。
  73776. */
  73777. getDatasetInfo(success) {
  73778. let datasetUrl = this.datasets.url;
  73779. let me = this;
  73780. FetchRequest.get(datasetUrl)
  73781. .then(function (response) {
  73782. return response.json();
  73783. })
  73784. .then(function (results) {
  73785. if (results.datasetInfo) {
  73786. let datasetInfo = results.datasetInfo;
  73787. me.datasetsInfo = {
  73788. dataSourceName: datasetInfo.dataSourceName,
  73789. datasetName: datasetInfo.name,
  73790. mapName: results.name
  73791. };
  73792. success({
  73793. result: me.datasetsInfo
  73794. });
  73795. }
  73796. })
  73797. .catch(function (error) {
  73798. console.log(error);
  73799. me._fireFailedEvent(error);
  73800. });
  73801. }
  73802. /**
  73803. * @private
  73804. * @function ChartModel.prototype.getDataFeatures
  73805. * @description 请求数据集的数据信息
  73806. * @param {Object} results - 数据集信息。
  73807. * @param {function} success - 成功回调函数。
  73808. */
  73809. getDataFeatures(results, success) {
  73810. let datasetsInfo = results.result;
  73811. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  73812. let params = {
  73813. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  73814. };
  73815. Object.assign(params, this.datasets.queryInfo);
  73816. getFeatureParam = new FilterParameter(params);
  73817. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  73818. queryParameter: getFeatureParam,
  73819. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  73820. fromIndex: 0,
  73821. toIndex: 100000
  73822. });
  73823. getFeatureBySQLService = new GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  73824. eventListeners: {
  73825. processCompleted: success,
  73826. processFailed: function () {}
  73827. }
  73828. });
  73829. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  73830. }
  73831. /**
  73832. * @private
  73833. * @function ChartModel.prototype.getLayerFeatures
  73834. * @description 请求图层要素的数据信息
  73835. * @param {Object} results - 数据集信息。
  73836. * @param {Callbacks} success - 成功回调函数。
  73837. */
  73838. getLayerFeatures(results, success) {
  73839. let datasetsInfo = results.result;
  73840. let queryParam, queryBySQLParams, queryBySQLService;
  73841. let params = {
  73842. name: datasetsInfo.mapName
  73843. };
  73844. Object.assign(params, this.datasets.queryInfo);
  73845. queryParam = new FilterParameter(params);
  73846. queryBySQLParams = new QueryBySQLParameters({
  73847. queryParams: [queryParam],
  73848. expectCount: 100000
  73849. });
  73850. queryBySQLService = new QueryBySQLService(datasetsInfo.dataUrl, {
  73851. eventListeners: {
  73852. processCompleted: success,
  73853. processFailed: function () {}
  73854. }
  73855. });
  73856. queryBySQLService.processAsync(queryBySQLParams);
  73857. }
  73858. /**
  73859. * @private
  73860. * @function ChartModel.prototype.getDataInfoByIptl
  73861. * @description 用dataId获取iportal的数据。
  73862. * @param {Callbacks} success - 成功回调函数。
  73863. *
  73864. */
  73865. getDataInfoByIptl(success) {
  73866. // success是chart的回调
  73867. this.getServiceInfo(this.datasets.url, success);
  73868. }
  73869. /**
  73870. * @private
  73871. * @function ChartModel.prototype.getServiceInfo
  73872. * @description 用iportal获取dataItemServices。
  73873. * @param {string} url
  73874. * @param {Callbacks} success - 成功回调函数。
  73875. * */
  73876. getServiceInfo(url, success) {
  73877. let me = this;
  73878. FetchRequest.get(url, null, {
  73879. withCredentials: this.datasets.withCredentials
  73880. })
  73881. .then((response) => {
  73882. return response.json();
  73883. })
  73884. .then((data) => {
  73885. if (data.succeed === false) {
  73886. //请求失败
  73887. me._fireFailedEvent(data);
  73888. return;
  73889. }
  73890. // 是否有rest服务
  73891. if (data.dataItemServices && data.dataItemServices.length > 0) {
  73892. let dataItemServices = data.dataItemServices,
  73893. resultData;
  73894. dataItemServices.forEach((item) => {
  73895. // 如果有restdata并且发布成功,就请求restdata服务
  73896. // 如果有restmap并且发布成功,就请求restmap服务
  73897. // 其他情况就请求iportal/content.json
  73898. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  73899. resultData = item;
  73900. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  73901. resultData = item;
  73902. } else {
  73903. me.getDatafromContent(url, success);
  73904. return;
  73905. }
  73906. });
  73907. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  73908. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  73909. } else {
  73910. me.getDatafromContent(url, success);
  73911. return;
  73912. }
  73913. })
  73914. .catch((error) => {
  73915. console.log(error);
  73916. me._fireFailedEvent(error);
  73917. });
  73918. }
  73919. /**
  73920. * @private
  73921. * @function ChartModel.prototype.getDatafromURL
  73922. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  73923. * @param {string} url
  73924. * @param {Callbacks} success - 成功回调函数。
  73925. */
  73926. getDatafromContent(url, success) {
  73927. // 成功回调传入的results
  73928. let results = {
  73929. result: {}
  73930. },
  73931. me = this;
  73932. url += '/content.json?pageSize=9999999&currentPage=1';
  73933. // 获取图层数据
  73934. FetchRequest.get(url, null, {
  73935. withCredentials: this.datasets.withCredentials
  73936. })
  73937. .then((response) => {
  73938. return response.json();
  73939. })
  73940. .then((data) => {
  73941. if (data.succeed === false) {
  73942. //请求失败
  73943. me._fireFailedEvent(data);
  73944. return;
  73945. }
  73946. if (data.type) {
  73947. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  73948. // 将字符串转换成json
  73949. data.content = JSON.parse(data.content.trim());
  73950. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  73951. if (!data.content.features) {
  73952. //json格式解析失败
  73953. console.log(Lang.i18n('msg_jsonResolveFiled'));
  73954. return;
  73955. }
  73956. let features = this._formatGeoJSON(data.content);
  73957. results.result.features = {
  73958. type: data.content.type,
  73959. features
  73960. };
  73961. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  73962. let features = this._excelData2Feature(data.content);
  73963. results.result.features = {
  73964. type: 'FeatureCollection',
  73965. features
  73966. };
  73967. }
  73968. success(results, 'content');
  73969. }
  73970. }, this)
  73971. .catch((error) => {
  73972. console.log(error);
  73973. me._fireFailedEvent(error);
  73974. });
  73975. }
  73976. /**
  73977. * @private
  73978. * @function ChartModel.prototype._getDataSource
  73979. * @description 获取数据源名和数据集名。
  73980. * @param {string} serviceType 服务类型
  73981. * @param {string} address 地址
  73982. * @param {Callbacks} success - 成功回调函数。
  73983. * @return {Array.<string>} ["数据源名:数据集名"]
  73984. * @return {string} 图层名
  73985. */
  73986. getDatafromRest(serviceType, address, success) {
  73987. let me = this,
  73988. withCredentials = this.datasets.withCredentials;
  73989. if (serviceType === 'RESTDATA') {
  73990. let url = `${address}/data/datasources`,
  73991. sourceName,
  73992. datasetName;
  73993. // 请求获取数据源名
  73994. FetchRequest.get(url, null, {
  73995. withCredentials
  73996. })
  73997. .then((response) => {
  73998. return response.json();
  73999. })
  74000. .then((data) => {
  74001. sourceName = data.datasourceNames[0];
  74002. url = `${address}/data/datasources/${sourceName}/datasets`;
  74003. // 请求获取数据集名
  74004. FetchRequest.get(url, null, {
  74005. withCredentials
  74006. })
  74007. .then((response) => {
  74008. return response.json();
  74009. })
  74010. .then((data) => {
  74011. datasetName = data.datasetNames[0];
  74012. // 请求restdata服务
  74013. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  74014. return [sourceName + ':' + datasetName];
  74015. })
  74016. .catch(function (error) {
  74017. me._fireFailedEvent(error);
  74018. });
  74019. })
  74020. .catch(function (error) {
  74021. me._fireFailedEvent(error);
  74022. });
  74023. } else {
  74024. // 如果是地图服务
  74025. let url = `${address}/maps`,
  74026. mapName,
  74027. layerName,
  74028. path;
  74029. // 请求获取地图名
  74030. FetchRequest.get(url, null, {
  74031. withCredentials
  74032. })
  74033. .then((response) => {
  74034. return response.json();
  74035. })
  74036. .then((data) => {
  74037. mapName = data[0].name;
  74038. path = data[0].path;
  74039. url = url = `${address}/maps/${mapName}/layers`;
  74040. // 请求获取图层名
  74041. FetchRequest.get(url, null, {
  74042. withCredentials
  74043. })
  74044. .then((response) => {
  74045. return response.json();
  74046. })
  74047. .then((data) => {
  74048. layerName = data[0].subLayers.layers[0].caption;
  74049. // 请求restmap服务
  74050. me.getDatafromRestMap(layerName, path, success);
  74051. return layerName;
  74052. })
  74053. .catch(function (error) {
  74054. me._fireFailedEvent(error);
  74055. });
  74056. })
  74057. .catch(function (error) {
  74058. me._fireFailedEvent(error);
  74059. });
  74060. }
  74061. }
  74062. /**
  74063. * @private
  74064. * @function ChartModel.prototype.getDatafromRestData
  74065. * @description 请求restdata服务
  74066. * @param {string} url
  74067. * @param {Array<string>} dataSource [数据源名:数据集名]
  74068. * @param {Callbacks} success - 成功回调函数。
  74069. */
  74070. getDatafromRestData(url, dataSource, success) {
  74071. let me = this;
  74072. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  74073. this._getFeatureBySQL(
  74074. url,
  74075. dataSource,
  74076. this.datasets.queryInfo,
  74077. (results) => {
  74078. // 此时的features已经处理成geojson了
  74079. success(results, 'RESTDATA');
  74080. },
  74081. (error) => {
  74082. console.log(error);
  74083. me._fireFailedEvent(error);
  74084. }
  74085. );
  74086. }
  74087. /**
  74088. * @private
  74089. * @function ChartModel.prototype.getDatafromRestMap
  74090. * @description 请求restmap服务
  74091. * @param {string} dataSource layerName
  74092. * @param {string} path - map服务地址。
  74093. * @param {Callbacks} success - 成功回调函数。
  74094. */
  74095. getDatafromRestMap(dataSource, path, success) {
  74096. let me = this;
  74097. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  74098. this._queryFeatureBySQL(
  74099. path,
  74100. dataSource,
  74101. this.datasets.queryInfo,
  74102. null,
  74103. null,
  74104. (results) => {
  74105. // let features = result.result.recordsets[0].features;
  74106. success(results, 'RESTMAP');
  74107. },
  74108. (error) => {
  74109. console.log(error);
  74110. me._fireFailedEvent(error);
  74111. }
  74112. );
  74113. }
  74114. /**
  74115. * @private
  74116. * @function ChartModel.prototype._getFeatureBySQL
  74117. * @description 通过 sql 方式查询数据。
  74118. */
  74119. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  74120. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  74121. let params = {
  74122. name: datasetNames.join().replace(':', '@')
  74123. };
  74124. Object.assign(params, queryInfo);
  74125. getFeatureParam = new FilterParameter(params);
  74126. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  74127. queryParameter: getFeatureParam,
  74128. datasetNames: datasetNames,
  74129. fromIndex: 0,
  74130. toIndex: 100000,
  74131. returnContent: true
  74132. });
  74133. let options = {
  74134. eventListeners: {
  74135. processCompleted: (getFeaturesEventArgs) => {
  74136. processCompleted && processCompleted(getFeaturesEventArgs);
  74137. },
  74138. processFailed: (e) => {
  74139. processFaild && processFaild(e);
  74140. }
  74141. }
  74142. };
  74143. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  74144. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  74145. }
  74146. /**
  74147. * @private
  74148. * @function ChartModel.prototype._queryFeatureBySQL
  74149. * @description 通过 sql 方式查询数据。
  74150. */
  74151. _queryFeatureBySQL(
  74152. url,
  74153. layerName,
  74154. queryInfo,
  74155. fields,
  74156. epsgCode,
  74157. processCompleted,
  74158. processFaild,
  74159. startRecord,
  74160. recordLength,
  74161. onlyAttribute
  74162. ) {
  74163. var queryParam, queryBySQLParams;
  74164. var filterParams = {
  74165. name: layerName
  74166. };
  74167. Object.assign(filterParams, queryInfo);
  74168. queryParam = new FilterParameter(filterParams);
  74169. if (fields) {
  74170. queryParam.fields = fields;
  74171. }
  74172. var params = {
  74173. queryParams: [queryParam]
  74174. };
  74175. if (onlyAttribute) {
  74176. params.queryOption = QueryOption.ATTRIBUTE;
  74177. }
  74178. startRecord && (params.startRecord = startRecord);
  74179. recordLength && (params.expectCount = recordLength);
  74180. if (epsgCode) {
  74181. params.prjCoordSys = {
  74182. epsgCode: epsgCode
  74183. };
  74184. }
  74185. queryBySQLParams = new QueryBySQLParameters(params);
  74186. this._queryBySQL(url, queryBySQLParams, (data) => {
  74187. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  74188. });
  74189. }
  74190. /**
  74191. * @function ChartModel.prototype._queryBySQL
  74192. * @description SQL 查询服务。
  74193. * @param {QueryBySQLParameters} params - SQL 查询相关参数类。
  74194. * @param {RequestCallback} callback - 回调函数。
  74195. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  74196. */
  74197. _queryBySQL(url, params, callback, resultFormat) {
  74198. var me = this;
  74199. var queryBySQLService = new QueryBySQLService(url, {
  74200. eventListeners: {
  74201. scope: me,
  74202. processCompleted: callback,
  74203. processFailed: callback
  74204. },
  74205. format: me._processFormat(resultFormat)
  74206. });
  74207. queryBySQLService.processAsync(params);
  74208. }
  74209. /**
  74210. * @function ChartModel.prototype._processFormat
  74211. * @description 将数据转换成geojson。
  74212. * @param {Object} resultFormat - 返回结果集。
  74213. * @return {Object} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  74214. */
  74215. _processFormat(resultFormat) {
  74216. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  74217. }
  74218. /**
  74219. * @private
  74220. * @function ChartModel.prototype._formatGeoJSON
  74221. * @description 格式 GeoJSON。
  74222. * @param {GeoJSON} data - GeoJSON 数据。
  74223. */
  74224. _formatGeoJSON(data) {
  74225. let features = data.features;
  74226. features.forEach((row, index) => {
  74227. row.properties['index'] = index;
  74228. });
  74229. return features;
  74230. }
  74231. /**
  74232. * @private
  74233. * @description 将 csv 和 xls 文件内容转换成 geojson
  74234. * @function ChartModel.prototype._excelData2Feature
  74235. * @param content 文件内容
  74236. * @param layerInfo 图层信息
  74237. * @returns {Array} feature的数组集合
  74238. */
  74239. _excelData2Feature(dataContent) {
  74240. let fieldCaptions = dataContent.colTitles;
  74241. //位置属性处理
  74242. let xfieldIndex = -1,
  74243. yfieldIndex = -1;
  74244. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  74245. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  74246. xfieldIndex = i;
  74247. }
  74248. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  74249. yfieldIndex = i;
  74250. }
  74251. }
  74252. // feature 构建后期支持坐标系 4326/3857
  74253. let features = [];
  74254. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  74255. let row = dataContent.rows[i];
  74256. let x = Number(row[xfieldIndex]),
  74257. y = Number(row[yfieldIndex]);
  74258. //属性信息
  74259. let attributes = {};
  74260. for (let index in dataContent.colTitles) {
  74261. let key = dataContent.colTitles[index];
  74262. attributes[key] = dataContent.rows[i][index];
  74263. }
  74264. attributes['index'] = i + '';
  74265. //目前csv 只支持处理点,所以先生成点类型的 geojson
  74266. let feature = {
  74267. type: 'Feature',
  74268. geometry: {
  74269. type: 'Point',
  74270. coordinates: [x, y]
  74271. },
  74272. properties: attributes
  74273. };
  74274. features.push(feature);
  74275. }
  74276. return features;
  74277. }
  74278. /**
  74279. * @private
  74280. * @description 请求数据失败的事件
  74281. * @function ChartModel.prototype._fireFailedEvent
  74282. * @param {Object} error 错误信息
  74283. */
  74284. _fireFailedEvent(error) {
  74285. let errorData = error
  74286. ? {
  74287. error,
  74288. message: Lang.i18n('msg_getdatafailed')
  74289. }
  74290. : {
  74291. message: Lang.i18n('msg_getdatafailed')
  74292. };
  74293. /**
  74294. * @event ChartModel#getdatafailed
  74295. * @description 监听到获取数据失败事件后触发
  74296. * @property {Object} error - 事件对象。
  74297. */
  74298. this.events.triggerEvent('getdatafailed', errorData);
  74299. }
  74300. }
  74301. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  74302. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74303. * This program are made available under the terms of the Apache License, Version 2.0
  74304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74305. /**
  74306. * @class ChartViewModel
  74307. * @aliasclass Components.ChartViewModel
  74308. * @deprecatedclass SuperMap.Components.ChartViewModel
  74309. * @classdesc 图表组件功能类。
  74310. * @category Components Chart
  74311. * @version 10.0.0
  74312. * @param {Object} options - 可选参数。
  74313. * @param {string} options.type - 图表类型。
  74314. * @param {ChartView.Datasets} options.datasets - 数据来源。
  74315. * @param {Array.<Object>} options.chartOptions - 图表可选配置。
  74316. * @param {Array.<Object>} options.chartOptions.xAxis - X轴可选参数。
  74317. * @param {string} options.chartOptions.xAxis.field - X轴字段名。
  74318. * @param {string} options.chartOptions.xAxis.name - X轴名称。
  74319. * @param {Array.<Object>} options.chartOptions.yAxis - Y轴可选参数。
  74320. * @param {string} options.chartOptions.yAxis.field - Y轴字段名。
  74321. * @param {string} options.chartOptions.yAxis.name - Y轴名称。
  74322. * @fires ChartViewModel#getdatafailed
  74323. * @usage
  74324. */
  74325. class ChartViewModel {
  74326. constructor(options) {
  74327. this.datasets = options.datasets;
  74328. this.xField = [];
  74329. this.yField = [];
  74330. this.grid = {
  74331. top: "50px",
  74332. bottom: "50px",
  74333. left: "50px",
  74334. right: "60px"
  74335. };
  74336. this.chartType = options.type || "bar";
  74337. this._initXYField(options.chartOptions);
  74338. this.EVENT_TYPES = ["getdatafailed"];
  74339. this.events = new Events(this, null, this.EVENT_TYPES);
  74340. }
  74341. /**
  74342. * @function ChartViewModel.prototype._initXYField
  74343. * @description 初始化XY字段。
  74344. * @private
  74345. * @param {Object} chartOptions - options里的图表参数。
  74346. */
  74347. _initXYField(chartOptions) {
  74348. let me = this;
  74349. if (chartOptions && chartOptions.length > 0) {
  74350. chartOptions.forEach(function (option) {
  74351. if (option.xAxis) {
  74352. me.xField.push({
  74353. field: option.xAxis.field,
  74354. name: option.xAxis.name
  74355. });
  74356. }
  74357. if (option.yAxis) {
  74358. me.yField.push({
  74359. field: option.yAxis.field,
  74360. name: option.yAxis.name
  74361. });
  74362. }
  74363. });
  74364. }
  74365. }
  74366. /**
  74367. * @function ChartViewModel.prototype.getDatasetInfo
  74368. * @description 获得数据集数据。
  74369. * @param {function} success - 成功回调函数。
  74370. */
  74371. getDatasetInfo(success) {
  74372. this.createChart = success;
  74373. if (this.datasets && this._checkUrl(this.datasets.url)) {
  74374. this.chartModel = new ChartModel(this.datasets);
  74375. if(this.datasets.type === 'iServer'){
  74376. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  74377. }else if(this.datasets.type === 'iPortal'){
  74378. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  74379. }
  74380. /**
  74381. * @event ChartViewModel#getdatafailed
  74382. * @description 监听到获取数据失败事件后触发。
  74383. * @property {Object} error - 事件对象。
  74384. */
  74385. this.chartModel.events.on({"getdatafailed": (error) => {
  74386. this.events.triggerEvent("getdatafailed", error)
  74387. }});
  74388. }
  74389. }
  74390. /**
  74391. * @function ChartViewModel.prototype._getDatasetInfoSuccess
  74392. * @description 成功回调函数。
  74393. * @private
  74394. * @param {Object} results - 数据集信息。
  74395. */
  74396. _getDatasetInfoSuccess(results) {
  74397. let datasetUrl = this.datasets.url;
  74398. //判断服务为地图服务 或者 数据服务
  74399. let restIndex = datasetUrl.indexOf("rest");
  74400. if (restIndex > 0) {
  74401. let index = datasetUrl.indexOf("/", restIndex + 5);
  74402. let type = datasetUrl.substring(restIndex + 5, index);
  74403. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  74404. if (type === "maps") {
  74405. let mapIndex = datasetUrl.indexOf("/", index + 1);
  74406. let mapName = datasetUrl.substring(index + 1, mapIndex);
  74407. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  74408. results.result.dataUrl = dataUrl;
  74409. this._getLayerFeatures(results);
  74410. } else if (type === "data") {
  74411. results.result.dataUrl = dataUrl;
  74412. this._getDataFeatures(results);
  74413. }
  74414. }
  74415. }
  74416. /**
  74417. * @function ChartViewModel.prototype._getDataInfoSuccess
  74418. * @description 请求iportal数据成功之后的回调。
  74419. * @private
  74420. */
  74421. _getDataInfoSuccess(results, type) {
  74422. let me = this;
  74423. if(type === 'RESTMAP'){
  74424. me._getChartDatasFromLayer(results);
  74425. }else{
  74426. me._getChartDatas(results);
  74427. }
  74428. }
  74429. /**
  74430. * @function ChartViewModel.prototype._getDataFeatures
  74431. * @description 请求数据集的数据信息
  74432. * @private
  74433. * @param {Object} results - 数据集信息
  74434. */
  74435. _getDataFeatures(results) {
  74436. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  74437. }
  74438. /**
  74439. * @function ChartViewModel.prototype._getLayerFeatures
  74440. * @description 请求图层的数据信息。
  74441. * @private
  74442. * @param {Object} results - 数据集信息。
  74443. */
  74444. _getLayerFeatures(results) {
  74445. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  74446. }
  74447. /**
  74448. * @function ChartViewModel.prototype._getChartDatas
  74449. * @description 将请求回来的数据转换为图表所需的数据格式。
  74450. * @private
  74451. * @param {Object} results - 数据要素信息。
  74452. */
  74453. _getChartDatas(results) {
  74454. if (results) {
  74455. // 数据来自restdata---results.result.features
  74456. this.features = results.result.features;
  74457. let features = this.features.features;
  74458. let data = {};
  74459. if (features.length) {
  74460. let feature = features[0];
  74461. let attrFields = [],
  74462. itemTypes = [];
  74463. for (let attr in feature.properties) {
  74464. attrFields.push(attr);
  74465. itemTypes.push(this._getDataType(feature.properties[attr]));
  74466. }
  74467. data = {
  74468. features,
  74469. fieldCaptions: attrFields,
  74470. fieldTypes: itemTypes,
  74471. fieldValues: []
  74472. }
  74473. for (let m in itemTypes) {
  74474. let fieldValue = [];
  74475. for (let j in features) {
  74476. let feature = features[j];
  74477. let caption = data.fieldCaptions[m];
  74478. let value = feature.properties[caption];
  74479. fieldValue.push(value);
  74480. }
  74481. data.fieldValues.push(fieldValue);
  74482. }
  74483. this.createChart(data);
  74484. }
  74485. }
  74486. }
  74487. /**
  74488. * @function ChartViewModel.prototype._getChartDatasFromLayer
  74489. * @description 将请求回来的数据转换为图表所需的数据格式。
  74490. * @private
  74491. * @param {Object} results - 图层数据要素信息。
  74492. */
  74493. _getChartDatasFromLayer(results) {
  74494. if (results.result.recordsets) {
  74495. let recordsets = results.result.recordsets[0];
  74496. let features = recordsets.features.features;
  74497. this.features = recordsets.features;
  74498. let data = {};
  74499. if (features.length) {
  74500. data = {
  74501. features: recordsets.features,
  74502. fieldCaptions: recordsets.fieldCaptions,
  74503. fieldTypes: recordsets.fieldTypes,
  74504. fieldValues: []
  74505. }
  74506. for (let m in data.fieldCaptions) {
  74507. let fieldValue = [];
  74508. for (let j in features) {
  74509. let feature = features[j];
  74510. let caption = data.fieldCaptions[m];
  74511. let value = feature.properties[caption];
  74512. fieldValue.push(value);
  74513. }
  74514. data.fieldValues.push(fieldValue);
  74515. }
  74516. this.createChart(data);
  74517. }
  74518. }
  74519. }
  74520. /**
  74521. * @function ChartViewModel.prototype._createChartOptions
  74522. * @description 创建图表所需参数。
  74523. * @private
  74524. * @param {Object} data - 图表数据。
  74525. */
  74526. _createChartOptions(data) {
  74527. this.calculatedData = this._createChartDatas(data);
  74528. return this.updateChartOptions(this.chartType);
  74529. }
  74530. /**
  74531. * @function ChartViewModel.prototype.changeType
  74532. * @description 改变图表类型。
  74533. * @param {string} type - 图表类型。
  74534. */
  74535. changeType(type) {
  74536. if (type !== this.chartType) {
  74537. this.chartType = type;
  74538. return this.updateChartOptions(this.chartType);
  74539. }
  74540. }
  74541. /**
  74542. * @function ChartViewModel.prototype.updateData
  74543. * @description 改变图表类型。
  74544. * @param {ChartView.Datasets} datasets - 数据来源。
  74545. * @param {function} success 成功回调函数。
  74546. */
  74547. updateData(datasets, chartOption, success) {
  74548. this.updateChart = success;
  74549. this.xField = [];
  74550. this.yField = [];
  74551. this._initXYField(chartOption);
  74552. // type的设置默认值
  74553. datasets.type = datasets.type || 'iServer';
  74554. // withCredentials的设置默认值
  74555. datasets.withCredentials = datasets.withCredentials || false;
  74556. this.datasets = datasets;
  74557. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  74558. }
  74559. /**
  74560. * @function ChartViewModel.prototype._updateDataSuccess
  74561. * @description 改变图表类型。
  74562. * @private
  74563. * @param {Object} data - 图表数据。
  74564. */
  74565. _updateDataSuccess(data) {
  74566. let options = this._createChartOptions(data);
  74567. this.updateChart(options);
  74568. }
  74569. /**
  74570. * @function ChartViewModel.prototype.updateChartOptions
  74571. * @description 更新图表所需参数。
  74572. * @param {string} type - 图表类型。
  74573. * @param {Object} style - 图表样式。
  74574. */
  74575. updateChartOptions(type, style) {
  74576. if (this.calculatedData) {
  74577. let grid = this.grid;
  74578. let series = this._createChartSeries(this.calculatedData, type);
  74579. let datas = [];
  74580. for (let i in this.calculatedData.XData) {
  74581. datas.push({
  74582. value: this.calculatedData.XData[i].fieldsData
  74583. });
  74584. }
  74585. let xAxis = {
  74586. type: "category",
  74587. name: this.xField[0].name || "X",
  74588. data: datas,
  74589. nameTextStyle: {
  74590. color: '#fff',
  74591. fontSize: 14
  74592. },
  74593. splitLine: {
  74594. show: false
  74595. },
  74596. axisLine: {
  74597. lineStyle: {
  74598. color: '#eee'
  74599. }
  74600. }
  74601. }
  74602. let yAxis = {
  74603. type: "value",
  74604. name: this.yFieldName || "Y",
  74605. data: {},
  74606. nameTextStyle: {
  74607. color: '#fff',
  74608. fontSize: 14
  74609. },
  74610. splitLine: {
  74611. show: false
  74612. },
  74613. axisLine: {
  74614. lineStyle: {
  74615. color: '#eee'
  74616. }
  74617. }
  74618. }
  74619. let tooltip = {
  74620. formatter: '{b0}: {c0}'
  74621. };
  74622. let backgroundColor = '#404a59';
  74623. if (style) {
  74624. if (style.grid) {
  74625. grid = style.grid;
  74626. }
  74627. if (style.tooltip) {
  74628. tooltip = style.tooltip;
  74629. }
  74630. if (style.backgroundColor) {
  74631. backgroundColor = style.backgroundColor;
  74632. }
  74633. }
  74634. return {
  74635. backgroundColor: backgroundColor,
  74636. grid: grid,
  74637. series: series,
  74638. xAxis: xAxis,
  74639. yAxis: yAxis,
  74640. tooltip: tooltip
  74641. }
  74642. }
  74643. }
  74644. /**
  74645. * @function ChartViewModel.prototype._createChartDatas
  74646. * @description 构建图表数据。
  74647. * @private
  74648. * @param {Object} data - 源数据。
  74649. */
  74650. _createChartDatas(data) {
  74651. let fieldIndex = 0, yfieldIndexs = [];
  74652. let fieldCaptions = data.fieldCaptions;
  74653. let me = this;
  74654. //X
  74655. fieldCaptions.forEach(function (field, index) {
  74656. if (me.xField[0] && field === me.xField[0].field) {
  74657. fieldIndex = index;
  74658. }
  74659. });
  74660. //Y
  74661. this.yFieldName = "";
  74662. this.yField.forEach(function (value, index) {
  74663. if (index !== 0) {
  74664. me.yFieldName = me.yFieldName + ",";
  74665. }
  74666. me.yFieldName = me.yFieldName + value.name;
  74667. fieldCaptions.forEach(function (field, index) {
  74668. if (field === value.field) {
  74669. yfieldIndexs.push(index);
  74670. }
  74671. });
  74672. })
  74673. let datas = this._getAttrData(data, fieldIndex);
  74674. let yDatas = [];
  74675. if (yfieldIndexs.length > 0) {
  74676. yfieldIndexs.forEach(function (yfieldIndex) {
  74677. let yData = [];
  74678. for (let i in data.fieldValues[yfieldIndex]) {
  74679. yData.push({
  74680. value: data.fieldValues[yfieldIndex][i]
  74681. });
  74682. }
  74683. yDatas.push(yData);
  74684. });
  74685. } else { //未指定Y字段时,y轴计数
  74686. let YData = [],
  74687. XData = [],
  74688. len = datas.length;
  74689. //计算X轴,Y轴数据,并去重
  74690. for (let i = 0; i < len; i++) {
  74691. let isSame = false;
  74692. for (let j = 0, leng = XData.length; j < leng; j++) {
  74693. if (datas[i].fieldsData === XData[j].fieldsData) {
  74694. YData[j].value++;
  74695. XData[j].recordIndexs.push(i);
  74696. isSame = true;
  74697. break;
  74698. }
  74699. }
  74700. if (!isSame) {
  74701. if (datas[i].fieldsData) {
  74702. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  74703. YData.push({ value: 1 });
  74704. }
  74705. }
  74706. }
  74707. datas = XData;
  74708. yDatas = [YData];
  74709. }
  74710. return {
  74711. XData: datas,
  74712. YData: yDatas
  74713. }
  74714. }
  74715. /**
  74716. * @function ChartViewModel.prototype._getAttrData
  74717. * @description 选中字段数据。
  74718. * @private
  74719. * @param {Object} datacontent - 图表数据。
  74720. * @param {number} index - 字段索引。
  74721. */
  74722. _getAttrData(datacontent, index) {
  74723. if (index === 0) {
  74724. this.xField = [{
  74725. field: datacontent.fieldCaptions[index],
  74726. name: datacontent.fieldCaptions[index]
  74727. }];
  74728. }
  74729. let fieldsDatas = [];
  74730. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  74731. let value = datacontent.fieldValues[index][i];
  74732. fieldsDatas.push({
  74733. recordIndexs: i,
  74734. fieldsData: value
  74735. });
  74736. }
  74737. return fieldsDatas;
  74738. }
  74739. /**
  74740. * @function ChartViewModel.prototype._createChartSeries
  74741. * @description 图表数据。
  74742. * @private
  74743. * @param {Object} calculatedData - 图表数据。
  74744. * @param {string} chartType - 图表类型。
  74745. */
  74746. _createChartSeries(calculatedData, chartType) {
  74747. let series = [];
  74748. let yDatas = calculatedData.YData;
  74749. yDatas.forEach(function (yData) {
  74750. let value = 0;
  74751. let serieData = [];
  74752. for (let data of yData) {
  74753. value = data.value;
  74754. serieData.push({
  74755. value: value
  74756. });
  74757. }
  74758. let serie = {
  74759. type: chartType,
  74760. data: serieData,
  74761. name: "y"
  74762. };
  74763. series.push(serie);
  74764. });
  74765. return series;
  74766. }
  74767. /**
  74768. * @function ChartViewModel.prototype._isDate
  74769. * @description 判断是否为日期。
  74770. * @private
  74771. * @param {string} data - 字符串。
  74772. */
  74773. _isDate(data) {
  74774. let reg = /((^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(10|12|0?[13578])([-\/\._])(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(11|0?[469])([-\/\._])(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(0?2)([-\/\._])(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([3579][26]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][13579][26])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][13579][26])([-\/\._])(0?2)([-\/\._])(29)$))/ig;
  74775. return reg.test(data);
  74776. }
  74777. /**
  74778. * @function ChartViewModel.prototype._isNumber
  74779. * @description 判断是否为数值。
  74780. * @private
  74781. * @param {string} data - 字符串。
  74782. */
  74783. _isNumber(data) {
  74784. let mdata = Number(data);
  74785. if (mdata === 0) {
  74786. return true;
  74787. }
  74788. return !isNaN(mdata);
  74789. }
  74790. /**
  74791. * @function ChartViewModel.prototype._getDataType
  74792. * @description 判断数据的类型。
  74793. * @private
  74794. * @param {string} data - 字符串。
  74795. */
  74796. _getDataType(data) {
  74797. if (data !== null && data !== undefined && data !== '') {
  74798. if (this._isDate(data)) {
  74799. return "DATE";
  74800. }
  74801. if (this._isNumber(data)) {
  74802. return "NUMBER";
  74803. }
  74804. }
  74805. return "STRING";
  74806. }
  74807. /**
  74808. * @function ChartViewModel.prototype._checkUrl
  74809. * @description 检查url是否符合要求。
  74810. * @private
  74811. * @param {string} url。
  74812. */
  74813. _checkUrl(url) {
  74814. let match;
  74815. if (url === '' || !this._isMatchUrl(url)) {
  74816. match = false;
  74817. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  74818. //不是实际域名
  74819. match = false;
  74820. } else {
  74821. match = true;
  74822. }
  74823. return match;
  74824. }
  74825. /**
  74826. * @function ChartViewModel.prototype._isMatchUrl
  74827. * @description 判断输入的地址是否符合地址格式。
  74828. * @private
  74829. * @param {string} str - url。
  74830. */
  74831. _isMatchUrl(str) {
  74832. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  74833. return reg.test(str);
  74834. }
  74835. /**
  74836. * @function ChartViewModel.prototype.getStyle
  74837. * @description 获取图表样式。
  74838. */
  74839. getStyle() {
  74840. let style = {
  74841. grid: this.grid,
  74842. tooltip: this.tooltip,
  74843. backgroundColor: this.backgroundColor
  74844. }
  74845. return style;
  74846. }
  74847. /**
  74848. * @function ChartViewModel.prototype.getFeatures
  74849. * @description 获取地图服务,数据服务请求返回的数据。
  74850. */
  74851. getFeatures() {
  74852. return this.features;
  74853. }
  74854. /**
  74855. * @function ChartViewModel.prototype.setStyle
  74856. * @description 设置图表样式。
  74857. * @param {Object} style - 图表样式
  74858. */
  74859. setStyle(style) {
  74860. return this.updateChartOptions(this.chartType, style);
  74861. }
  74862. }
  74863. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  74864. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74865. * This program are made available under the terms of the Apache License, Version 2.0
  74866. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74867. /**
  74868. * @class ChartView
  74869. * @aliasclass Components.ChartView
  74870. * @deprecatedclass SuperMap.Components.Chart
  74871. * @classdesc 图表组件。
  74872. * @modulecategory Components
  74873. * @version 9.1.2
  74874. * @param {string} domID - 图表dom元素ID。
  74875. * @param {Object} options - 可选参数。
  74876. * @param {string} options.type - 图表类型。
  74877. * @param {ChartView.Datasets} options.datasets - 数据来源。
  74878. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  74879. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  74880. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  74881. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  74882. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  74883. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  74884. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  74885. * @category Components Chart
  74886. * @usage
  74887. */
  74888. /**
  74889. * @typedef {Object} ChartView.Datasets - 数据来源。
  74890. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  74891. * @property {string} url - 服务地址。
  74892. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie。
  74893. * @property {FilterParameter} queryInfo - 查询条件。
  74894. */
  74895. class ChartView {
  74896. constructor(domID, options) {
  74897. this.domID = domID;
  74898. this.chartType = options.type || "bar";
  74899. // 设置options.datasets.type的默认值是iServer
  74900. options.datasets.type = options.datasets.type || 'iServer';
  74901. // 设置withCredentials的默认值为false
  74902. options.datasets.withCredentials = options.datasets.withCredentials || false;
  74903. this.viewModel = new ChartViewModel(options);
  74904. //添加控件。
  74905. this._fillDataToView();
  74906. }
  74907. /**
  74908. * @function ChartView.prototype.onAdd
  74909. * @description 创建图表之后成功回调。
  74910. * @param {function} addChart - 回调函数。
  74911. */
  74912. onAdd(addChart) {
  74913. this.addChart = addChart;
  74914. }
  74915. /**
  74916. * @function ChartView.prototype._fillDataToView
  74917. * @description 填充数据到 view。
  74918. * @private
  74919. */
  74920. _fillDataToView() {
  74921. let messageboxs = new MessageBox();
  74922. //iclient 绑定createChart事件成功回调
  74923. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  74924. this.viewModel.events.on({
  74925. "getdatafailed": (error) => {
  74926. messageboxs.showView(error.message);
  74927. }
  74928. });
  74929. }
  74930. /**
  74931. * @function ChartView.prototype.getStyle
  74932. * @description 获取图表样式。
  74933. */
  74934. getStyle() {
  74935. return this.viewModel.getStyle()
  74936. }
  74937. /**
  74938. * @function ChartView.prototype.getFeatures
  74939. * @description 获取地图服务,数据服务请求返回的数据。
  74940. */
  74941. getFeatures() {
  74942. return this.viewModel.getFeatures();
  74943. }
  74944. /**
  74945. * @function ChartView.prototype.setStyle
  74946. * @description 设置图表样式。
  74947. * @param {Object} style - 图表样式,参考Echarts-options样式设置。
  74948. */
  74949. setStyle(style) {
  74950. let newOptions = this.viewModel.setStyle(style);
  74951. this._updateChart(newOptions);
  74952. }
  74953. /**
  74954. * @function ChartView.prototype.changeType
  74955. * @description 改变图表类型。
  74956. * @param {string} type - 图表类型。
  74957. */
  74958. changeType(type) {
  74959. if (this.chartType !== type) {
  74960. this.chartType = type;
  74961. let newOptions = this.viewModel.changeType(type);
  74962. this._updateChart(newOptions);
  74963. }
  74964. }
  74965. /**
  74966. * @function ChartView.prototype.updateData
  74967. * @description 更新图表数据。
  74968. * @param {ChartView.Datasets} datasets - 数据来源。
  74969. * @param {Object} chartOption - X,Y轴信息。
  74970. */
  74971. updateData(datasets, chartOption) {
  74972. let me = this;
  74973. this.viewModel.updateData(datasets, chartOption, function (options) {
  74974. me._updateChart(options);
  74975. if (me.addChart) {
  74976. me.addChart();
  74977. }
  74978. });
  74979. }
  74980. /**
  74981. * @function ChartView.prototype._createChart
  74982. * @description 创建图表。
  74983. * @private
  74984. * @param {Object} data - 图表数据。
  74985. */
  74986. _createChart(data) {
  74987. this.echart = external_function_try_return_echarts_catch_e_return_namespaceObject.init(
  74988. document.getElementById(this.domID),
  74989. null, {
  74990. renderer: "canvas"
  74991. }
  74992. )
  74993. let options = this.viewModel._createChartOptions(data);
  74994. this.echart.setOption(options);
  74995. if (this.addChart) {
  74996. this.addChart();
  74997. }
  74998. }
  74999. /**
  75000. * @function ChartView.prototype._updateChart
  75001. * @description 更新图表。
  75002. * @private
  75003. * @param {Object} options - 图表参数。
  75004. */
  75005. _updateChart(options) {
  75006. if (this.echart) {
  75007. this.echart.clear();
  75008. this.echart.setOption(options);
  75009. }
  75010. }
  75011. }
  75012. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  75013. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75014. * This program are made available under the terms of the Apache License, Version 2.0
  75015. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75016. /**
  75017. * @class TemplateBase
  75018. * @aliasclass Components.TemplateBase
  75019. * @deprecatedclass SuperMap.Components.TemplateBase
  75020. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  75021. * @version 9.1.1
  75022. * @param {Object} options - 组件配置参数。
  75023. * @param {string} options.id - 组件 dom 元素 id。
  75024. * @category Components Common
  75025. * @usage
  75026. */
  75027. class TemplateBase {
  75028. constructor(options) {
  75029. options = options ? options : {};
  75030. /**
  75031. * @member {string} [TemplateBase.prototype.id=null]
  75032. * @description 组件 dom 元素 id。
  75033. */
  75034. this.id = options.id ? options.id : null;
  75035. /**
  75036. * @member {HTMLElement} [TemplateBase.prototype.rootContainer=null]
  75037. * @description 组件 dom 元素对象。
  75038. */
  75039. this.rootContainer = null;
  75040. }
  75041. /**
  75042. * @function TemplateBase.prototype.getElement
  75043. * @description 获取当前组件元素对象。
  75044. * @return {HTMLElement} 组件 dom 元素对象
  75045. */
  75046. getElement() {
  75047. //todo 其实感觉再这里给组件设置不太合理
  75048. if (this.id) {
  75049. this.rootContainer.id = this.id;
  75050. }
  75051. return this.rootContainer;
  75052. }
  75053. /**
  75054. * @function TemplateBase.prototype._initView
  75055. * @private
  75056. * @description 初始化模板。
  75057. */
  75058. _initView() {
  75059. //子类实现此方法
  75060. }
  75061. /**
  75062. * @function TemplateBase.prototype.showView
  75063. * @description 显示组件。
  75064. */
  75065. showView() {
  75066. this.rootContainer.hidden = false;
  75067. }
  75068. /**
  75069. * @function TemplateBase.prototype.closeView
  75070. * @description 隐藏组件。
  75071. */
  75072. closeView() {
  75073. this.rootContainer.hidden = true;
  75074. }
  75075. }
  75076. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  75077. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75078. * This program are made available under the terms of the Apache License, Version 2.0
  75079. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75080. /**
  75081. * @class CommonContainer
  75082. * @aliasclass Components.CommonContainer
  75083. * @deprecatedclass SuperMap.Components.CommonContainer
  75084. * @classdesc 组件统一外框。
  75085. * @version 9.1.1
  75086. * @param {Object} options - 组件配置参数。
  75087. * @param {string} options.id - 组件 dom 元素 id。
  75088. * @param {string} options.title - 标题。
  75089. * @category Components Common
  75090. * @extends {TemplateBase}
  75091. * @usage
  75092. */
  75093. class CommonContainer extends TemplateBase {
  75094. constructor(options) {
  75095. super(options);
  75096. let title = options.title ? options.title : "";
  75097. this._initView(title);
  75098. }
  75099. /**
  75100. * @private
  75101. * @override
  75102. */
  75103. _initView(title) {
  75104. const container = document.createElement("div");
  75105. container.setAttribute("class", "component-container");
  75106. //title
  75107. const titleContainer = document.createElement("div");
  75108. titleContainer.setAttribute("class", "component-title");
  75109. const titleContent = document.createElement("div");
  75110. titleContent.innerHTML = title;
  75111. titleContainer.appendChild(titleContent);
  75112. container.appendChild(titleContainer);
  75113. //container
  75114. const componentContent = document.createElement("div");
  75115. componentContent.setAttribute("class", "component-content");
  75116. container.appendChild(componentContent);
  75117. this.content = componentContent;
  75118. this.rootContainer = container;
  75119. return container;
  75120. }
  75121. /**
  75122. * @function CommonContainer.prototype.getContentElement
  75123. * @description 获取内容元素容器。
  75124. */
  75125. getContentElement() {
  75126. return this.content;
  75127. }
  75128. /**
  75129. * @function CommonContainer.prototype.appendContent
  75130. * @description 填充内容元素。
  75131. */
  75132. appendContent(element) {
  75133. this.content.appendChild(element);
  75134. }
  75135. }
  75136. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  75137. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75138. * This program are made available under the terms of the Apache License, Version 2.0
  75139. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75140. /**
  75141. * @class Select
  75142. * @aliasclass Components.Select
  75143. * @deprecatedclass SuperMap.Components.Select
  75144. * @classdesc 组件统一的文字下拉框。
  75145. * @version 9.1.1
  75146. * @param {Array.<string|Array>} options - 组件配置参数数组。
  75147. * @param {string} options.id - 组件 dom 元素 id。
  75148. * @param {string} [options.labelName] - label 名称。
  75149. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  75150. * @param {function} [options.optionsClickCb] - option 点击事件回调函数。
  75151. * @extends {TemplateBase}
  75152. * @category Components Common
  75153. * @usage
  75154. */
  75155. class Select extends TemplateBase {
  75156. constructor(options) {
  75157. super(options);
  75158. this._initView(options);
  75159. }
  75160. _initView(options) {
  75161. let selectTool = this._createElement('div', "component-selecttool");
  75162. if (options.labelName) {
  75163. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  75164. label.innerHTML = options.labelName;
  75165. }
  75166. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  75167. chartSelect.setAttribute('tabindex', '1');
  75168. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  75169. selectName.title = options.optionsArr[0];
  75170. selectName.innerHTML = options.optionsArr[0];
  75171. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  75172. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  75173. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  75174. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  75175. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  75176. scrollareaContent.setAttribute('tabindex', '1');
  75177. this.createOptions(scrollareaContent, options.optionsArr);
  75178. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  75179. // 下拉框显示 & 隐藏事件
  75180. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  75181. this.rootContainer = selectTool;
  75182. }
  75183. /**
  75184. * @function Select.prototype.createOptions
  75185. * @description 创建所属下拉框选项。
  75186. */
  75187. createOptions(container, optionsArr) {
  75188. for (let i in optionsArr) {
  75189. let option = this._createElement('div', 'component-selecttool__option', container);
  75190. option.title = optionsArr[i];
  75191. option.innerHTML = optionsArr[i];
  75192. }
  75193. }
  75194. /**
  75195. * @function Select.prototype._selectClickEvent
  75196. * @description select 点击显示&隐藏事件。
  75197. * @private
  75198. */
  75199. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  75200. eventElement.onclick = function (e) {
  75201. if (contentElement.style.display === "block") {
  75202. contentElement.style.display = "none";
  75203. triangleBtn.className = "component-triangle-down-img";
  75204. } else {
  75205. contentElement.style.display = "block";
  75206. triangleBtn.className = "triangle-up-img";
  75207. }
  75208. e.preventDefault();
  75209. e.stopPropagation();
  75210. };
  75211. eventElement.onmousedown = function (evt) {
  75212. //console.log('dropdownbox onmousedown '+evt.target.className);
  75213. if (evt.target !== this) {
  75214. this.focus();
  75215. evt.preventDefault();
  75216. evt.stopPropagation()
  75217. }
  75218. };
  75219. eventElement.onblur = function () {
  75220. contentElement.style.display = "none";
  75221. triangleBtn.className = "component-triangle-down-img";
  75222. }
  75223. }
  75224. /**
  75225. * @function Select.prototype._createElement
  75226. * @description 通用创建元素。
  75227. * @private
  75228. */
  75229. _createElement(tagName, className, parentEle) {
  75230. let ele = document.createElement(tagName || 'div');
  75231. className && (ele.className = className);
  75232. parentEle && parentEle.appendChild(ele);
  75233. return ele;
  75234. }
  75235. /**
  75236. * @function Select.prototype.optionClickEvent
  75237. * @description 下拉框的 option 的点击事件。
  75238. */
  75239. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  75240. for (let i = 0; i < optionEleArr.children.length; i++) {
  75241. let childEle = optionEleArr.children[i];
  75242. childEle.onclick = function () {
  75243. selectNameEle.innerHTML = childEle.innerHTML;
  75244. selectNameEle.title = childEle.title;
  75245. if (childEle.getAttribute('data-value')) {
  75246. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  75247. }
  75248. optionsClickCb && optionsClickCb(childEle);
  75249. }
  75250. }
  75251. }
  75252. }
  75253. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  75254. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75255. * This program are made available under the terms of the Apache License, Version 2.0
  75256. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75257. /**
  75258. * @class DropDownBox
  75259. * @aliasclass Components.DropDownBox
  75260. * @deprecatedclass SuperMap.Components.DropDownBox
  75261. * @classdesc 组件统一的图片下拉框。
  75262. * @version 9.1.1
  75263. * @param {Array.<Object>} options - 组件配置参数数组。
  75264. * @param {string} options.id - 组件 dom 元素 id。
  75265. * @param {string} options.title - 下拉框 title。
  75266. * @param {string} options.remark - 下拉框解释标记文本。
  75267. * @param {string} [options.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  75268. * @param {string} [options.icon] - 下拉框图标。
  75269. * @param {string} [options.icon.className] - 下拉框图标类名。
  75270. * @param {string} [options.icon.background] - 下拉框图标背景 url。
  75271. * @category Components Common
  75272. * @extends {TemplateBase}
  75273. * @usage
  75274. */
  75275. class DropDownBox extends TemplateBase {
  75276. constructor(optionsArr) {
  75277. super(optionsArr);
  75278. this._initView(optionsArr);
  75279. }
  75280. /**
  75281. * @function DropDownBox.prototype._initView
  75282. * @description 初始化下拉框。
  75283. * @private
  75284. * @override
  75285. */
  75286. _initView(optionsArr) {
  75287. let dropDownContainer = document.createElement('div');
  75288. dropDownContainer.className = 'component-dropdownbox--container';
  75289. let dropDownBox = document.createElement('div');
  75290. dropDownBox.setAttribute('tabindex', '1');
  75291. dropDownBox.className = "component-dropdownbox";
  75292. dropDownContainer.appendChild(dropDownBox);
  75293. let dropDownTopContainer = document.createElement('div');
  75294. dropDownBox.appendChild(dropDownTopContainer);
  75295. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  75296. let triangleBtnContainer = document.createElement('div');
  75297. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  75298. dropDownBox.appendChild(triangleBtnContainer);
  75299. let triangleBtn = document.createElement('div');
  75300. triangleBtn.className = 'component-triangle-down-img';
  75301. triangleBtnContainer.appendChild(triangleBtn);
  75302. let createDropDownBoxParam = {
  75303. "parentEle": dropDownBox,
  75304. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  75305. "scrollareaContent": 'component-selecttool__scrollarea__content',
  75306. "optionsArr": optionsArr,
  75307. "triangleBtn": triangleBtn,
  75308. "dropDownTopContainer": dropDownTopContainer
  75309. };
  75310. this._createDropDownBox(createDropDownBoxParam);
  75311. this.rootContainer = dropDownContainer;
  75312. }
  75313. /**
  75314. * @function DropDownBox.prototype._createDropDownBox
  75315. * @description 创建下拉框。
  75316. * @private
  75317. */
  75318. _createDropDownBox(createDropDownBoxParam) {
  75319. let dropDownBox = createDropDownBoxParam.parentEle;
  75320. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  75321. let dropDownContent = document.createElement('div');
  75322. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  75323. dropDownBox.appendChild(dropDownContent);
  75324. let scrollareaContent = document.createElement('div');
  75325. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  75326. dropDownContent.appendChild(scrollareaContent);
  75327. let optionsArr = createDropDownBoxParam.optionsArr;
  75328. for (let i = 0; i < optionsArr.length; i++) {
  75329. this._createDropDownOption(optionsArr[i], scrollareaContent)
  75330. }
  75331. // 下拉框显示 & 隐藏事件
  75332. let triangleBtn = createDropDownBoxParam.triangleBtn;
  75333. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  75334. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  75335. // 下拉框 options 点击事件
  75336. let scrollareaOptions = scrollareaContent.children;
  75337. for (let i = 0; i < scrollareaOptions.length; i++) {
  75338. scrollareaOptions[i].onclick = function () {
  75339. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  75340. //evt.stopPropagation();
  75341. }
  75342. }
  75343. }
  75344. /**
  75345. * @function DropDownBox.prototype._createDropDownOption
  75346. * @description 创建下拉框子元素。
  75347. * @private
  75348. */
  75349. _createDropDownOption(data, parentElement) {
  75350. let ele = document.createElement('div');
  75351. ele.className = 'component-dropdownbox__item';
  75352. let dataItem = data;
  75353. if (dataItem['dataValue']) {
  75354. ele.setAttribute('data-value', dataItem['dataValue']);
  75355. }
  75356. parentElement.appendChild(ele);
  75357. let imgContainer = document.createElement('div');
  75358. imgContainer.className = 'component-dropdownbox__item__img';
  75359. ele.appendChild(imgContainer);
  75360. let img = document.createElement('div');
  75361. if (dataItem.icon.className) {
  75362. img.className = dataItem.icon.className;
  75363. }
  75364. if (dataItem.icon.background) {
  75365. img.style.background = dataItem.icon.background;
  75366. }
  75367. imgContainer.appendChild(img);
  75368. let title = document.createElement('div');
  75369. title.className = 'component-dropdownbox__item__title';
  75370. title.title = dataItem.title;
  75371. title.innerHTML = dataItem.title;
  75372. ele.appendChild(title);
  75373. let remark = document.createElement('div');
  75374. remark.className = 'component-dropdownbox__item__remark';
  75375. remark.title = dataItem.remark;
  75376. remark.innerHTML = dataItem.remark;
  75377. ele.appendChild(remark);
  75378. }
  75379. /**
  75380. * @function DropDownBox.prototype._dropDownClickEvent
  75381. * @description 下拉框点击事件。
  75382. * @private
  75383. */
  75384. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  75385. eventElement.onclick = function (e) {
  75386. if (contentElement.style.display === "block") {
  75387. contentElement.style.display = "none";
  75388. triangleBtn.className = "component-triangle-down-img";
  75389. } else {
  75390. contentElement.style.display = "block";
  75391. triangleBtn.className = "triangle-up-img";
  75392. }
  75393. e.preventDefault();
  75394. e.stopPropagation()
  75395. };
  75396. eventElement.onmousedown = function (evt) {
  75397. //console.log('dropdownbox onmousedown '+evt.target.className);
  75398. if (evt.target !== this) {
  75399. this.focus();
  75400. evt.preventDefault();
  75401. evt.stopPropagation()
  75402. }
  75403. }
  75404. }
  75405. /**
  75406. * @function DropDownBox.prototype._eleOnblur
  75407. * @description 下拉框失焦事件。
  75408. * @private
  75409. */
  75410. _eleOnblur(eventElement, contentElement, triangleBtn) {
  75411. eventElement.onblur = function () {
  75412. contentElement.style.display = "none";
  75413. triangleBtn.className = "component-triangle-down-img";
  75414. }
  75415. }
  75416. /**
  75417. * @function DropDownBox.prototype._createElement
  75418. * @description 通用创建元素。
  75419. * @private
  75420. */
  75421. _createElement(tagName, className, parentEle) {
  75422. let ele = document.createElement(tagName || 'div');
  75423. className && (ele.className = className);
  75424. parentEle && parentEle.appendChild(ele);
  75425. return ele;
  75426. }
  75427. }
  75428. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  75429. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75430. * This program are made available under the terms of the Apache License, Version 2.0
  75431. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75432. /**
  75433. * @class PopContainer
  75434. * @aliasclass Components.PopContainer
  75435. * @deprecatedclass SuperMap.Components.PopContainer
  75436. * @classdesc 弹框组件。
  75437. * @version 9.1.1
  75438. * @param {Object} options - 组件配置参数。
  75439. * @param {string} options.id - 组件 dom 元素 id。
  75440. * @param {string} options.title - 弹框组件名称。
  75441. * @extends {TemplateBase}
  75442. * @category Components Common
  75443. * @usage
  75444. */
  75445. class PopContainer extends TemplateBase {
  75446. constructor(options) {
  75447. options = options ? options : {};
  75448. super(options);
  75449. options.title = options.title ? options.title : "";
  75450. this._initView(options.title);
  75451. }
  75452. /**
  75453. * @private
  75454. * @override
  75455. */
  75456. _initView(titile) {
  75457. const container = document.createElement("div");
  75458. container.setAttribute("class", "component-popcontainer");
  75459. //header
  75460. const header = document.createElement("div");
  75461. header.setAttribute("class", "component-popcontainer__header");
  75462. const title = document.createElement("label");
  75463. title.setAttribute("class", "component-popcontainer__header__title");
  75464. title.innerHTML = titile;
  75465. header.appendChild(title);
  75466. const closeBtn = document.createElement("span");
  75467. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  75468. closeBtn.onclick = this.closeView.bind(this);
  75469. container.appendChild(closeBtn);
  75470. container.appendChild(header);
  75471. //content
  75472. const content = document.createElement("div");
  75473. content.setAttribute("class", "component-popcontainer__content");
  75474. this.content = content;
  75475. container.appendChild(content);
  75476. this.rootContainer = container;
  75477. }
  75478. /**
  75479. * @function PopContainer.prototype.appendContent
  75480. * @description 追加内容。
  75481. * @param {HTMLElement} dom - 内容元素。
  75482. */
  75483. appendContent(dom) {
  75484. this.content.appendChild(dom);
  75485. }
  75486. }
  75487. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  75488. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75489. * This program are made available under the terms of the Apache License, Version 2.0
  75490. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75491. /**
  75492. * @class AttributesPopContainer
  75493. * @aliasclass Components.AttributesPopContainer
  75494. * @deprecatedclass SuperMap.Components.AttributesPopContainer
  75495. * @classdesc 属性弹框组件
  75496. * @version 9.1.1
  75497. * @param {Object} options - 组件配置参数。
  75498. * @param {string} options.id - 组件 dom 元素 id。
  75499. * @param {Object} options.title - 属性弹框组件名称。
  75500. * @param {Object} options.attributes - 组件需要显示的属性内容。
  75501. * @extends {PopContainer}
  75502. * @category Components Common
  75503. * @usage
  75504. */
  75505. class AttributesPopContainer extends PopContainer {
  75506. constructor(options) {
  75507. //默认为属性:
  75508. options.title = options.title ? options.title : "属性";
  75509. super(options);
  75510. this.rootContainer.firstChild.hidden = true;
  75511. options.attributes = options.attributes ? options.attributes : [];
  75512. this._createAttributesTable(options.attributes);
  75513. }
  75514. _createAttributesTable(attributes) {
  75515. const table = document.createElement("table");
  75516. table.setAttribute("class", "component-popcontainer__content__table");
  75517. const tbody = document.createElement("tbody");
  75518. let single = true;
  75519. for (let name in attributes) {
  75520. const tr = document.createElement("tr");
  75521. if (single) {
  75522. tr.setAttribute("class", "component-popcontainer__content__td--color");
  75523. }
  75524. const title = document.createElement("td");
  75525. const titleSpan = document.createElement("Span");
  75526. titleSpan.innerHTML = name;
  75527. title.appendChild(titleSpan);
  75528. const value = document.createElement("td");
  75529. value.innerHTML = attributes[name];
  75530. tr.appendChild(title);
  75531. tr.appendChild(value);
  75532. tbody.appendChild(tr);
  75533. single = !single;
  75534. }
  75535. table.appendChild(tbody);
  75536. this.appendContent(table);
  75537. }
  75538. }
  75539. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  75540. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75541. * This program are made available under the terms of the Apache License, Version 2.0
  75542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75543. /**
  75544. * @class IndexTabsPageContainer
  75545. * @aliasclass Components.IndexTabsPageContainer
  75546. * @deprecatedclass SuperMap.Components.IndexTabsPageContainer
  75547. * @classdesc 标签索引组件。
  75548. * @version 9.1.1
  75549. * @param {Object} options - 组件配置参数。
  75550. * @param {string} options.id - 组件 dom 元素 id。
  75551. * @category Components Common
  75552. * @extends {TemplateBase}
  75553. * @usage
  75554. */
  75555. class IndexTabsPageContainer extends TemplateBase {
  75556. constructor(options) {
  75557. super(options);
  75558. this._initView();
  75559. }
  75560. /**
  75561. * @private
  75562. * @override
  75563. */
  75564. _initView() {
  75565. const container = document.createElement("div");
  75566. container.setAttribute("class", "component-tabpage");
  75567. const header = document.createElement("ul");
  75568. this.header = header;
  75569. const content = document.createElement("div");
  75570. content.setAttribute("class", "component-tabpage__content");
  75571. this.content = content;
  75572. container.appendChild(header);
  75573. container.appendChild(content);
  75574. this.rootContainer = container;
  75575. }
  75576. /**
  75577. * @function IndexTabsPageContainer.prototype.setTabs
  75578. * @description 设置标签元素。
  75579. * @param {Array.<HTMLElement>} tabs
  75580. */
  75581. setTabs(tabs) {
  75582. this.removeAllTabs();
  75583. this.appendTabs(tabs);
  75584. }
  75585. /**
  75586. * @function IndexTabsPageContainer.prototype.appendTabs
  75587. * @description 追加标签元素。
  75588. * @param {Array.<HTMLElement>} tabs
  75589. */
  75590. appendTabs(tabs) {
  75591. for (let i = 0; i < tabs.length; i++) {
  75592. let title = document.createElement("span");
  75593. title.index = i;
  75594. title.appendChild(document.createTextNode(tabs[i].title));
  75595. //绑定标签切换对应页面:
  75596. title.onclick = this._changeTabsPage.bind(this);
  75597. let content = tabs[i].content;
  75598. content.index = i;
  75599. content.hidden = true;
  75600. this.header.appendChild(title);
  75601. this.content.appendChild(content);
  75602. }
  75603. //todo 确认是否两个子元素的 index 相互对应
  75604. //默认显示第一个标签对象
  75605. this.header.firstChild.setAttribute("class", "on");
  75606. this.content.firstChild.hidden = false;
  75607. }
  75608. /**
  75609. * @function IndexTabsPageContainer.prototype.removeTab
  75610. * @description 删除某个标签页面。
  75611. * @param {number} index - 标签索引号。
  75612. */
  75613. removeTab(index) {
  75614. this.header.removeChild(this.header.children[index]);
  75615. this.content.removeChild(this.content.children[index]);
  75616. }
  75617. /**
  75618. * @function IndexTabsPageContainer.prototype.removeAllTabs
  75619. * @description 删除所有标签。
  75620. */
  75621. removeAllTabs() {
  75622. for (let i = this.header.children.length; i > 0; i--) {
  75623. this.header.removeChild(this.header.children[i]);
  75624. this.content.removeChild(this.content.children[i]);
  75625. }
  75626. }
  75627. _changeTabsPage(e) {
  75628. const index = e.target.index;
  75629. for (let i = 0; i < this.header.children.length; i++) {
  75630. this.header.children[i].setAttribute("class", "");
  75631. this.content.children[i].hidden = true;
  75632. if (i === index) {
  75633. this.header.children[i].setAttribute("class", "on");
  75634. this.content.children[i].hidden = false;
  75635. }
  75636. }
  75637. }
  75638. }
  75639. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  75640. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75641. * This program are made available under the terms of the Apache License, Version 2.0
  75642. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75643. /**
  75644. * @class CityTabsPage
  75645. * @aliasclass Components.CityTabsPage
  75646. * @deprecatedclass SuperMap.Components.CityTabsPage
  75647. * @classdesc 城市地址匹配组件模板
  75648. * @version 9.1.1
  75649. * @param {Object} options - 组件配置参数。
  75650. * @param {string} options.id - 组件 dom 元素 id。
  75651. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  75652. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  75653. * @extends {IndexTabsPageContainer}
  75654. * @category Components Common
  75655. * @usage
  75656. */
  75657. class CityTabsPage extends IndexTabsPageContainer {
  75658. constructor(options) {
  75659. super(options);
  75660. //去掉默认的边框阴影样式:
  75661. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  75662. this.config = options.config;
  75663. //header,若 config为城市名称数组,则直接加载内容
  75664. if (Util_Util.isArray(this.config)) {
  75665. this.header.hidden = true;
  75666. this._createCityItem("城市", this.config);
  75667. this.content.style.border = "none";
  75668. } else {
  75669. this._createTabs();
  75670. this.header.onclick = (e) => {
  75671. //关闭所有元素 是否有更简化的写法?
  75672. for (let i = 0; i < this.header.children.length; i++) {
  75673. this.header.children[i].setAttribute("class", "");
  75674. }
  75675. //打开点击内容元素
  75676. e.target.setAttribute("class", "on");
  75677. this._createCityContent(e.target.innerHTML);
  75678. };
  75679. }
  75680. }
  75681. /**
  75682. * @function CityTabsPage.prototype._createTabs
  75683. * @description 创建 Tabs
  75684. * @private
  75685. */
  75686. _createTabs() {
  75687. //header
  75688. if (Util_Util.isArray(this.config)) {
  75689. for (let i = 0; i < this.config.length; i++) {
  75690. let innerHTML = "";
  75691. for (const key in this.config[i]) {
  75692. innerHTML += key;
  75693. }
  75694. let li = document.createElement("li");
  75695. li.innerHTML = innerHTML;
  75696. this.header.appendChild(li);
  75697. }
  75698. } else {
  75699. for (const key in this.config) {
  75700. let li = document.createElement("li");
  75701. li.innerHTML = key;
  75702. this.header.appendChild(li);
  75703. }
  75704. }
  75705. this.header.firstChild.setAttribute("class", "on");
  75706. this._createCityContent(this.header.firstChild.innerHTML);
  75707. }
  75708. /**
  75709. * @function CityTabsPage.prototype._createCityContent
  75710. * @description 创建列表容器
  75711. * @private
  75712. */
  75713. _createCityContent(keyName) {
  75714. //清除元素:
  75715. for (let i = this.content.children.length; i > 0; i--) {
  75716. this.content.removeChild(this.content.children[i - 1]);
  75717. }
  75718. //创建对应元素
  75719. const cities = this.config[keyName];
  75720. for (let key in cities) {
  75721. this._createCityItem(key, cities[key]);
  75722. }
  75723. }
  75724. /**
  75725. * @function CityTabsPage.prototype._createCityContent
  75726. * @description 创建列表容器
  75727. * @private
  75728. */
  75729. _createCityItem(key, cities) {
  75730. const city = document.createElement("div");
  75731. const cityClass = document.createElement("div");
  75732. cityClass.setAttribute("class", "component-citytabpag__py-key");
  75733. cityClass.innerHTML = key;
  75734. city.appendChild(cityClass);
  75735. const cityContent = document.createElement("div");
  75736. cityContent.setAttribute("class", "component-citytabpag__content");
  75737. for (let i = 0; i < cities.length; i++) {
  75738. let span = document.createElement("span");
  75739. span.innerHTML = cities[i];
  75740. cityContent.appendChild(span);
  75741. }
  75742. //HOT 元素长度单独微调:
  75743. if (key === "HOT") {
  75744. cityContent.style.width = "428px";
  75745. }
  75746. city.appendChild(cityContent);
  75747. this.content.appendChild(city);
  75748. }
  75749. }
  75750. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  75751. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75752. * This program are made available under the terms of the Apache License, Version 2.0
  75753. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75754. /**
  75755. * @class NavTabsPage
  75756. * @aliasclass Components.NavTabsPage
  75757. * @deprecatedclass SuperMap.Components.NavTabsPage
  75758. * @classdesc 标签页面组件。
  75759. * @version 9.1.1
  75760. * @param {Object} options - 组件配置参数。
  75761. * @param {string} options.id - 组件 dom 元素 id。
  75762. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  75763. * @extends {TemplateBase}
  75764. * @category Components Common
  75765. * @usage
  75766. */
  75767. // todo 思考拆分的控件应该以哪种方式使用
  75768. class NavTabsPage extends TemplateBase {
  75769. constructor(options) {
  75770. super(options);
  75771. this.navTabsTitle = null;
  75772. this.navTabsContent = null;
  75773. options.tabs = options.tabs ? options.tabs : [];
  75774. this._initView(options.tabs);
  75775. }
  75776. /**
  75777. * @override
  75778. * @private
  75779. */
  75780. _initView(tabs) {
  75781. const navTabsPage = document.createElement("div");
  75782. navTabsPage.setAttribute("class", "component-navtabspage");
  75783. //关闭按钮
  75784. const closeBtn = document.createElement("span");
  75785. closeBtn.setAttribute("class", "supermapol-icons-close");
  75786. closeBtn.onclick = this.closeView.bind(this);
  75787. navTabsPage.appendChild(closeBtn);
  75788. //标签
  75789. const navTabsTitle = document.createElement("div");
  75790. this.navTabsTitle = navTabsTitle;
  75791. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  75792. navTabsPage.appendChild(navTabsTitle);
  75793. //内容
  75794. const navTabsContent = document.createElement("div");
  75795. this.navTabsContent = navTabsContent;
  75796. navTabsContent.setAttribute("class", "component-navtabspage__content");
  75797. navTabsPage.appendChild(navTabsContent);
  75798. //若 tabs 初始传入值,则
  75799. if (tabs.length > 0) {
  75800. this.appendTabs(tabs);
  75801. }
  75802. this.rootContainer = navTabsPage;
  75803. }
  75804. /**
  75805. * @function NavTabsPage.prototype.setTabs
  75806. * @description 设置标签。
  75807. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  75808. */
  75809. setTabs(tabs) {
  75810. this.removeAllTabs();
  75811. this.appendTabs(tabs);
  75812. }
  75813. /**
  75814. * @function NavTabsPage.prototype.appendTabs
  75815. * @description 添加标签页面。
  75816. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  75817. */
  75818. appendTabs(tabs) {
  75819. for (let i = 0; i < tabs.length; i++) {
  75820. let title = document.createElement("span");
  75821. title.index = i;
  75822. title.appendChild(document.createTextNode(tabs[i].title));
  75823. //绑定标签切换对应页面:
  75824. title.onclick = this._changeTabsPage.bind(this);
  75825. let content = tabs[i].content;
  75826. content.index = i;
  75827. content.hidden = true;
  75828. this.navTabsTitle.appendChild(title);
  75829. this.navTabsContent.appendChild(content);
  75830. }
  75831. //todo 确认是否两个子元素的 index 相互对应
  75832. //默认显示第一个标签对象
  75833. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  75834. this.navTabsContent.firstChild.hidden = false;
  75835. }
  75836. /**
  75837. * @function NavTabsPage.prototype.removeTab
  75838. * @description 删除某个标签页面。
  75839. * @param {number} index - 标签索引号。
  75840. */
  75841. removeTab(index) {
  75842. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  75843. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  75844. }
  75845. /**
  75846. * @function NavTabsPage.prototype.removeAllTabs
  75847. * @description 删除所有标签。
  75848. */
  75849. removeAllTabs() {
  75850. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  75851. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  75852. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  75853. }
  75854. }
  75855. _changeTabsPage(e) {
  75856. const index = e.target.index;
  75857. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  75858. this.navTabsTitle.children[i].setAttribute("class", "");
  75859. this.navTabsContent.children[i].hidden = true;
  75860. if (i === index) {
  75861. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  75862. this.navTabsContent.children[i].hidden = false;
  75863. }
  75864. }
  75865. }
  75866. }
  75867. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  75868. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75869. * This program are made available under the terms of the Apache License, Version 2.0
  75870. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75871. /**
  75872. * @class PaginationContainer
  75873. * @aliasclass Components.PaginationContainer
  75874. * @deprecatedclass SuperMap.Components.PaginationContainer
  75875. * @classdesc 分页组件模板。
  75876. * @version 9.1.1
  75877. * @param {Object} options - 组件配置参数。
  75878. * @param {string} options.id - 组件 dom 元素 id。
  75879. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  75880. * @param {number} options.pageCounts - 页数。
  75881. * @extends {TemplateBase}
  75882. * @category Components Common
  75883. * @usage
  75884. */
  75885. class PaginationContainer extends TemplateBase {
  75886. constructor(options) {
  75887. options = options ? options : {};
  75888. super(options);
  75889. this.currentPage = 0;
  75890. this.pageNumberLis = [];
  75891. this.currentPageNumberLis = [];
  75892. this.linkageEvent = null;
  75893. options.contents = options.contents ? options.contents : null;
  75894. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  75895. this._initView(options.contents, options.pageCounts);
  75896. }
  75897. /**
  75898. * @function PaginationContainer.prototype.setLinkageEvent
  75899. * @description 设置页面联动方法。
  75900. * @param {function} linkageEvent - 联动方法,实现指定功能。
  75901. */
  75902. setLinkageEvent(linkageEvent) {
  75903. this.linkageEvent = linkageEvent;
  75904. }
  75905. /**
  75906. * @private
  75907. * @override
  75908. */
  75909. _initView(contents, pageCounts) {
  75910. const container = document.createElement("div");
  75911. container.setAttribute("class", "component-pagination");
  75912. //content
  75913. const content = document.createElement("div");
  75914. content.setAttribute("class", "component-pagination__content");
  75915. container.appendChild(content);
  75916. this.content = content;
  75917. //link
  75918. const link = document.createElement("ul");
  75919. link.setAttribute("class", "component-pagination__link");
  75920. link.onclick = this._changePageEvent.bind(this);
  75921. container.appendChild(link);
  75922. this._createLink(link);
  75923. this.link = link;
  75924. //填充内容:
  75925. if (contents) {
  75926. this.setContent(contents);
  75927. }
  75928. if (pageCounts !== 0) {
  75929. this.setPageLink(pageCounts);
  75930. }
  75931. this.rootContainer = container;
  75932. }
  75933. /**---------以下是页面相关操作 **/
  75934. /**
  75935. * @function PaginationContainer.prototype.setContent
  75936. * @description 设置页面内容。
  75937. * @param {HTMLElement} element - 页面内容元素。
  75938. */
  75939. setContent(element) {
  75940. this.clearContent();
  75941. this.appendContent(element);
  75942. }
  75943. /**
  75944. * @function PaginationContainer.prototype.appendContent
  75945. * @description 追加内容。
  75946. * @param {HTMLElement} element - 页面内容元素。
  75947. */
  75948. appendContent(element) {
  75949. this.content.appendChild(element);
  75950. }
  75951. /**
  75952. * @function PaginationContainer.prototype.clearContent
  75953. * @description 清空内容元素。
  75954. */
  75955. clearContent() {
  75956. for (let i = this.content.children.length - 1; i >= 0; i--) {
  75957. this.content.removeChild(this.content.children[i]);
  75958. }
  75959. }
  75960. /** -----以下是页码相关的操作:**/
  75961. /**
  75962. * @function PaginationContainer.prototype.setPageLink
  75963. * @description 设置页码数。
  75964. * @param {number} pageNumber - 页码数。
  75965. */
  75966. setPageLink(pageNumber) {
  75967. //清空当前页码
  75968. this.pageNumberLis = [];
  75969. this.currentPageNumberLis = [];
  75970. this.clearPageLink();
  75971. //创建页码
  75972. this._createPageLi(pageNumber);
  75973. //添加页码到页码列表
  75974. this._appendPageLink();
  75975. }
  75976. /**
  75977. * @description 创建页码。
  75978. * @param pageNumber
  75979. * @private
  75980. */
  75981. _createPageLi(pageNumber) {
  75982. for (let i = 0; i < pageNumber; i++) {
  75983. const pageLi = document.createElement("li");
  75984. pageLi.innerHTML = i + 1;
  75985. /*const liContent = document.createElement("span");
  75986. liContent.innerHTML = i + 1;*/
  75987. // pageLi.appendChild(liContent);
  75988. this.pageNumberLis.push(pageLi);
  75989. }
  75990. this.pageNumberLis[0].setAttribute("class", "active");
  75991. this.currentPage = 1;
  75992. if (pageNumber < 5) {
  75993. this.currentPageNumberLis = this.pageNumberLis;
  75994. } else {
  75995. for (let i = 0; i < 5; i++) {
  75996. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  75997. }
  75998. }
  75999. }
  76000. /**
  76001. * @description 添加页码到页码列表。
  76002. * @private
  76003. */
  76004. _appendPageLink() {
  76005. //todo 如何插入中间
  76006. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  76007. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  76008. }
  76009. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  76010. //清空 active 状态
  76011. this.currentPageNumberLis[i].setAttribute("class", "");
  76012. //给当前选中的 li 赋值 active 状态
  76013. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  76014. this.currentPageNumberLis[i].setAttribute("class", "active");
  76015. }
  76016. }
  76017. //根据 currentPage 改变按钮状态
  76018. this._changeDisableState();
  76019. if (this.linkageEvent) {
  76020. this.linkageEvent(this.currentPage);
  76021. }
  76022. }
  76023. /**
  76024. * @function PaginationContainer.prototype.clearPageLink
  76025. * @description 清除页码列表。
  76026. */
  76027. clearPageLink() {
  76028. for (let i = this.link.children.length - 3; i > 1; i--) {
  76029. this.link.removeChild(this.link.children[i]);
  76030. }
  76031. }
  76032. /**
  76033. * @description 创建页码按钮。
  76034. * @param ul
  76035. * @private
  76036. */
  76037. _createLink(ul) {
  76038. for (let i = 0; i < 4; i++) {
  76039. const li = document.createElement("li");
  76040. li.setAttribute("class", "disable");
  76041. const liContent = document.createElement("span");
  76042. li.appendChild(liContent);
  76043. if (i === 0) {
  76044. liContent.id = "first";
  76045. liContent.setAttribute("class", "supermapol-icons-first");
  76046. } else if (i === 1) {
  76047. liContent.id = "prev";
  76048. liContent.setAttribute("class", "supermapol-icons-prev");
  76049. } else if (i === 2) {
  76050. liContent.id = "next";
  76051. liContent.setAttribute("class", "supermapol-icons-next");
  76052. } else if (i === 3) {
  76053. liContent.id = "last";
  76054. liContent.setAttribute("class", "supermapol-icons-last");
  76055. }
  76056. ul.appendChild(li);
  76057. }
  76058. }
  76059. /**
  76060. * @description 点击页码事件。
  76061. * @param e
  76062. * @private
  76063. */
  76064. _changePageEvent(e) {
  76065. //todo
  76066. const trigger = e.target;
  76067. //若列表禁用,点击无效
  76068. if (trigger.parentElement.classList[0] === "disable") {
  76069. return;
  76070. }
  76071. let targetLi;
  76072. if (trigger.id) {
  76073. targetLi = trigger.id;
  76074. } else if (Number(trigger.innerHTML)) {
  76075. targetLi = Number(trigger.innerHTML);
  76076. } else {
  76077. return;
  76078. }
  76079. //页码预处理:
  76080. this._prePageNum(targetLi);
  76081. //根据 currentPageNumberLis 创建页码列表
  76082. this.clearPageLink();
  76083. this._appendPageLink();
  76084. }
  76085. /**
  76086. * @description 根据 currentPage 改变按钮状态。
  76087. * @private
  76088. */
  76089. _changeDisableState() {
  76090. this.link.children[0].setAttribute("class", "");
  76091. this.link.children[1].setAttribute("class", "");
  76092. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  76093. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  76094. if (this.currentPage === 1) {
  76095. this.link.children[0].setAttribute("class", "disable");
  76096. this.link.children[1].setAttribute("class", "disable");
  76097. }
  76098. if (this.currentPage === this.pageNumberLis.length) {
  76099. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  76100. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  76101. }
  76102. }
  76103. /**
  76104. * @description 根据点击页码列表事件准备需展现的页码列表。
  76105. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  76106. * @private
  76107. */
  76108. _prePageNum(targetLi) {
  76109. const currentPageNumberLis = [];
  76110. if (targetLi === "first") {
  76111. this.currentPage = 1;
  76112. } else if (targetLi === "last") {
  76113. this.currentPage = this.pageNumberLis.length;
  76114. } else if (targetLi === "prev") {
  76115. this.currentPage = this.currentPage - 1;
  76116. } else if (targetLi === "next") {
  76117. this.currentPage = this.currentPage + 1;
  76118. } else {
  76119. this.currentPage = targetLi;
  76120. }
  76121. if (this.pageNumberLis.length <= 5) {
  76122. for (let i = 0; i < this.pageNumberLis.length; i++) {
  76123. currentPageNumberLis.push(this.pageNumberLis[i]);
  76124. }
  76125. } else {
  76126. //当前点击前三,都取前五
  76127. if (this.currentPage <= 3) {
  76128. for (let i = 0; i < 5; i++) {
  76129. currentPageNumberLis.push(this.pageNumberLis[i]);
  76130. }
  76131. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  76132. //点击后三,都取后5
  76133. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  76134. currentPageNumberLis.push(this.pageNumberLis[i]);
  76135. }
  76136. } else {
  76137. //其他,取中间:
  76138. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  76139. currentPageNumberLis.push(this.pageNumberLis[i]);
  76140. }
  76141. }
  76142. }
  76143. if (currentPageNumberLis.length > 0) {
  76144. this.currentPageNumberLis = currentPageNumberLis;
  76145. }
  76146. }
  76147. }
  76148. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  76149. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76150. * This program are made available under the terms of the Apache License, Version 2.0
  76151. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76152. /**
  76153. * @name ComponentsUtil
  76154. * @namespace
  76155. * @category BaseTypes Util
  76156. * @description 获取文件类型工具类。
  76157. * @usage
  76158. * ```
  76159. * // 浏览器
  76160. * <script type="text/javascript" src="{cdn}"></script>
  76161. * <script>
  76162. * const result = {namespace}.ComponentsUtil.getFileType(fileName);
  76163. *
  76164. * </script>
  76165. * // ES6 Import
  76166. * import { ComponentsUtil } from '{npm}';
  76167. *
  76168. * const result = ComponentsUtil.getFileType(fileName);
  76169. * ```
  76170. */
  76171. let ComponentsUtil = {
  76172. /**
  76173. * @function ComponentsUtil.getFileType
  76174. * @description 获取上传文件类型。
  76175. * @param {string} fileName - 文件名称。
  76176. */
  76177. getFileType(fileName) {
  76178. let regCSV = /^.*\.(?:csv)$/i;
  76179. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  76180. let regGeojson = /^.*\.(?:geojson|json)$/i;
  76181. if (regExcel.test(fileName)) { //校验不通过
  76182. return FileTypes.EXCEL;
  76183. } else if (regCSV.test(fileName)) {
  76184. return FileTypes.CSV;
  76185. } else if (regGeojson.test(fileName)) {
  76186. return FileTypes.GEOJSON;
  76187. }
  76188. return null;
  76189. }
  76190. };
  76191. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  76192. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76193. * This program are made available under the terms of the Apache License, Version 2.0
  76194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76195. ;// CONCATENATED MODULE: ./src/common/components/index.js
  76196. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76197. * This program are made available under the terms of the Apache License, Version 2.0
  76198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76199. //数据
  76200. //组件
  76201. //提示框组件
  76202. //图表组件
  76203. //公用模板:
  76204. //工具类
  76205. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  76206. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76207. * This program are made available under the terms of the Apache License, Version 2.0
  76208. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76209. // EXTERNAL MODULE: ./node_modules/lodash.uniqby/index.js
  76210. var lodash_uniqby = __webpack_require__(618);
  76211. var lodash_uniqby_default = /*#__PURE__*/__webpack_require__.n(lodash_uniqby);
  76212. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/format.js
  76213. function transformGraphMap(data, graphMap) {
  76214. const style = graphMap && graphMap.styles && graphMap.styles.style;
  76215. const captionField = graphMap && graphMap.captionFields && graphMap.captionFields.captionField;
  76216. const rst = { nodes: [], edges: [] };
  76217. data.forEach((item) => {
  76218. const pathData = item.path;
  76219. if (pathData) {
  76220. const { nodes, edges } = transformPath(pathData, style, captionField);
  76221. rst.nodes.push(...nodes);
  76222. rst.edges.push(...edges);
  76223. } else if (isEdge(item)) {
  76224. const edge = edgeFromGraphMap(item, style);
  76225. rst.edges.push(edge);
  76226. } else {
  76227. const node = nodeFromGraphMap(item, style, captionField);
  76228. rst.nodes.push(node);
  76229. }
  76230. });
  76231. return { nodes: uniqData(rst.nodes), edges: uniqData(rst.edges, 'edgeId') };
  76232. }
  76233. function uniqData(data, paramName = 'id') {
  76234. return lodash_uniqby_default()(data, paramName);
  76235. }
  76236. function isEdge(entity) {
  76237. return entity.hasOwnProperty('start') && entity.hasOwnProperty('end');
  76238. }
  76239. function transformPath(pathData, style, captionField) {
  76240. const rst = { nodes: [], edges: [] };
  76241. pathData.forEach((item) => {
  76242. if (isEdge(item)) {
  76243. const edge = edgeFromGraphMap(item, style);
  76244. rst.edges.push(edge);
  76245. } else {
  76246. const node = nodeFromGraphMap(item, style, captionField);
  76247. rst.nodes.push(node);
  76248. }
  76249. });
  76250. return rst;
  76251. }
  76252. function nodeFromGraphMap(entity, style, captionField) {
  76253. const { id, properties, lables } = entity;
  76254. const styleData = style ? getNodeStyle(entity, style) : {};
  76255. const label = getNodeLabel(entity, captionField);
  76256. const fillColor = styleData.fillColor || '';
  76257. const node = {
  76258. id: id + '',
  76259. label: label,
  76260. properties,
  76261. lables
  76262. };
  76263. if (styleData.size) {
  76264. node.size = styleData.size;
  76265. delete styleData.size;
  76266. }
  76267. if (styleData.fillColor) {
  76268. node.style = {
  76269. fill: fillColor,
  76270. stroke: fillColor
  76271. };
  76272. delete styleData.fillColor;
  76273. }
  76274. if (Object.keys(styleData).length !== 0) {
  76275. node.labelCfg = {
  76276. style: styleData
  76277. };
  76278. }
  76279. return node;
  76280. }
  76281. function edgeFromGraphMap(entity, style) {
  76282. const { start, end, id, type, properties } = entity;
  76283. const styleData = style ? getEdgeStyle(entity, style) : {};
  76284. return {
  76285. source: start + '',
  76286. target: end + '',
  76287. edgeId: id + '',
  76288. label: type,
  76289. labelCfg: {
  76290. style: styleData
  76291. },
  76292. properties
  76293. };
  76294. }
  76295. function getEdgeStyle(entity, style) {
  76296. if (!style) {
  76297. return {};
  76298. }
  76299. const { id, type } = entity;
  76300. const data = style.filter((item) => item.type === 'relationShip');
  76301. for (let i = 0; i < data.length; i++) {
  76302. const { textColor, font, relationTypes, relationIds } = data[i];
  76303. const ids = JSON.parse(relationIds || '[]');
  76304. const types = JSON.parse(relationTypes || '[]');
  76305. if (ids.includes(id) || types.includes(type)) {
  76306. return {
  76307. fontSize: compileFontSize(font.fontSize),
  76308. fontFamily: font.fontName,
  76309. fill: textColor,
  76310. ...formatFontStyle(font.fontStyle)
  76311. };
  76312. }
  76313. }
  76314. return {};
  76315. }
  76316. function getNodeStyle(entity, style) {
  76317. if (!style) {
  76318. return {};
  76319. }
  76320. const { id, labels } = entity;
  76321. const data = style.filter((item) => item.type === 'entity');
  76322. for (let i = 0; i < data.length; i++) {
  76323. const { color, textColor, font, size, entityTypes, entityIds } = data[i];
  76324. const ids = JSON.parse(entityIds || '[]');
  76325. const types = JSON.parse(entityTypes || '[]');
  76326. if (ids.includes(id) || types.includes(labels[0])) {
  76327. return {
  76328. fillColor: color,
  76329. fontSize: compileFontSize(font.fontSize),
  76330. fontFamily: font.fontName,
  76331. fill: textColor,
  76332. size: size,
  76333. // stroke: color,
  76334. ...formatFontStyle(font.fontStyle)
  76335. };
  76336. }
  76337. }
  76338. return {};
  76339. }
  76340. function getNodeLabel(entity, captionField) {
  76341. const { id, labels, properties } = entity;
  76342. if (captionField) {
  76343. const data = captionField instanceof Array ? captionField : [captionField];
  76344. for (let i = 0; i < data.length; i++) {
  76345. const { name, entityTypes, entityIds } = data[i];
  76346. const ids = JSON.parse(entityIds || '[]');
  76347. const types = JSON.parse(entityTypes || '[]');
  76348. if (ids.includes(id) || types.includes(labels[0])) {
  76349. return properties[name] || '';
  76350. }
  76351. }
  76352. }
  76353. return properties[properties._labelfieldname] || '';
  76354. }
  76355. function formatFontStyle(fontStyle) {
  76356. if (fontStyle === 1) {
  76357. return { fontWeight: 600 };
  76358. }
  76359. if (fontStyle === 2) {
  76360. return { fontStyle: 'italic' };
  76361. }
  76362. return {};
  76363. }
  76364. function compileFontSize(fontSize) {
  76365. return fontSize * 0.8;
  76366. }
  76367. // 处理graphMap数据的展开 折叠 隐藏的实体数据
  76368. function transformExpandCollapseHiddenData(graphMap) {
  76369. const { expand, collapse, hidden } = graphMap.dataContent;
  76370. return {
  76371. expand: expand && JSON.parse(expand),
  76372. collapse: collapse && JSON.parse(collapse),
  76373. hidden: hidden && JSON.parse(hidden)
  76374. };
  76375. }
  76376. ;// CONCATENATED MODULE: external "function(){try{return G6}catch(e){return {}}}()"
  76377. const external_function_try_return_G6_catch_e_return_namespaceObject = function(){try{return G6}catch(e){return {}}}();
  76378. var external_function_try_return_G6_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_G6_catch_e_return_namespaceObject);
  76379. // EXTERNAL MODULE: ./node_modules/insert-css/index.js
  76380. var insert_css = __webpack_require__(186);
  76381. var insert_css_default = /*#__PURE__*/__webpack_require__.n(insert_css);
  76382. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/G6Render.js
  76383. /**
  76384. * @private
  76385. * @class G6Render
  76386. * @category iServer G6Render
  76387. * @classdesc G6Render
  76388. * @param {KnowledgeGraph.Data} data - 创建graph实例的数据项。
  76389. * @param {KnowledgeGraph.Config} [config] - 创建graph实例的配置项。
  76390. * @private
  76391. */
  76392. class G6Render {
  76393. constructor() {
  76394. this.config = null;
  76395. this.graph = null;
  76396. this.data = null;
  76397. this.collpasedData = {};
  76398. this.importG6();
  76399. this.CLASS_NAME = 'SuperMap.G6Render';
  76400. }
  76401. importG6() {
  76402. if (!(external_function_try_return_G6_catch_e_return_default())) {
  76403. console.log('please import g6, eg:https://gw.alipayobjects.com/os/lib/antv/g6/4.3.2/dist/g6.min.js');
  76404. }
  76405. }
  76406. /**
  76407. * @function G6Render.prototype.initGraph
  76408. * @description 创建KnowledgeGraph实例
  76409. * @param {KnowledgeGraph.Config} config - graph配置项。
  76410. * @returns {Object} graph实例。
  76411. */
  76412. initGraph(config) {
  76413. const graph = new (external_function_try_return_G6_catch_e_return_default()).Graph(config);
  76414. this.graph = graph;
  76415. if (!config || config.highlightNode !== false) {
  76416. this.highlightNode(graph);
  76417. }
  76418. if (!config || config.highlightEdge !== false) {
  76419. this.highlightEdge(graph);
  76420. }
  76421. if (config.dragCanvas !== false || config.dragNode !== false) {
  76422. // 阻止事件冒泡
  76423. this.stopDefaultEventPropagation();
  76424. }
  76425. return graph;
  76426. }
  76427. _getContextMenu() {
  76428. const contextMenu = new (external_function_try_return_G6_catch_e_return_default()).Menu({
  76429. shouldBegin(evt) {
  76430. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  76431. return true;
  76432. }
  76433. if (evt.item) {
  76434. return true;
  76435. }
  76436. return false;
  76437. },
  76438. getContent: (evt) => {
  76439. const { item } = evt;
  76440. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  76441. return;
  76442. }
  76443. if (!item) {
  76444. return;
  76445. }
  76446. const itemType = item.getType();
  76447. const model = item.getModel();
  76448. if (itemType && model) {
  76449. if (itemType === 'node') {
  76450. if (this.isCollpased(model.id)) {
  76451. return `<ul>
  76452. <li id='expand'>展开</li>
  76453. <li id='hide'>隐藏</li>
  76454. </ul>`;
  76455. } else {
  76456. return `<ul>
  76457. <li id='collapse'>折叠</li>
  76458. <li id='hide'>隐藏</li>
  76459. </ul>`;
  76460. }
  76461. }
  76462. }
  76463. },
  76464. handleMenuClick: (target, item) => {
  76465. const liIdStrs = target.id.split('-');
  76466. switch (liIdStrs[0]) {
  76467. case 'hide':
  76468. this.hideItem(item);
  76469. break;
  76470. case 'expand':
  76471. this.expandNode(item);
  76472. break;
  76473. case 'collapse':
  76474. this.collapseNode(item);
  76475. break;
  76476. case 'show':
  76477. this.showItem(item);
  76478. break;
  76479. default:
  76480. break;
  76481. }
  76482. },
  76483. // 需要加上父级容器的 padding-left 16 与自身偏移量 10
  76484. offsetX: 16 + 10,
  76485. // 需要加上父级容器的 padding-top 24 、画布兄弟元素高度、与自身偏移量 10
  76486. offsetY: 0,
  76487. // 在哪些类型的元素上响应
  76488. itemTypes: ['node', 'edge', 'canvas']
  76489. });
  76490. return contextMenu;
  76491. }
  76492. _getGraphConfig(config) {
  76493. const animateConfig = {
  76494. speed: 120,
  76495. maxIteration: 83,
  76496. tick: () => {
  76497. this.refreshPositions()
  76498. }
  76499. };
  76500. const defaultLayout = {
  76501. type: 'fruchterman',
  76502. gravity: 5
  76503. };
  76504. const defaultNode = {};
  76505. const defaultEdge = {
  76506. type: 'line',
  76507. style: {
  76508. endArrow: {
  76509. path: 'M 0,0 L 2,1 L 2,-1 Z'
  76510. },
  76511. lineWidth: 0.5
  76512. },
  76513. labelCfg: {
  76514. autoRotate: true,
  76515. style: {
  76516. fontSize: 4,
  76517. fill: '#333'
  76518. }
  76519. }
  76520. };
  76521. const defaultMode = {
  76522. default: ['drag-canvas', 'zoom-canvas', 'drag-node']
  76523. };
  76524. const contextMenu = this._getContextMenu();
  76525. const defaultPlugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar(), contextMenu];
  76526. const hoverColor = '#b4d6ff';
  76527. const defaultNodeHighlightStyle = {
  76528. lineWidth: 3,
  76529. stroke: hoverColor
  76530. };
  76531. const defaultEdgeHighlightStyle = {
  76532. stroke: hoverColor,
  76533. lineWidth: 2,
  76534. endArrow: {
  76535. path: 'M 0,0 L 2,1 L 2,-1 Z',
  76536. fill: hoverColor
  76537. }
  76538. };
  76539. const defaultGraphConfig = (container = 'knowledgeGraph') => {
  76540. const dom = document.querySelector(`#${container}`);
  76541. return {
  76542. container: container, // String | HTMLElement,必须,在 Step 1 中创建的容器 id 或容器本身
  76543. width: dom.scrollWidth, // Number,必须,图的宽度
  76544. height: dom.scrollHeight, // Number,必须,图的高度
  76545. plugins: defaultPlugins,
  76546. modes: defaultMode,
  76547. layout: { ...defaultLayout, ...animateConfig },
  76548. defaultNode,
  76549. defaultEdge,
  76550. nodeStateStyles: {
  76551. hover: defaultNodeHighlightStyle
  76552. },
  76553. edgeStateStyles: {
  76554. hover: defaultEdgeHighlightStyle
  76555. }
  76556. };
  76557. };
  76558. if (!config) {
  76559. this._setToolBarStyle();
  76560. return defaultGraphConfig();
  76561. }
  76562. config.container = config.container || 'knowledgeGraph';
  76563. const dom =
  76564. typeof config.container === 'string' ? document.querySelector(`#${config.container}`) : config.container;
  76565. config.width = config.width || dom.scrollWidth;
  76566. config.height = config.height || dom.scrollHeight;
  76567. config.layout = { ...defaultLayout, ...(config.layout || {}), ...(config.animate !== false ? animateConfig : {}) };
  76568. config.defaultNode = { ...defaultNode, ...(config.defaultNode || {}) };
  76569. config.defaultEdge = { ...defaultEdge, ...(config.defaultEdge || {}) };
  76570. config.modes = {
  76571. default: [
  76572. config.dragCanvas !== false && 'drag-canvas',
  76573. config.zoomCanvas !== false && 'zoom-canvas',
  76574. config.dragNode !== false && 'drag-node'
  76575. ]
  76576. };
  76577. config.nodeStateStyles = {
  76578. hover: { ...defaultNodeHighlightStyle, ...(config.nodeHighlightStyle || {}) }
  76579. };
  76580. config.edgeStateStyles = {
  76581. hover: { ...defaultEdgeHighlightStyle, ...(config.edgeHighlightStyle || {}) }
  76582. };
  76583. if (config.showToolBar !== false) {
  76584. config.plugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar()];
  76585. this._setToolBarStyle();
  76586. }
  76587. if (config.showContextMenu !== false) {
  76588. config.plugins = [...(config.plugins || []), contextMenu];
  76589. this._setToolBarStyle();
  76590. }
  76591. return config;
  76592. }
  76593. /**
  76594. * @function KnowledgeGraph.prototype.changeSize
  76595. * @description 当源数据中现有节点/边 的数据项发生配置的变更时,根据新数据刷新视图。
  76596. * @param {number} width - 宽度。
  76597. * @param {number} height - 高度。
  76598. */
  76599. changeSize(width, height) {
  76600. return this.graph.changeSize(width, height);
  76601. }
  76602. /**
  76603. * @function G6Render.prototype.autoResize
  76604. * @description 浏览器窗口大小发生改变时,重新渲染;
  76605. */
  76606. autoResize() {
  76607. const dom = this.getContainer();
  76608. window.addEventListener('resize', () => {
  76609. const width = dom.scrollWidth;
  76610. const height = dom.scrollHeight;
  76611. this.graph.changeSize(width, height);
  76612. this.graph.refresh();
  76613. });
  76614. }
  76615. /**
  76616. * @function G6Render.prototype.zoom
  76617. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  76618. * @param {number} ratio 缩放比例。
  76619. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  76620. * @param {boolean} [animate] 是否开启动画。
  76621. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  76622. */
  76623. zoom(ratio, center, animate, animateCfg) {
  76624. this.graph.zoom(ratio, center, animate, animateCfg);
  76625. }
  76626. /**
  76627. * @function G6Render.prototype.zoomTo
  76628. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  76629. * @param {number} ratio 缩放比例。
  76630. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  76631. * @param {boolean} [animate] 是否开启动画。
  76632. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  76633. */
  76634. zoomTo(ratio, center, animate, animateCfg) {
  76635. this.graph.zoomTo(ratio, center, animate, animateCfg);
  76636. }
  76637. /**
  76638. * @function G6Render.prototype.fitView
  76639. * @description 让画布内容适应视口。
  76640. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  76641. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  76642. * @param {boolean} [animate] 是否开启动画。
  76643. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  76644. */
  76645. fitView(padding, rules, animate, animateCfg) {
  76646. this.graph.fitView(padding, rules, animate, animateCfg);
  76647. }
  76648. /**
  76649. * @function G6Render.prototype.fitCenter
  76650. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  76651. * @param {boolean} [animate] 是否开启动画。
  76652. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  76653. */
  76654. fitCenter(animate, animateCfg) {
  76655. this.graph.fitCenter(animate, animateCfg);
  76656. }
  76657. /**
  76658. * @function G6Render.prototype.getGraphCenterPoint
  76659. * @description 获取图内容的中心绘制坐标。
  76660. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  76661. */
  76662. getGraphCenterPoint() {
  76663. return this.graph.getGraphCenterPoint();
  76664. }
  76665. /**
  76666. * @function G6Render.prototype.getViewPortCenterPoint
  76667. * @description 获取视口中心绘制坐标。
  76668. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  76669. */
  76670. getViewPortCenterPoint() {
  76671. return this.graph.getViewPortCenterPoint();
  76672. }
  76673. /**
  76674. * @function G6Render.prototype.getZoom
  76675. * @description 获取当前视口的缩放比例。
  76676. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  76677. */
  76678. getZoom() {
  76679. return this.graph.getZoom();
  76680. }
  76681. /**
  76682. * @function G6Render.prototype.getMinZoom
  76683. * @description 获取 graph 当前允许的最小缩放比例。
  76684. * @return {number} 返回值表示当前视口的最小缩放比例。
  76685. */
  76686. getMinZoom() {
  76687. return this.graph.getMinZoom();
  76688. }
  76689. /**
  76690. * @function G6Render.prototype.setMinZoom
  76691. * @description 设置 graph 当前允许的最小缩放比例。
  76692. * @param {number} ratio 缩放比例。
  76693. */
  76694. setMinZoom(ratio) {
  76695. this.graph.setMinZoom(ratio);
  76696. }
  76697. /**
  76698. * @function G6Render.prototype.getMaxZoom
  76699. * @description 获取 graph 当前允许的最大缩放比例。
  76700. * @return {number} 返回值表示当前视口的最大缩放比例。
  76701. */
  76702. getMaxZoom() {
  76703. return this.graph.getMaxZoom();
  76704. }
  76705. /**
  76706. * @function G6Render.prototype.setMaxZoom
  76707. * @description 设置 graph 当前允许的最大缩放比例。
  76708. * @param {number} ratio 缩放比例。
  76709. */
  76710. setMaxZoom(ratio) {
  76711. this.graph.setMaxZoom(ratio);
  76712. }
  76713. /**
  76714. * @function G6Render.prototype.getWidth
  76715. * @description获取 graph 当前的宽度。
  76716. * @return {number} graph 当前的宽度。
  76717. */
  76718. getWidth() {
  76719. return this.graph.getWidth();
  76720. }
  76721. /**
  76722. * @function G6Render.prototype.getHeight
  76723. * @description 获取 graph 当前的高度。
  76724. * @return {number} graph 当前的高度。
  76725. */
  76726. getHeight() {
  76727. return this.graph.getHeight();
  76728. }
  76729. setCenter(centerDrawPoint) {
  76730. var centerCanvasPointX = this.graph.getWidth() / 2;
  76731. var centerCanvasPointY = this.graph.getHeight() / 2;
  76732. var centerCanvasPointNew = this.graph.getCanvasByPoint(centerDrawPoint.x, centerDrawPoint.y);
  76733. this.graph.translate(centerCanvasPointX - centerCanvasPointNew.x, centerCanvasPointY - centerCanvasPointNew.y);
  76734. }
  76735. /**
  76736. * @function G6Render.prototype._setToolBarStyle
  76737. * @description 隐藏工具栏的redo undo realZoom按钮
  76738. * @private
  76739. */
  76740. _setToolBarStyle() {
  76741. insert_css_default()(`
  76742. .g6-component-toolbar li[code='redo'],
  76743. .g6-component-toolbar li[code='undo'],
  76744. .g6-component-toolbar li[code='realZoom'] {
  76745. display: none;
  76746. }
  76747. .g6-component-contextmenu {
  76748. position: absolute;
  76749. z-index: 2;
  76750. list-style-type: none;
  76751. border-radius: 6px;
  76752. font-size: 14px;
  76753. width: fit-content;
  76754. transition: opacity .2s;
  76755. text-align: center;
  76756. box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);
  76757. border: 0px;
  76758. }
  76759. .g6-component-contextmenu ul {
  76760. padding-left: 0px;
  76761. margin: 0;
  76762. }
  76763. .g6-component-contextmenu li {
  76764. cursor: pointer;
  76765. list-style-type: none;
  76766. list-style: none;
  76767. margin-left: 0;
  76768. line-height: 38px;
  76769. padding: 0px 35px;
  76770. }
  76771. .g6-component-contextmenu li:hover {
  76772. color: #333;
  76773. background: #aaaaaa45;
  76774. }
  76775. `);
  76776. }
  76777. /**
  76778. * @function G6Render.prototype.highlightNode
  76779. * @description 鼠标移入节点,节点高亮
  76780. * @param {Object} graph - graph实例。
  76781. */
  76782. highlightNode(graph = this.graph) {
  76783. function clearAllStats() {
  76784. graph.setAutoPaint(false);
  76785. graph.getNodes().forEach(function (node) {
  76786. graph.clearItemStates(node);
  76787. });
  76788. graph.paint();
  76789. graph.setAutoPaint(true);
  76790. }
  76791. graph.on('node:mouseenter', function (e) {
  76792. const item = e.item;
  76793. graph.setAutoPaint(false);
  76794. graph.getNodes().forEach(function (node) {
  76795. graph.clearItemStates(node);
  76796. });
  76797. graph.setItemState(item, 'hover', true);
  76798. graph.paint();
  76799. graph.setAutoPaint(true);
  76800. });
  76801. graph.on('node:mouseleave', clearAllStats);
  76802. }
  76803. /**
  76804. * @function G6Render.prototype.highlightNode
  76805. * @description 鼠标移入节点,节点高亮
  76806. * @param {Object} graph - graph实例。
  76807. */
  76808. highlightEdge(graph = this.graph) {
  76809. function clearAllStats() {
  76810. graph.setAutoPaint(false);
  76811. graph.getEdges().forEach(function (edge) {
  76812. graph.clearItemStates(edge);
  76813. });
  76814. graph.paint();
  76815. graph.setAutoPaint(true);
  76816. }
  76817. graph.on('edge:mouseenter', function (e) {
  76818. const item = e.item;
  76819. graph.setAutoPaint(false);
  76820. graph.getNodes().forEach(function (node) {
  76821. graph.clearItemStates(node);
  76822. });
  76823. graph.setItemState(item, 'hover', true);
  76824. graph.paint();
  76825. graph.setAutoPaint(true);
  76826. });
  76827. graph.on('edge:mouseleave', clearAllStats);
  76828. }
  76829. /**
  76830. * @function G6Render.prototype.setData
  76831. * @description 设置数据
  76832. * @param {KnowledgeGraph.Data} data - graph数据。
  76833. * @param {Object} [graph] - graph实例。
  76834. */
  76835. setData(data, graph = this.graph) {
  76836. if (!this.data) {
  76837. graph.data(data);
  76838. } else {
  76839. graph.changeData(data);
  76840. }
  76841. this.data = data;
  76842. }
  76843. /**
  76844. * @function G6Render.prototype.render
  76845. * @description 根据提供的数据渲染视图。
  76846. */
  76847. render(graph = this.graph) {
  76848. return graph.render();
  76849. }
  76850. /**
  76851. * @function G6Render.prototype.updateGraph
  76852. * @description 更新数据
  76853. * @param {Object} graph - graph实例。
  76854. * @param {KnowledgeGraph.Data} data - graph数据。
  76855. */
  76856. updateGraph(data, graph = this.graph) {
  76857. this.data = data;
  76858. graph.changeData(data);
  76859. }
  76860. /**
  76861. * @function G6Render.prototype.refresh
  76862. * @description 当源数据中现有节点/边的数据项发生配置的变更时,根据新数据刷新视图。
  76863. * @param {Object} graph - graph实例。
  76864. */
  76865. refresh(graph = this.graph) {
  76866. graph.refresh();
  76867. }
  76868. /**
  76869. * @function G6Render.prototype.getContainer
  76870. * @description 获取 Graph 的 DOM 容器。
  76871. * @param {Object} graph - graph实例。
  76872. * @return {HTMLElement} DOM 容器。
  76873. */
  76874. getContainer(graph = this.graph) {
  76875. return graph.getContainer();
  76876. }
  76877. /**
  76878. * @function G6Render.prototype.getCanvas
  76879. * @description 获取canvas。
  76880. * @param {Object} graph - graph实例。
  76881. * @return {HTMLElement} canvas。
  76882. */
  76883. getCanvas(graph = this.graph) {
  76884. return graph.get('canvas');
  76885. }
  76886. /**
  76887. * @function G6Render.prototype.getNodes
  76888. * @description 获取图中所有节点的实例。
  76889. * @param {Object} graph - graph实例。
  76890. * @return {Array} 返回值表示图中所有节点的实例。
  76891. */
  76892. getNodes(graph = this.graph) {
  76893. return graph.getNodes();
  76894. }
  76895. /**
  76896. * @function G6Render.prototype.getEdges
  76897. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  76898. * @param {Object} graph - graph实例。
  76899. * @return {Array} 返回值表示图中所有边的实例。
  76900. */
  76901. getEdges(graph = this.graph) {
  76902. return graph.getEdges();
  76903. }
  76904. /**
  76905. * @function G6Render.prototype.getNeighbors
  76906. * @description 获取邻居节点数组。
  76907. * @param {Object} graph - graph实例。
  76908. * @param {string | INode} node - 节点 ID 或节点实例。
  76909. * @param {string|undefined} type -['source'| 'target' |undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  76910. * @return {Array} 返回值符合要求的节点数组。
  76911. */
  76912. getNeighbors(node, type, graph = this.graph) {
  76913. return graph.getNeighbors(node, type);
  76914. }
  76915. /**
  76916. * @function G6Render.prototype.findById
  76917. * @description 根据 ID,查询对应的元素实例。
  76918. * @param {Object} graph - graph实例。
  76919. * @param {string} id - 元素 ID
  76920. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  76921. */
  76922. findById(id, graph = this.graph) {
  76923. return graph.findById(id);
  76924. }
  76925. /**
  76926. * @function G6Render.prototype.find
  76927. * @description 获取邻居节点数组。
  76928. * @param {Object} graph - graph实例。
  76929. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  76930. * @param {Function} fn - 查找的规则。
  76931. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  76932. */
  76933. find(type, fn, graph = this.graph) {
  76934. return graph.find(type, fn);
  76935. }
  76936. /**
  76937. * @function G6Render.prototype.findAll
  76938. * @description 获取邻居节点数组。
  76939. * @param {Object} graph - graph实例。
  76940. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  76941. * @param {Function} fn - 查找的规则。
  76942. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  76943. */
  76944. findAll(type, fn, graph = this.graph) {
  76945. return graph.findAll(type, fn);
  76946. }
  76947. /**
  76948. * @function G6Render.prototype.getEdgesByNode
  76949. * @description 获取与当前节点有关联的所有边。
  76950. * @param {Object} node - node实例。
  76951. * @return {Array} edge实例数组。
  76952. */
  76953. getEdgesByNode(node) {
  76954. return node.getEdges();
  76955. }
  76956. /**
  76957. * @function G6Render.prototype.getEdgesByNode
  76958. * @description 获取与当前节点关联的所有入边。
  76959. * @param {Object} node - node实例。
  76960. * @return {Array} edge实例数组。
  76961. */
  76962. getInEdges(node) {
  76963. return node.getInEdges();
  76964. }
  76965. /**
  76966. * @function G6Render.prototype.getEdgesByNode
  76967. * @description 获取与当前节点关联的所有出边。
  76968. * @param {Object} node - node实例。
  76969. * @return {Array} edge实例数组。
  76970. */
  76971. getOutEdges(node) {
  76972. return node.getOutEdges();
  76973. }
  76974. /**
  76975. * @function G6Render.prototype.getSourceByEdge
  76976. * @description 获取当前边的起始节点
  76977. * @param {Object} edge - node实例。
  76978. * @return {Object} 返回值为起始节点的实例。
  76979. */
  76980. getSourceByEdge(edge) {
  76981. return edge.getSource();
  76982. }
  76983. /**
  76984. * @function G6Render.prototype.getTargetByEdge
  76985. * @description 获取当前边的终止节点。
  76986. * @param {Object} edge - node实例。
  76987. * @return {Object} 终止节点的实例。
  76988. */
  76989. getTargetByEdge(edge) {
  76990. return edge.getTarget();
  76991. }
  76992. /**
  76993. * @function G6Render.prototype.expandNode
  76994. * @description 展开当前节点。
  76995. * @param {Object} item - 元素 ID 或元素实例。
  76996. */
  76997. expandNode(item) {
  76998. const id = item.getModel().id;
  76999. this._expandCollapseNode(this.collpasedData[id], 'show');
  77000. delete this.collpasedData[id];
  77001. }
  77002. /**
  77003. * @function G6Render.prototype.collapseNode
  77004. * @description 收起当前节点。
  77005. * @param {Object} item - 元素 ID 或元素实例。
  77006. * @param {Object} graph - graph实例。
  77007. */
  77008. collapseNode(item) {
  77009. const id = item.getModel().id;
  77010. const result = [];
  77011. this._collapseFunc(item, result);
  77012. this.collpasedData[id] = result;
  77013. this._expandCollapseNode(result);
  77014. }
  77015. isCollpased(id) {
  77016. return !!this.collpasedData[id];
  77017. }
  77018. _collapseFunc(item, res = []) {
  77019. const sourceNodes = this.getNeighbors(item, 'target');
  77020. const targetNodes = this.getNeighbors(item, 'source');
  77021. // 指出节点, 如果没有其他链接,隐藏
  77022. for (let i = 0; i < sourceNodes.length; i++) {
  77023. const sourceNode = sourceNodes[i];
  77024. const model = sourceNode.getModel();
  77025. let nodes = this.getNeighbors(sourceNode);
  77026. // if (nodes && exceptNode) {
  77027. // nodes = nodes.filter((item) => item.id !== exceptNode);
  77028. // }
  77029. if (nodes.length === 1) {
  77030. res.push({ id: model.id });
  77031. }
  77032. }
  77033. // 指入节点, 如果没有其他链接或者没有指入节点隐藏,隐藏
  77034. for (let i = 0; i < targetNodes.length; i++) {
  77035. const targetNode = targetNodes[i];
  77036. const model = targetNode.getModel();
  77037. let nodes = this.getNeighbors(targetNode);
  77038. let targetNodeNodes = this.getNeighbors(targetNode, 'source');
  77039. // if (nodes && exceptNode) {
  77040. // nodes = nodes.filter((item) => item.id !== exceptNode);
  77041. // }
  77042. // if (targetNodeNodes && exceptNode) {
  77043. // targetNodeNodes = targetNodeNodes.filter((item) => item.id !== exceptNode);
  77044. // }
  77045. if (nodes.length === 1 || targetNodeNodes.length === 0) {
  77046. res.push({ id: model.id });
  77047. } else {
  77048. const result = [];
  77049. this._collapseFunc(targetNode, result);
  77050. res.push({ id: model.id, children: result });
  77051. }
  77052. }
  77053. return res;
  77054. }
  77055. _expandCollapseNode(data, type = 'hide') {
  77056. if (!data) {
  77057. return;
  77058. }
  77059. data.forEach((item) => {
  77060. if (type === 'hide') {
  77061. this.hideItem(item.id);
  77062. } else {
  77063. this.showItem(item.id);
  77064. // 如果是把之前的折叠也展开了, 就要把之前的折叠数据删除
  77065. if (this.isCollpased(item.id)) {
  77066. delete this.collpasedData[item.id];
  77067. }
  77068. }
  77069. if (item.children) {
  77070. this._expandCollapseNode(item.children, type);
  77071. }
  77072. });
  77073. }
  77074. /**
  77075. * @function G6Render.prototype.showItem
  77076. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  77077. * @param {string|Object} item - 元素 ID 或元素实例。
  77078. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  77079. * @param {Object} graph - graph实例。
  77080. */
  77081. showItem(item, stack, graph = this.graph) {
  77082. graph.showItem(item, stack);
  77083. }
  77084. /**
  77085. * @function G6Render.prototype.showItem
  77086. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  77087. * @param {string|Object} item - 元素 ID 或元素实例。
  77088. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  77089. * @param {Object} graph - graph实例。
  77090. */
  77091. hideItem(item, stack, graph = this.graph) {
  77092. graph.hideItem(item, stack);
  77093. }
  77094. /**
  77095. * @function G6Render.prototype.show
  77096. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  77097. * @param {Object} item - 元素实例。
  77098. */
  77099. show(item) {
  77100. item.show();
  77101. }
  77102. /**
  77103. * @function G6Render.prototype.hide
  77104. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  77105. * @param {Object} item - 元素实例。
  77106. */
  77107. hide(item) {
  77108. item.hide();
  77109. }
  77110. /**
  77111. * @function G6Render.prototype.changeVisibility
  77112. * @description 更改元素是否显示。
  77113. * @param {Object} item - 元素实例。
  77114. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  77115. */
  77116. changeVisibility(item, visible) {
  77117. item.changeVisibility(visible);
  77118. }
  77119. /**
  77120. * @function G6Render.prototype.isVisible
  77121. * @description 查询元素显示状态。
  77122. * @param {Object} item - 元素实例。
  77123. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  77124. */
  77125. isVisible(item) {
  77126. return item.isVisible();
  77127. }
  77128. /**
  77129. * @function G6Render.prototype.getModel
  77130. * @description 获取元素的数据模型。
  77131. * @param {Object} item - 元素实例。
  77132. * @return {KnowledgeGraph.Data} - 返回值为节点的数据模型。
  77133. */
  77134. getModel(item) {
  77135. return item.getModel();
  77136. }
  77137. /**
  77138. * @function G6Render.prototype.addItem
  77139. * @description 新增元素(节点和边)。
  77140. * @param {Object} graph - graph实例。
  77141. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  77142. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  77143. */
  77144. addItem(type, model, graph = this.graph) {
  77145. graph.addItem(type, model);
  77146. }
  77147. /**
  77148. * @function G6Render.prototype.addItem
  77149. * @description 删除元素。
  77150. * @param {string|Object} item - 元素 ID 或元素实例
  77151. * @param {Object} graph - graph实例。
  77152. */
  77153. removeItem(item, graph = this.graph) {
  77154. graph.removeItem(item);
  77155. }
  77156. /**
  77157. * @function G6Render.prototype.updateItem
  77158. * @description 更新元素,包括更新数据、样式等。
  77159. * @param {Object} graph - graph实例。
  77160. * @param {string|Object} item - 元素 ID 或元素实例。
  77161. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  77162. */
  77163. updateItem(item, model, graph = this.graph) {
  77164. graph.updateItem(item, model);
  77165. }
  77166. /**
  77167. * @function G6Render.prototype.refreshItem
  77168. * @description 刷新指定元素。
  77169. * @param {Object} graph - graph实例。
  77170. * @param {string|Object} item - 元素 ID 或元素实例。
  77171. */
  77172. refreshItem(item, graph = this.graph) {
  77173. graph.refreshItem(item);
  77174. }
  77175. /**
  77176. * @function G6Render.prototype.refreshPositions
  77177. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  77178. * @param {Object} graph - graph实例。
  77179. */
  77180. refreshPositions(graph = this.graph) {
  77181. graph.refreshPositions();
  77182. }
  77183. /**
  77184. * @function G6Render.prototype.on
  77185. * @description graph监听事件
  77186. * @param {Object} graph - graph实例。
  77187. * @param {string} eventName - 事件名,可选事件名参见 Event。
  77188. * @param {Function} handler - 监听函数。
  77189. */
  77190. on(eventName, handler, graph = this.graph) {
  77191. graph.on(eventName, handler);
  77192. }
  77193. /**
  77194. * @function G6Render.prototype.off
  77195. * @description graph关闭事件
  77196. * @param {Object} graph - graph实例。
  77197. * @param {string} eventName - 事件名,可选事件名参见 Event。
  77198. * @param {Function} handler - 监听函数。
  77199. */
  77200. off(eventName, handler, graph = this.graph) {
  77201. graph.off(eventName, handler);
  77202. }
  77203. /**
  77204. * @function G6Render.prototype.toDataURL
  77205. * @description 转换成图片
  77206. * @param {Object} graph - graph实例。
  77207. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  77208. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  77209. * @return {string} 返回值表示生成的图片的 URL。
  77210. */
  77211. toDataURL(type, backgroundColor, graph = this.graph) {
  77212. graph.toDataURL(type, backgroundColor);
  77213. }
  77214. /**
  77215. * @function G6Render.prototype.bindNodeDefaultDragEvent
  77216. * @description 给graph的节点绑定默认的拖拽事件
  77217. *
  77218. * @param {Object} graph - graph实例。
  77219. */
  77220. bindNodeDefaultDragEvent(graph = this.graph) {
  77221. graph.on('node:dragstart', function (e) {
  77222. refreshDragedNodePosition(e);
  77223. });
  77224. graph.on('node:drag', function (e) {
  77225. refreshDragedNodePosition(e);
  77226. });
  77227. graph.on('node:dragend', function (e) {
  77228. e.item.get('model').fx = null;
  77229. e.item.get('model').fy = null;
  77230. });
  77231. }
  77232. /**
  77233. * @function G6Render.prototype.stopDefaultEventPropagation
  77234. * @description 阻止点击事件冒泡
  77235. * @param {Object} graph - graph实例。
  77236. */
  77237. stopDefaultEventPropagation(graph = this.graph) {
  77238. graph.on('click', function (e) {
  77239. e.stopPropagation();
  77240. });
  77241. graph.on('mousedown', function (e) {
  77242. e.stopPropagation();
  77243. });
  77244. graph.on('mouseover', function (e) {
  77245. e.stopPropagation();
  77246. });
  77247. graph.on('mouseout', function (e) {
  77248. e.stopPropagation();
  77249. });
  77250. }
  77251. /**
  77252. * @function G6Render.prototype.clear
  77253. * @description 清除画布元素
  77254. * @param {Object} graph - graph实例。
  77255. */
  77256. clear(graph = this.graph) {
  77257. graph.clear();
  77258. }
  77259. /**
  77260. * @function G6Render.prototype.destroy
  77261. * @description 销毁画布
  77262. * @param {Object} graph - graph实例。
  77263. */
  77264. destroy(graph = this.graph) {
  77265. graph.destroy();
  77266. }
  77267. }
  77268. /**
  77269. * @description 更新拖拽后节点的x ,y
  77270. */
  77271. function refreshDragedNodePosition(e) {
  77272. const model = e.item.get('model');
  77273. model.fx = e.x;
  77274. model.fy = e.y;
  77275. model.x = e.x;
  77276. model.y = e.y;
  77277. return model;
  77278. }
  77279. // EXTERNAL MODULE: ./node_modules/lodash.clonedeep/index.js
  77280. var lodash_clonedeep = __webpack_require__(465);
  77281. var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
  77282. ;// CONCATENATED MODULE: ./src/common/overlay/KnowledgeGraph.js
  77283. /**
  77284. * @class KnowledgeGraph
  77285. * @category iServer KnowledgeGraph
  77286. * @classdesc KnowledgeGraph知识图谱
  77287. * @version 11.1.0
  77288. * @param { KnowledgeGraph.Config } config - 创建graph实例的配置项。
  77289. * @usage
  77290. */
  77291. /**
  77292. * @typedef {Object} KnowledgeGraph.Data - 创建graph实例的数据项。
  77293. * @property {Array.<KnowledgeGraph.Node>} data.nodes - 创建graph节点。
  77294. * @property {Array.<KnowledgeGraph.Edge>} data.edges - 创建graph边。
  77295. */
  77296. /**
  77297. * @typedef {Object} KnowledgeGraph.Config - 创建graph实例的配置项。
  77298. * @property {string | HTMLElement} container - 创建的容器 id 或容器本身, 默认是'knowledgeGraph'。
  77299. * @property {number} width - 图的宽度, 默认是container的width。
  77300. * @property {number} height - 图的高度,默认是container的height。
  77301. * @property {Array.<number>} [center] - 中心点的渲染坐标。可以通过KnowledgeGraph.prototype.getViewPortCenterPoint获取。
  77302. * @property {number} [zoom] - 缩放比例。
  77303. * @property {number} [minZoom] - 最小缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例小于该值,则将使用该值进行缩放,并返回 false。
  77304. * @property {number} [maxZoom] - 最大缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例大于该值,则将使用该值进行缩放,并返回 false。
  77305. * @property {KnowledgeGraph.Layout} [layout] - 布局。
  77306. * @property {boolean} [animate=true] - 是否开启动画。
  77307. * @property {boolean} [autoResize=true] - 当视口变换时,是否自动重绘。
  77308. * @property {KnowledgeGraph.NodeStyle} [defaultNode] - 默认状态下节点的配置,比如 type, size, color。会被写入的 data 覆盖。
  77309. * @property {KnowledgeGraph.EdgeStyle} [defaultEdge] - 默认状态下边的配置,比如 type, size, color。会被写入的 data 覆盖。
  77310. * @property {KnowledgeGraph.NodeStyle} [nodeHighlightStyle] - 鼠标移入节点高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  77311. * @property {KnowledgeGraph.EdgeStyle} [edgeHighlightStyle] - 鼠标移入边高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  77312. * @property {boolean} [highlightNode = true] - 鼠标移入是否高亮节点。
  77313. * @property {boolean} [highlightEdge = true] - 鼠标移入是否高亮边。
  77314. * @property {boolean} [showToolBar = true] - 是否打开工具条, 包含放大,缩小,切换到实际大小功能。
  77315. * @property {boolean} [showContextMenu = true] - 是否打开节点的右键菜单, 包含展开\折叠、隐藏功能。
  77316. * @property {boolean} [dragCanvas = true] - 是否可以拖拽canvas。
  77317. * @property {boolean} [zoomCanvas = true] - 是否可以缩放canvas。
  77318. * @property {boolean} [dragNode = true] - 是否可以拖拽node节点。
  77319. * @property {number} [nodeLabelMaxWidth] - node节点的标签开启省略号配置项,大于该宽度使用省略号。
  77320. */
  77321. /**
  77322. * @typedef {Object} KnowledgeGraph.Layout - 布局。
  77323. * @property {string} [type='fruchterman'] - 布局类型, 可选值:['fruchterman']。 默认'fruchterman'。
  77324. */
  77325. /**
  77326. * @typedef {Object} KnowledgeGraph.Node - node节点配置项。
  77327. * @property {string} id - 元素的标识 ID,必须是唯一的 string
  77328. * @property {string} [category] - 分类。
  77329. * @property {number} [x] - x坐标。
  77330. * @property {number} [y] - y坐标。
  77331. * @property {number} [size=20] - 节点的大小。
  77332. * @property {Array.<number>|number} [anchorPoints=20] - 指定边连入节点的连接点的位置(相对于该节点而言),可以为空。例如: [0, 0],代表节点左上角的锚点,[1, 1],代表节点右下角的锚点。
  77333. * @property {string} [type] - 元素的类型,不传则使用默认值,节点默认类型为 'circle'。可选值['circle','rect','ellipse','diamond', 'image']
  77334. * @property {string} [label] - 元素的文本标签,有该字段时默认会渲染 label 。
  77335. * @property {KnowledgeGraph.NodeLabelCfg} [labelCfg] - 元素文本标签的配置项,详见各子模块内容。
  77336. * @property {KnowledgeGraph.NodeStyle} [style] - 样式属性。
  77337. */
  77338. /**
  77339. * @typedef {Object} KnowledgeGraph.Edge - edge边配置项。
  77340. * @property {string} [source] -起始点 id 。
  77341. * @property {string} [target] - 结束点 id 。
  77342. * @property {number} [sourceAnchor] - 边的起始节点上的锚点的索引值。
  77343. * @property {number} [targetAnchor] - 边的终止节点上的锚点的索引值。
  77344. * @property {string} [type='line'] - 指定边的类型,可以是内置边的类型名称,也可以是自定义边的名称。默认为 'line'。可选值['line','arc','polyline','quadratic']。
  77345. * @property {string} [label] - 文本文字,如果没有则不会显示。
  77346. * @property {KnowledgeGraph.EdgeLabelCfg} [labelCfg] - 配置标签文本。
  77347. * @property {KnowledgeGraph.EdgeStyle} [style] - 通过 style 配置来修改边的填充色、边框颜色、阴影等属性,具体配置属性见:图形样式属性。
  77348. */
  77349. /**
  77350. * @typedef {Object} KnowledgeGraph.NodeLabelCfg - node节点配置项。
  77351. * @property {string} [position] - 文本相对于节点的位置,目前支持的位置有:'center','top','left','right','bottom'。默认为 'center'。modelRect 节点不支持该属性。
  77352. * @property {KnowledgeGraph.TextStyle} [style] - 标签的样式属性。
  77353. * @property {number} [offset] - 文本的偏移,position 为 'bottom' 时,文本的上方偏移量;position 为 'left' 时,文本的右方偏移量;以此类推在其他 position 时的情况。modelRect 节点的 offset 为左边距。
  77354. */
  77355. /**
  77356. * @typedef {Object} KnowledgeGraph.NodeStyle - 节点样式通用配置项。
  77357. * @property {string} [fill] - 节点填充色。
  77358. * @property {string} [stroke] - 节点的描边颜色。
  77359. * @property {number} [lineWidth] - 描边宽度。
  77360. * @property {Array.<number>} [lineDash] -描边虚线,数组代表实、虚长度。
  77361. * @property {number} [fillOpacity] - 设置填充的 alpha 或透明值。
  77362. * @property {string} [shadowColor] - 阴影颜色。
  77363. * @property {number} [shadowBlur] - 阴影范围。
  77364. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  77365. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  77366. * @property {number} [opacity] - 设置绘图的当前 alpha 或透明值。
  77367. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  77368. */
  77369. /**
  77370. * @typedef {Object} KnowledgeGraph.TextStyle - 文本样式。
  77371. * @property {string} [textAlign] - 设置文本内容的当前对齐方式。支持的属性:center / end / left / right / start,默认值为 start。
  77372. * @property {string} [textBaseline] - 设置在绘制文本时使用的当前文本基线。支持的属性:top / middle / bottom / alphabetic / hanging。默认值为 bottom。
  77373. * @property {string} [fontStyle] - 字体样式。对应 font-style。
  77374. * @property {string} [fontVariant] - 设置为小型大写字母字体。对应 font-variant。
  77375. * @property {number} [fontWeight] - 字体粗细。对应 font-weight。
  77376. * @property {number} [fontSize] - 字体大小。对应 font-size, 边标签文本默认大小是7。
  77377. * @property {string} [fontFamily] - 字体系列。对应 font-family。
  77378. * @property {number} [lineHeight] - 行高。对应 line-height。
  77379. */
  77380. /**
  77381. * @typedef {Object} KnowledgeGraph.EdgeLabelCfg - node节点配置项。
  77382. * @property {string} [position] - 文本相对于边的位置,目前支持的位置有:'start','middle','end'。默认为'middle'。
  77383. * @property {number} [refX] - 标签在 x 方向的偏移量。
  77384. * @property {number} [refY] -标签在 y 方向的偏移量。
  77385. * @property {boolean} [autoRotate=true] - 标签文字是否跟随边旋转,默认: true。
  77386. * @property { KnowledgeGraph.TextStyle} [style] - 标签的样式属性,默认: {fontSize: 3,fill: '#333'}。
  77387. */
  77388. /**
  77389. * @typedef {Object} KnowledgeGraph.EdgeStyle - 边样式通用配置项。
  77390. * @property {string} [stroke] - 边的颜色。
  77391. * @property {number} [lineWidth] - 边宽度。
  77392. * @property {number} [lineAppendWidth] -边响应鼠标事件时的检测宽度,当 lineWidth 太小而不易选中时,可以通过该参数提升击中范围。
  77393. * @property {boolean|Object} [endArrow=true] - 为 true 时在边的结束端绘制默认箭头,为 false 时不绘制结束端箭头, 默认值{path: 'M 0,0 L 2,1 L 2,-1 Z'}
  77394. * @property {boolean|Object} [startArrow] - 为 true 时在边的开始端绘制默认箭头,为 false 时不绘制结束端箭头。
  77395. * @property {number} [strokeOpacity] - 边透明度。
  77396. * @property {string} [shadowColor] - 阴影颜色。
  77397. * @property {number} [shadowBlur] - 阴影模糊程度。
  77398. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  77399. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  77400. * @property {Array.<number>} [lineDash] - 设置线的虚线样式,可以指定一个数组。一组描述交替绘制线段和间距(坐标空间单位)长度的数字。 如果数组元素的数量是奇数, 数组的元素会被复制并重复。例如, [5, 15, 25] 会变成 [5, 15, 25, 5, 15, 25]。
  77401. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  77402. */
  77403. /**
  77404. * @typedef {Object} KnowledgeGraph.AnimateConfig - 动画配置项。
  77405. * @property {number} [duration= 500] - 一次动画的时长。
  77406. * @property {string} [easing='linearEasing'] - 动画函数。
  77407. * @property {number} [delay=0] - 是否重复执行动画。
  77408. * @property {boolean} [repeat=false] - 边透明度。
  77409. * @property {string} [shadowColor] - 阴影颜色。
  77410. */
  77411. class KnowledgeGraph {
  77412. constructor(config, type = 'G6') {
  77413. /**
  77414. * @member {string} KnowledgeGraph.prototype.graph
  77415. * @description graph实例。
  77416. */
  77417. this.graph = null;
  77418. this.config = lodash_clonedeep_default()(config);
  77419. this.graphRender = null;
  77420. this.type = type;
  77421. this.createGraphRender(this.type);
  77422. this.config = this.graphRender._getGraphConfig(this.config);
  77423. this.createGraph(this.config);
  77424. this.CLASS_NAME = 'SuperMap.KnowledgeGraph';
  77425. }
  77426. /**
  77427. * @function KnowledgeGraph.dataFromGraphMap
  77428. * @description 将iServer GraphMap数据转换成KnowledgeGraph数据。
  77429. * @param {Object} queryResult - iServer知识图谱服务query数据。
  77430. * @param {Object} graphMap - iServer知识图谱服务GraphMap数据(data.graphMap)。
  77431. * @return {KnowledgeGraph.Data} 返回数据。
  77432. */
  77433. static dataFromGraphMap(queryResult, graphMap) {
  77434. return transformGraphMap(queryResult, graphMap);
  77435. }
  77436. /**
  77437. * @function KnowledgeGraph.dataFromKnowledgeGraphQuery
  77438. * @description 将iServer KnowledgeGraphService query数据转换成KnowledgeGraph数据。
  77439. * @param {Object} queryResult - iServer知识图谱服务query数据。
  77440. * @return {KnowledgeGraph.Data} 返回数据。
  77441. */
  77442. static dataFromKnowledgeGraphQuery(queryResult) {
  77443. return transformGraphMap(queryResult);
  77444. }
  77445. /**
  77446. * @function KnowledgeGraph.prototype.handleNodeStatus
  77447. * @description 展开、折叠、隐藏节点
  77448. * @param {Object} data - 展开 折叠 隐藏的对象, eg: {expand:['id1'], collapse:['id2'], hidden:['id3']}
  77449. */
  77450. handleNodeStatus(data) {
  77451. const { expand, collapse, hidden } = data;
  77452. // 解析expand参数,里面的节点再执行一次查询显示出来
  77453. this.expandNodes(expand);
  77454. // 解析collapse参数,折叠这个里面的节点
  77455. this.collapseNodes(collapse);
  77456. // 解析hidden,隐藏这个里面额的节点
  77457. this.hideNodes(hidden);
  77458. }
  77459. /**
  77460. * @function KnowledgeGraph.prototype.expandNodes
  77461. * @description 展开节点。
  77462. * @param {Array.<string>} expandData - 元素 ID 数组。
  77463. */
  77464. expandNodes(expandData) {
  77465. if (!expandData) {
  77466. return;
  77467. }
  77468. expandData.forEach((item) => {
  77469. this.expandNode(item + '');
  77470. });
  77471. }
  77472. /**
  77473. * @function KnowledgeGraph.prototype.collapseNodes
  77474. * @description 折叠节点。
  77475. * @param {Array.<string>} collapseData - 元素 ID 数组。
  77476. */
  77477. collapseNodes(collapseData) {
  77478. if (!collapseData) {
  77479. return;
  77480. }
  77481. collapseData.forEach((item) => {
  77482. this.collapseNode(item + '');
  77483. });
  77484. }
  77485. /**
  77486. * @function KnowledgeGraph.prototype.hideNodes
  77487. * @description 隐藏节点。
  77488. * @param {Array.<string>} hiddenData - 元素 ID 数组。
  77489. */
  77490. hideNodes(hiddenData) {
  77491. if (!hiddenData) {
  77492. return;
  77493. }
  77494. hiddenData.forEach((item) => {
  77495. this.hideItem(item + '');
  77496. });
  77497. }
  77498. /**
  77499. * @function KnowledgeGraph.prototype.createGraphRender
  77500. * @description 创建KnowledgeGraphRender
  77501. * @param {string} type -类型, 默认是G6。
  77502. * @private
  77503. */
  77504. createGraphRender(type) {
  77505. if (type === 'G6') {
  77506. this.graphRender = new G6Render();
  77507. }
  77508. }
  77509. /**
  77510. * @function KnowledgeGraph.prototype.createGraph
  77511. * @description 创建KnowledgeGraph的guaph实例。
  77512. * @param {Object} config - graph配置项。
  77513. * @returns {Object} graph实例。
  77514. */
  77515. createGraph(config) {
  77516. const graph = this.initGraph(config);
  77517. this.graph = graph;
  77518. this.autoResize();
  77519. return graph;
  77520. }
  77521. /**
  77522. * @function KnowledgeGraph.prototype.getGraph
  77523. * @description 获取KnowledgeGraph的guaph实例。
  77524. * @returns {Object} graph实例。
  77525. */
  77526. getGraph() {
  77527. return this.graph;
  77528. }
  77529. /**
  77530. * @function KnowledgeGraph.prototype.autoResize
  77531. * @description 浏览器窗口大小发生改变时,重新设置canvas画布的大小,重新渲染。
  77532. */
  77533. autoResize() {
  77534. if (this.config && this.config.autoResize !== false) {
  77535. this.graphRender.autoResize();
  77536. }
  77537. }
  77538. /**
  77539. * @function KnowledgeGraph.prototype.zoom
  77540. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  77541. * @param {number} ratio 缩放比例。
  77542. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  77543. * @param {boolean} [animate] 是否开启动画。
  77544. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77545. */
  77546. zoom(ratio, center, animate, animateCfg) {
  77547. this.graphRender.zoom(ratio, center, animate, animateCfg);
  77548. }
  77549. /**
  77550. * @function KnowledgeGraph.prototype.zoomTo
  77551. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  77552. * @param {number} ratio 缩放比例。
  77553. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  77554. * @param {boolean} [animate] 是否开启动画。
  77555. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77556. */
  77557. zoomTo(ratio, center, animate, animateCfg) {
  77558. this.graphRender.zoomTo(ratio, center, animate, animateCfg);
  77559. }
  77560. /**
  77561. * @function KnowledgeGraph.prototype.fitView
  77562. * @description 让画布内容适应视口。
  77563. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  77564. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  77565. * @param {boolean} [animate] 是否开启动画。
  77566. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77567. */
  77568. fitView(padding, rules, animate, animateCfg) {
  77569. this.graphRender.fitView(padding, rules, animate, animateCfg);
  77570. }
  77571. /**
  77572. * @function KnowledgeGraph.prototype.fitCenter
  77573. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  77574. * @param {boolean} [animate] 是否开启动画。
  77575. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  77576. */
  77577. fitCenter(animate, animateCfg) {
  77578. this.graphRender.fitCenter(animate, animateCfg);
  77579. }
  77580. /**
  77581. * @function KnowledgeGraph.prototype.getGraphCenterPoint
  77582. * @description 获取图内容的中心绘制坐标。
  77583. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  77584. */
  77585. getGraphCenterPoint() {
  77586. return this.graphRender.getGraphCenterPoint();
  77587. }
  77588. /**
  77589. * @function KnowledgeGraph.prototype.getViewPortCenterPoint
  77590. * @description 获取窗口的中心绘制坐标。
  77591. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  77592. */
  77593. getViewPortCenterPoint() {
  77594. return this.graphRender.getViewPortCenterPoint();
  77595. }
  77596. /**
  77597. * @function KnowledgeGraph.prototype.getZoom
  77598. * @description 获取当前视口的缩放比例。
  77599. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  77600. */
  77601. getZoom() {
  77602. return this.graphRender.getZoom();
  77603. }
  77604. /**
  77605. * @function KnowledgeGraph.prototype.getMinZoom
  77606. * @description 获取 graph 当前允许的最小缩放比例。
  77607. * @return {number} 返回值表示当前视口的最小缩放比例。
  77608. */
  77609. getMinZoom() {
  77610. return this.graphRender.getMinZoom();
  77611. }
  77612. /**
  77613. * @function KnowledgeGraph.prototype.setMinZoom
  77614. * @description 设置 graph 当前允许的最小缩放比例。
  77615. * @param {number} ratio 缩放比例。
  77616. */
  77617. setMinZoom(ratio) {
  77618. this.graphRender.setMinZoom(ratio);
  77619. }
  77620. /**
  77621. * @function KnowledgeGraph.prototype.getMaxZoom
  77622. * @description 获取 graph 当前允许的最大缩放比例。
  77623. * @return {number} 返回值表示当前视口的最大缩放比例。
  77624. */
  77625. getMaxZoom() {
  77626. return this.graphRender.getMaxZoom();
  77627. }
  77628. /**
  77629. * @function KnowledgeGraph.prototype.setMaxZoom
  77630. * @description 设置 graph 当前允许的最大缩放比例。
  77631. * @param {number} ratio 缩放比例。
  77632. */
  77633. setMaxZoom(ratio) {
  77634. this.graphRender.setMaxZoom(ratio);
  77635. }
  77636. /**
  77637. * @function KnowledgeGraph.prototype.getWidth
  77638. * @description获取 graph 当前的宽度。
  77639. * @return {number} graph 当前的宽度。
  77640. */
  77641. getWidth() {
  77642. return this.graphRender.getWidth();
  77643. }
  77644. /**
  77645. * @function KnowledgeGraph.prototype.getHeight
  77646. * @description 获取 graph 当前的高度。
  77647. * @return {number} graph 当前的高度。
  77648. */
  77649. getHeight() {
  77650. return this.graphRender.getHeight();
  77651. }
  77652. /**
  77653. * @function KnowledgeGraph.prototype.initGraph
  77654. * @description 创建KnowledgeGraph实例
  77655. * @param {Object} config - graph配置项。
  77656. * @returns {Object} graph实例。
  77657. */
  77658. initGraph(config) {
  77659. const graph = this.graphRender.initGraph(config);
  77660. this.graph = graph;
  77661. const cb = () => {
  77662. if (this.config.zoom !== undefined) {
  77663. this.zoom(this.config.zoom);
  77664. }
  77665. if (this.config.center !== undefined) {
  77666. this.graphRender.setCenter({ x: this.config.center[0], y: this.config.center[1] });
  77667. }
  77668. };
  77669. this.graph.on('beforelayout', cb);
  77670. return graph;
  77671. }
  77672. /**
  77673. * @function KnowledgeGraph.prototype.setData
  77674. * @description 设置默认数据
  77675. * @param {KnowledgeGraph.Data} data - graph数据。
  77676. * @param {Object} [graph = this.graph] - graph实例。
  77677. */
  77678. setData(data, graph = this.graph) {
  77679. data = data || { nodes: [], edges: [] };
  77680. if (this.config && this.config.nodeLabelMaxWidth) {
  77681. data.nodes = this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth, data.nodes);
  77682. }
  77683. this.graphRender.setData(data, graph);
  77684. this.render(graph); // 渲染图
  77685. this.data = data;
  77686. }
  77687. /**
  77688. * @function KnowledgeGraph.prototype.render
  77689. * @description 根据提供的数据渲染视图。
  77690. * @param {Object} [graph = this.graph] - graph实例。
  77691. */
  77692. render(graph = this.graph) {
  77693. graph && this.graphRender.render(graph);
  77694. }
  77695. /**
  77696. * @function KnowledgeGraph.prototype.updateGraph
  77697. * @description 更新数据
  77698. * @param {KnowledgeGraph.Data} data - graph数据。
  77699. * @param {Object} [graph = this.graph] - graph实例。
  77700. */
  77701. updateGraph(data, graph = this.graph) {
  77702. graph && this.graphRender.updateGraph(data, graph);
  77703. }
  77704. /**
  77705. * @function KnowledgeGraph.prototype.refresh
  77706. * @description 改变画布大小。
  77707. */
  77708. refresh() {
  77709. return this.graphRender.refresh();
  77710. }
  77711. /**
  77712. * @function KnowledgeGraph.prototype.changeSize
  77713. * @description 改变画布大小。
  77714. * @param {number} width - 宽度。
  77715. * @param {number} height - 高度。
  77716. */
  77717. changeSize(width, height) {
  77718. return this.graphRender.changeSize(width, height);
  77719. }
  77720. /**
  77721. * @function KnowledgeGraph.prototype.resize
  77722. * @description 改变画布大小后,重新渲染。
  77723. * @param {number} width - 宽度。
  77724. * @param {number} height - 高度。
  77725. */
  77726. resize(width, height) {
  77727. this.graphRender.changeSize(width, height);
  77728. this.graphRender.refresh();
  77729. }
  77730. /**
  77731. * @function KnowledgeGraph.prototype.getContainer
  77732. * @description 获取 Graph 的 DOM 容器。
  77733. * @return {HTMLElement} DOM 容器。
  77734. */
  77735. getContainer() {
  77736. return this.graphRender.getContainer();
  77737. }
  77738. /**
  77739. * @function KnowledgeGraph.prototype.getCanvas
  77740. * @description 获取canvas。
  77741. * @return {HTMLElement} canvas。
  77742. */
  77743. getCanvas() {
  77744. return this.graphRender.getCanvas();
  77745. }
  77746. /**
  77747. * @function KnowledgeGraph.prototype.getNodes
  77748. * @description 获取图中所有节点的实例。
  77749. * @return {Array} 返回值表示图中所有节点的实例。
  77750. */
  77751. getNodes() {
  77752. return this.graphRender.getNodes();
  77753. }
  77754. /**
  77755. * @function KnowledgeGraph.prototype.getEdges
  77756. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  77757. * @return {Array} 返回值表示图中所有边的实例。
  77758. */
  77759. getEdges() {
  77760. return this.graphRender.getEdges();
  77761. }
  77762. /**
  77763. * @function KnowledgeGraph.prototype.getNeighbors
  77764. * @description 获取邻居节点数组。
  77765. * @param {string | INode} node - 节点 ID 或节点实例。
  77766. * @param {string | undefined} type - ['source'| 'target' | undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  77767. * @return {Array} 返回值符合要求的节点数组。
  77768. */
  77769. getNeighbors(node, type) {
  77770. return this.graphRender.getNeighbors(node, type);
  77771. }
  77772. /**
  77773. * @function KnowledgeGraph.prototype.findById
  77774. * @description 根据 ID,查询对应的元素实例。
  77775. * @param {string} id - 元素 ID。
  77776. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  77777. */
  77778. findById(id) {
  77779. return this.graphRender.findById(id);
  77780. }
  77781. /**
  77782. * @function KnowledgeGraph.prototype.find
  77783. * @description 获取邻居节点数组。
  77784. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  77785. * @param {Function} fn - 查找的规则。
  77786. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  77787. */
  77788. find(type, fn) {
  77789. return this.graphRender.find(type, fn);
  77790. }
  77791. /**
  77792. * @function KnowledgeGraph.prototype.findAll
  77793. * @description 获取邻居节点数组。
  77794. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  77795. * @param {Function} fn - 查找的规则。
  77796. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  77797. */
  77798. findAll(type, fn) {
  77799. return this.graphRender.findAll(type, fn);
  77800. }
  77801. /**
  77802. * @function KnowledgeGraph.prototype.getEdgesByNode
  77803. * @description 获取与当前节点有关联的所有边。
  77804. * @param {Object} node - node实例。
  77805. * @return {Array} edge实例数组。
  77806. */
  77807. getEdgesByNode(node) {
  77808. return this.graphRender.getEdgesByNode(node);
  77809. }
  77810. /**
  77811. * @function KnowledgeGraph.prototype.getInEdges
  77812. * @description 获取与当前节点关联的所有入边。
  77813. * @param {Object} node - node实例。
  77814. * @return {Array} edge实例数组。
  77815. */
  77816. getInEdges(node) {
  77817. return this.graphRender.getInEdges(node);
  77818. }
  77819. /**
  77820. * @function KnowledgeGraph.prototype.getOutEdges
  77821. * @description 获取与当前节点关联的所有出边。
  77822. * @param {Object} node - node实例。
  77823. * @return {Array} edge实例数组。
  77824. */
  77825. getOutEdges(node) {
  77826. return this.graphRender.getOutEdges(node);
  77827. }
  77828. /**
  77829. * @function KnowledgeGraph.prototype.getSourceByEdge
  77830. * @description 获取当前边的起始节点
  77831. * @param {Object} edge - node实例。
  77832. * @return {Object} 返回值为起始节点的实例。
  77833. */
  77834. getSourceByEdge(edge) {
  77835. return this.graphRender.getSourceByEdge(edge);
  77836. }
  77837. /**
  77838. * @function KnowledgeGraph.prototype.getTargetByEdge
  77839. * @description 获取当前边的终止节点。
  77840. * @param {Object} edge - node实例。
  77841. * @return {Object} 终止节点的实例。
  77842. */
  77843. getTargetByEdge(edge) {
  77844. return this.graphRender.getTargetByEdge(edge);
  77845. }
  77846. /**
  77847. * @function KnowledgeGraph.prototype.expandNode
  77848. * @description 展开当前节点。
  77849. * @param {string} id - 元素 ID。
  77850. */
  77851. expandNode(id) {
  77852. const item = this.findById(id);
  77853. item && this.graphRender.expandNode(item);
  77854. }
  77855. /**
  77856. * @function KnowledgeGraph.prototype.collapseNode
  77857. * @description 收起当前节点。
  77858. * @param {string} id - 元素 ID。
  77859. */
  77860. collapseNode(id) {
  77861. const item = this.findById(id);
  77862. item && this.graphRender.collapseNode(item);
  77863. }
  77864. /**
  77865. * @function KnowledgeGraph.prototype.showItem
  77866. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  77867. * @param {string|Object} item - 元素 ID 或元素实例。
  77868. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  77869. */
  77870. showItem(item, stack) {
  77871. this.graphRender.showItem(item, stack);
  77872. }
  77873. /**
  77874. * @function KnowledgeGraph.prototype.showItem
  77875. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  77876. * @param {string|Object} item - 元素 ID 或元素实例。
  77877. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  77878. */
  77879. hideItem(item, stack) {
  77880. this.graphRender.hideItem(item, stack);
  77881. }
  77882. /**
  77883. * @function KnowledgeGraph.prototype.show
  77884. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  77885. * @param {Object} item - 元素实例。
  77886. */
  77887. show(item) {
  77888. this.graphRender.show(item);
  77889. }
  77890. /**
  77891. * @function KnowledgeGraph.prototype.hide
  77892. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  77893. * @param {Object} item - 元素实例。
  77894. */
  77895. hide(item) {
  77896. this.graphRender.hide(item);
  77897. }
  77898. /**
  77899. * @function KnowledgeGraph.prototype.changeVisibility
  77900. * @description 更改元素是否显示。
  77901. * @param {Object} item - 元素实例。
  77902. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  77903. */
  77904. changeVisibility(item, visible) {
  77905. this.graphRender.changeVisibility(item, visible);
  77906. }
  77907. /**
  77908. * @function KnowledgeGraph.prototype.isVisible
  77909. * @description 查询元素显示状态。
  77910. * @param {Object} item - 元素实例。
  77911. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  77912. */
  77913. isVisible(item) {
  77914. return this.graphRender.isVisible(item);
  77915. }
  77916. /**
  77917. * @function KnowledgeGraph.prototype.getModel
  77918. * @description 获取元素的数据模型。
  77919. * @param {Object} item - 元素实例。
  77920. * @return {Object} - 返回值为节点的数据模型。
  77921. */
  77922. getModel(item) {
  77923. return this.graphRender.getModel(item);
  77924. }
  77925. /**
  77926. * @function KnowledgeGraph.prototype.addItem
  77927. * @description 新增元素(节点和边)。
  77928. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  77929. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  77930. */
  77931. addItem(type, model) {
  77932. return this.graphRender.addItem(type, model);
  77933. }
  77934. /**
  77935. * @function KnowledgeGraph.prototype.removeItem
  77936. * @description 删除元素。
  77937. * @param {string|Object} item - 元素 ID 或元素实例。
  77938. */
  77939. removeItem(item) {
  77940. return this.graphRender.removeItem(item);
  77941. }
  77942. /**
  77943. * @function KnowledgeGraph.prototype.updateItem
  77944. * @description 更新元素,包括更新数据、样式等。
  77945. * @param {string|Object} item - 元素 ID 或元素实例。
  77946. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  77947. */
  77948. updateItem(item, model) {
  77949. return this.graphRender.updateItem(item, model);
  77950. }
  77951. /**
  77952. * @function KnowledgeGraph.prototype.refreshItem
  77953. * @description 刷新指定元素。
  77954. * @param {string|Object} item - 元素 ID 或元素实例。
  77955. */
  77956. refreshItem(item) {
  77957. return this.graphRender.refreshItem(item);
  77958. }
  77959. /**
  77960. * @function KnowledgeGraph.prototype.refreshPositions
  77961. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  77962. */
  77963. refreshPositions() {
  77964. return this.graphRender.refreshPositions();
  77965. }
  77966. /**
  77967. * @function KnowledgeGraph.prototype.on
  77968. * @description graph监听事件
  77969. * @param {string} eventName - 事件名,可选事件名参见: Node交互事件名、Edge交互事件名、Canvas交互事件名 时机事件
  77970. * 通用事件名: click dbclick mouseenter mousemove mouseout mouseover mouseleave mousedown mouseup contextmenu dragstart drag dragend dragenter dragleave drop keydown keyup wheel touchstart touchmove touchend
  77971. * Node交互事件名: node:通用事件名, 例如 node:click
  77972. * Edge交互事件名: edge:通用事件名, 例如 edge:click
  77973. * Canvas交互事件名: canvas:通用事件名,例如 canvas:click
  77974. * 时机事件:用于监听图的某方法调用前后的时机。
  77975. * beforerender 调用 render 方法之前触发
  77976. * afterrender 调用 render 方法之后触发
  77977. * beforeadditem 调用 addItem 方法之前触发
  77978. * afteradditem 调用 addItem 方法之后触发
  77979. * beforeremoveitem 调用 removeItem 方法之前触发
  77980. * afterremoveitem 调用 removeItem 方法之后触发
  77981. * beforeupdateitem 调用 updateItem 方法之前触发
  77982. * afterupdateitem 调用 updateItem 方法之后触发
  77983. * beforegraphrefresh 调用 refresh 方法之前触发
  77984. * aftergraphrefresh 调用 refresh 方法之后触发
  77985. * beforelayout 布局前触发。调用 graph.render 时会进行布局,因此 render 时会触发。或用户主动调用图的 graph.layout 时触发
  77986. * afterlayout 布局完成后触发。调用 graph.render 时会进行布局,因此 render 时布局完成后会触发。或用户主动调用图的 graph.layout 时布局完成后触发
  77987. * viewportchange 调用 graph.moveTo 或 graph.zoom 均会触发该事件
  77988. * @param {Function} handler - 监听函数。
  77989. */
  77990. on(eventName, handler) {
  77991. this.graphRender.on(eventName, handler);
  77992. }
  77993. /**
  77994. * @function KnowledgeGraph.prototype.off
  77995. * @description graph关闭事件。
  77996. * @param {string} eventName - 事件名,参考on方法的事件名。
  77997. * @param {Function} handler - 监听函数。
  77998. */
  77999. off(eventName, handler) {
  78000. this.graphRender.off(eventName, handler);
  78001. }
  78002. /**
  78003. * @function KnowledgeGraph.prototype.toDataURL
  78004. * @description 转换成图片。
  78005. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  78006. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  78007. * @return {string} 返回值表示生成的图片的 URL。
  78008. */
  78009. toDataURL(type, backgroundColor) {
  78010. this.graphRender.toDataURL(type, backgroundColor);
  78011. }
  78012. /**
  78013. * @function KnowledgeGraph.prototype.nodeLabelOpenEllipsis
  78014. * @description 转换label的省略号。
  78015. * @param {Object} nodeLabelMaxWidth - node节点标签是否开启省略号
  78016. * @param {Object} nodes - graph的nodes数据。
  78017. * @return {Array} nodes
  78018. */
  78019. nodeLabelOpenEllipsis(nodeLabelMaxWidth, nodes) {
  78020. if (!nodes) {
  78021. return [];
  78022. }
  78023. if (!nodeLabelMaxWidth) {
  78024. return nodes;
  78025. }
  78026. return nodes.map((node) => {
  78027. const fontSize =
  78028. (node.labelCfg && node.labelCfg.fontSize) ||
  78029. (this.defaultNode && this.defaultNode.labelCfg && this.defaultNode.labelCfg.fontSize) ||
  78030. 14;
  78031. node.label = fittingStr(node.label, nodeLabelMaxWidth, fontSize);
  78032. return node;
  78033. });
  78034. }
  78035. /**
  78036. * @function KnowledgeGraph.prototype.clear
  78037. * @description 清除画布元素。
  78038. * @param {Object} [graph = this.graph] - graph实例。
  78039. */
  78040. clear(graph = this.graph) {
  78041. graph && graph.clear();
  78042. }
  78043. /**
  78044. * @function KnowledgeGraph.prototype.destroy
  78045. * @description 销毁画布。
  78046. * @param {Object} [graph = this.graph] - graph实例。
  78047. */
  78048. destroy(graph = this.graph) {
  78049. graph && graph.destroy();
  78050. }
  78051. }
  78052. /**
  78053. * @private
  78054. * @description 大于最大宽度的字符串会返回带有省略号的字符串 xxx...。
  78055. * @param {string} label - 需要处理的字符串。
  78056. * @param {number} maxWidth - 最大宽度。
  78057. * @param {number} fontSize - 字体大小。
  78058. * @returns {string} 处理之后的字符串。
  78059. */
  78060. function fittingStr(label, maxWidth, fontSize) {
  78061. const calcLabelLength = (label) => {
  78062. let len = 0;
  78063. for (let i = 0; i < label.length; i++) {
  78064. if (label.charCodeAt(i) > 0 && label.charCodeAt(i) < 128) {
  78065. len++;
  78066. } else {
  78067. len += 2;
  78068. }
  78069. }
  78070. return len;
  78071. };
  78072. const fontWidth = fontSize * 1; //字号+边距
  78073. maxWidth = maxWidth * 1.6; // 需要根据自己项目调整
  78074. const width = calcLabelLength(label) * fontWidth;
  78075. const ellipsis = '…';
  78076. if (width > maxWidth) {
  78077. const len = Math.floor((maxWidth - 20) / fontWidth);
  78078. const result = label.substring(0, len);
  78079. if ((label.substring(len).length + ellipsis.length) * fontWidth > maxWidth) {
  78080. return result + '\n' + label.substring(len, len + len - 2) + ellipsis;
  78081. } else if (label.substring(len).length == 0) {
  78082. return result;
  78083. } else {
  78084. return result + '\n' + label.substring(len);
  78085. }
  78086. } else {
  78087. return label;
  78088. }
  78089. }
  78090. ;// CONCATENATED MODULE: ./src/common/index.common.js
  78091. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78092. * This program are made available under the terms of the Apache License, Version 2.0
  78093. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78094. ;// CONCATENATED MODULE: ./src/common/index.all.js
  78095. ;// CONCATENATED MODULE: ./src/common/namespace.js
  78096. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78097. * This program are made available under the terms of the Apache License, Version 2.0
  78098. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78099. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78100. * This program are made available under the terms of the Apache License, Version 2.0
  78101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78102. // Lang
  78103. SuperMap.Lang = Lang;
  78104. SuperMap.i18n = SuperMap.Lang.i18n;
  78105. // CommonUtil
  78106. SuperMap.Util = { ...SuperMap.Util, ...Util_Util };
  78107. SuperMap.Browser = Browser;
  78108. SuperMap.INCHES_PER_UNIT = INCHES_PER_UNIT;
  78109. SuperMap.METERS_PER_INCH = METERS_PER_INCH;
  78110. SuperMap.DOTS_PER_INCH = DOTS_PER_INCH;
  78111. SuperMap.IS_GECKO = IS_GECKO;
  78112. // FetchRequest
  78113. SuperMap.setCORS = setCORS;
  78114. SuperMap.isCORS = isCORS;
  78115. SuperMap.setRequestTimeout = setRequestTimeout;
  78116. SuperMap.getRequestTimeout = getRequestTimeout;
  78117. SuperMap.FetchRequest = FetchRequest;
  78118. // commontypes
  78119. SuperMap.inherit = inheritExt;
  78120. SuperMap.mixin = mixinExt;
  78121. SuperMap.String = StringExt;
  78122. SuperMap.Number = NumberExt;
  78123. SuperMap.Function = FunctionExt;
  78124. SuperMap.Array = ArrayExt;
  78125. SuperMap.Date = DateExt;
  78126. SuperMap.Event = Event;
  78127. SuperMap.Bounds = Bounds;
  78128. SuperMap.Credential = Credential;
  78129. SuperMap.Events = Events;
  78130. SuperMap.Feature = Feature_Feature;
  78131. SuperMap.Geometry = Geometry_Geometry;
  78132. SuperMap.Pixel = Pixel;
  78133. SuperMap.Size = Size;
  78134. SuperMap.Feature.Vector = Vector;
  78135. SuperMap.Geometry.Collection = Collection;
  78136. SuperMap.Geometry.Curve = Curve;
  78137. SuperMap.Geometry.GeoText = GeoText;
  78138. SuperMap.Geometry.LinearRing = LinearRing_LinearRing;
  78139. SuperMap.Geometry.LineString = LineString;
  78140. SuperMap.Geometry.MultiLineString = MultiLineString;
  78141. SuperMap.Geometry.MultiPoint = MultiPoint;
  78142. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  78143. SuperMap.Geometry.Point = Point;
  78144. SuperMap.Geometry.Polygon = Polygon_Polygon;
  78145. SuperMap.Geometry.Rectangle = Rectangle;
  78146. // Components
  78147. SuperMap.Components.Chart = ChartView;
  78148. SuperMap.Components.ChartViewModel = ChartViewModel;
  78149. SuperMap.Components.MessageBox = MessageBox;
  78150. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  78151. SuperMap.Components.CityTabsPage = CityTabsPage;
  78152. SuperMap.Components.CommonContainer = CommonContainer;
  78153. SuperMap.Components.DropDownBox = DropDownBox;
  78154. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  78155. SuperMap.Components.NavTabsPage = NavTabsPage;
  78156. SuperMap.Components.PaginationContainer = PaginationContainer;
  78157. SuperMap.Components.PopContainer = PopContainer;
  78158. SuperMap.Components.Select = Select;
  78159. SuperMap.Components.TemplateBase = TemplateBase;
  78160. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  78161. // control
  78162. SuperMap.TimeControlBase = TimeControlBase;
  78163. SuperMap.TimeFlowControl = TimeFlowControl;
  78164. // Format
  78165. SuperMap.Format = SuperMap.Format || Format;
  78166. SuperMap.Format.GeoJSON = GeoJSON;
  78167. SuperMap.Format.JSON = JSONFormat;
  78168. SuperMap.Format.WKT = WKT;
  78169. // iManager
  78170. SuperMap.iManager = IManager;
  78171. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  78172. SuperMap.iManagerServiceBase = IManagerServiceBase;
  78173. // iPortal
  78174. SuperMap.iPortal = IPortal;
  78175. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  78176. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  78177. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  78178. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  78179. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  78180. SuperMap.iPortalQueryParam = IPortalQueryParam;
  78181. SuperMap.iPortalQueryResult = IPortalQueryResult;
  78182. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  78183. SuperMap.iPortalResource = IPortalResource;
  78184. SuperMap.iPortalServiceBase = IPortalServiceBase;
  78185. SuperMap.iPortalShareEntity = IPortalShareEntity;
  78186. SuperMap.iPortalShareParam = IPortalShareParam;
  78187. SuperMap.iPortalUser = IPortalUser;
  78188. // iServer
  78189. SuperMap.AddressMatchService = AddressMatchService;
  78190. SuperMap.AggregationParameter = AggregationParameter;
  78191. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  78192. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  78193. SuperMap.BucketAggParameter = BucketAggParameter;
  78194. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  78195. SuperMap.BufferAnalystService = BufferAnalystService;
  78196. SuperMap.BufferDistance = BufferDistance;
  78197. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  78198. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  78199. SuperMap.BufferSetting = BufferSetting;
  78200. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  78201. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  78202. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  78203. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  78204. SuperMap.ChartQueryParameters = ChartQueryParameters;
  78205. SuperMap.ChartQueryService = ChartQueryService;
  78206. SuperMap.ClipParameter = ClipParameter;
  78207. SuperMap.ColorDictionary = ColorDictionary;
  78208. SuperMap.CommonServiceBase = CommonServiceBase;
  78209. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  78210. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  78211. SuperMap.CreateDatasetParameters = CreateDatasetParameters;
  78212. SuperMap.DataFlowService = DataFlowService;
  78213. SuperMap.DataReturnOption = DataReturnOption;
  78214. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  78215. SuperMap.DatasetInfo = DatasetInfo;
  78216. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  78217. SuperMap.DatasetService = DatasetService;
  78218. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  78219. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  78220. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  78221. SuperMap.DatasourceService = DatasourceService;
  78222. SuperMap.DensityAnalystService = DensityAnalystService;
  78223. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  78224. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  78225. SuperMap.EditFeaturesService = EditFeaturesService;
  78226. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  78227. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  78228. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  78229. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  78230. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  78231. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  78232. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  78233. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  78234. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  78235. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  78236. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  78237. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  78238. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  78239. SuperMap.FieldParameters = FieldParameters;
  78240. SuperMap.FieldsFilter = FieldsFilter;
  78241. SuperMap.FieldStatisticService = FieldStatisticService;
  78242. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  78243. SuperMap.FilterParameter = FilterParameter;
  78244. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  78245. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  78246. SuperMap.FindLocationParameters = FindLocationParameters;
  78247. SuperMap.FindLocationService = FindLocationService;
  78248. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  78249. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  78250. SuperMap.FindPathParameters = FindPathParameters;
  78251. SuperMap.FindPathService = FindPathService;
  78252. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  78253. SuperMap.FindServiceAreasService = FindServiceAreasService;
  78254. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  78255. SuperMap.FindTSPPathsService = FindTSPPathsService;
  78256. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  78257. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  78258. SuperMap.GeoCodingParameter = GeoCodingParameter;
  78259. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  78260. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  78261. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  78262. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  78263. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  78264. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  78265. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  78266. SuperMap.GeoprocessingService = GeoprocessingService;
  78267. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  78268. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  78269. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  78270. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  78271. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  78272. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  78273. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  78274. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  78275. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  78276. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  78277. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  78278. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  78279. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  78280. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  78281. SuperMap.GetFieldsService = GetFieldsService;
  78282. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  78283. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  78284. SuperMap.GetLayersInfoService = GetLayersInfoService;
  78285. SuperMap.Grid = Grid;
  78286. SuperMap.HillshadeParameter = HillshadeParameter;
  78287. SuperMap.Image = UGCImage;
  78288. SuperMap.ImageCollectionService = ImageCollectionService;
  78289. SuperMap.ImageGFAspect = ImageGFAspect;
  78290. SuperMap.ImageGFHillShade = ImageGFHillShade;
  78291. SuperMap.ImageGFOrtho = ImageGFOrtho;
  78292. SuperMap.ImageGFSlope = ImageGFSlope;
  78293. SuperMap.ImageRenderingRule = ImageRenderingRule;
  78294. SuperMap.ImageSearchParameter = ImageSearchParameter;
  78295. SuperMap.ImageService = ImageService;
  78296. SuperMap.ImageStretchOption = ImageStretchOption;
  78297. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  78298. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  78299. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  78300. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  78301. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  78302. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  78303. SuperMap.JoinItem = JoinItem;
  78304. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  78305. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  78306. SuperMap.LabelImageCell = LabelImageCell;
  78307. SuperMap.LabelMatrixCell = LabelMatrixCell;
  78308. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  78309. SuperMap.LabelSymbolCell = LabelSymbolCell;
  78310. SuperMap.LabelThemeCell = LabelThemeCell;
  78311. SuperMap.LayerStatus = LayerStatus;
  78312. SuperMap.LinkItem = LinkItem;
  78313. SuperMap.MappingParameters = MappingParameters;
  78314. SuperMap.MapService = MapService;
  78315. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  78316. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  78317. SuperMap.MeasureParameters = MeasureParameters;
  78318. SuperMap.MeasureService = MeasureService;
  78319. SuperMap.MetricsAggParameter = MetricsAggParameter;
  78320. SuperMap.NDVIParameter = NDVIParameter;
  78321. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  78322. SuperMap.OutputSetting = OutputSetting;
  78323. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  78324. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  78325. SuperMap.OverlayAnalystService = OverlayAnalystService;
  78326. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  78327. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  78328. SuperMap.PointWithMeasure = PointWithMeasure;
  78329. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  78330. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  78331. SuperMap.QueryByBoundsService = QueryByBoundsService;
  78332. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  78333. SuperMap.QueryByDistanceService = QueryByDistanceService;
  78334. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  78335. SuperMap.QueryByGeometryService = QueryByGeometryService;
  78336. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  78337. SuperMap.QueryBySQLService = QueryBySQLService;
  78338. SuperMap.QueryParameters = QueryParameters;
  78339. SuperMap.QueryService = QueryService;
  78340. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  78341. SuperMap.Route = Route;
  78342. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  78343. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  78344. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  78345. SuperMap.RouteLocatorService = RouteLocatorService;
  78346. SuperMap.ServerColor = ServerColor;
  78347. SuperMap.ServerFeature = ServerFeature;
  78348. SuperMap.ServerGeometry = ServerGeometry;
  78349. SuperMap.ServerStyle = ServerStyle;
  78350. SuperMap.ServerTextStyle = ServerTextStyle;
  78351. SuperMap.ServerTheme = ServerTheme;
  78352. SuperMap.SetDatasourceParameters = SetDatasourceParameters;
  78353. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  78354. SuperMap.SetLayerInfoService = SetLayerInfoService;
  78355. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  78356. SuperMap.SetLayersInfoService = SetLayersInfoService;
  78357. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  78358. SuperMap.SetLayerStatusService = SetLayerStatusService;
  78359. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  78360. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  78361. SuperMap.Sortby = Sortby;
  78362. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  78363. SuperMap.StopQueryParameters = StopQueryParameters;
  78364. SuperMap.StopQueryService = StopQueryService;
  78365. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  78366. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  78367. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  78368. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  78369. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  78370. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  78371. SuperMap.SupplyCenter = SupplyCenter;
  78372. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  78373. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  78374. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  78375. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  78376. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  78377. SuperMap.Theme = Theme;
  78378. SuperMap.ThemeDotDensity = ThemeDotDensity;
  78379. SuperMap.ThemeFlow = ThemeFlow;
  78380. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  78381. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  78382. SuperMap.ThemeGraph = ThemeGraph;
  78383. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  78384. SuperMap.ThemeGraphItem = ThemeGraphItem;
  78385. SuperMap.ThemeGraphSize = ThemeGraphSize;
  78386. SuperMap.ThemeGraphText = ThemeGraphText;
  78387. SuperMap.ThemeGridRange = ThemeGridRange;
  78388. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  78389. SuperMap.ThemeGridUnique = ThemeGridUnique;
  78390. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  78391. SuperMap.ThemeLabel = ThemeLabel;
  78392. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  78393. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  78394. SuperMap.ThemeLabelItem = ThemeLabelItem;
  78395. SuperMap.ThemeLabelText = ThemeLabelText;
  78396. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  78397. SuperMap.ThemeMemoryData = ThemeMemoryData;
  78398. SuperMap.ThemeOffset = ThemeOffset;
  78399. SuperMap.ThemeParameters = ThemeParameters;
  78400. SuperMap.ThemeRange = ThemeRange;
  78401. SuperMap.ThemeRangeItem = ThemeRangeItem;
  78402. SuperMap.ThemeService = ThemeService;
  78403. SuperMap.ThemeUnique = ThemeUnique;
  78404. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  78405. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  78406. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  78407. SuperMap.TilesetsService = TilesetsService;
  78408. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  78409. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  78410. SuperMap.TransferLine = TransferLine;
  78411. SuperMap.TransferPathParameters = TransferPathParameters;
  78412. SuperMap.TransferPathService = TransferPathService;
  78413. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  78414. SuperMap.TransferSolutionService = TransferSolutionService;
  78415. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  78416. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  78417. SuperMap.UGCLayer = UGCLayer;
  78418. SuperMap.UGCMapLayer = UGCMapLayer;
  78419. SuperMap.UGCSubLayer = UGCSubLayer;
  78420. SuperMap.UpdateDatasetParameters = UpdateDatasetParameters;
  78421. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  78422. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  78423. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  78424. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  78425. SuperMap.Vector = Vector_Vector;
  78426. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  78427. SuperMap.VectorClipJobsService = VectorClipJobsService;
  78428. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  78429. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  78430. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  78431. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  78432. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  78433. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  78434. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  78435. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  78436. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  78437. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  78438. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  78439. SuperMap.WebPrintingService = WebPrintingService;
  78440. //Online
  78441. SuperMap.Online = Online;
  78442. SuperMap.OnlineData = OnlineData;
  78443. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  78444. SuperMap.ServiceStatus = ServiceStatus;
  78445. // 包含online中的DataItemType数据类型
  78446. SuperMap.DataItemType = DataItemType;
  78447. SuperMap.DataItemOrderBy = DataItemOrderBy;
  78448. SuperMap.FilterField = FilterField;
  78449. SuperMap.OnlineServiceBase = OnlineServiceBase;
  78450. // overlay
  78451. SuperMap.Feature = SuperMap.Feature || {};
  78452. SuperMap.Feature.Theme = Theme_Theme;
  78453. SuperMap.Feature.Theme.Bar = Bar;
  78454. SuperMap.Feature.Theme.Bar3D = Bar3D;
  78455. SuperMap.Feature.Theme.Circle = Circle;
  78456. SuperMap.Feature.Theme.Graph = Graph;
  78457. SuperMap.Feature.Theme.Line = Line;
  78458. SuperMap.Feature.Theme.Pie = Pie;
  78459. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  78460. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  78461. SuperMap.Feature.Theme.Ring = Ring;
  78462. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  78463. SuperMap.Feature.ShapeParameters = ShapeParameters;
  78464. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  78465. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  78466. SuperMap.Feature.ShapeParameters.Label = Label;
  78467. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  78468. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  78469. SuperMap.Feature.ShapeParameters.Polygon = feature_Polygon_Polygon;
  78470. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  78471. SuperMap.Feature.ShapeParameters.Sector = Sector;
  78472. SuperMap.Feature.ShapeFactory = ShapeFactory;
  78473. // LevelRenderer
  78474. SuperMap.LevelRenderer = LevelRenderer;
  78475. // security
  78476. SuperMap.KeyServiceParameter = KeyServiceParameter;
  78477. SuperMap.SecurityManager = SecurityManager;
  78478. SuperMap.ServerInfo = ServerInfo;
  78479. SuperMap.TokenServiceParameter = TokenServiceParameter;
  78480. // style
  78481. SuperMap.ThemeStyle = ThemeStyle;
  78482. SuperMap.CartoCSS = CartoCSS;
  78483. // thirdparty
  78484. // SuperMap.BinaryClassification = BinaryClassification;
  78485. // SuperMap.LandcoverClassification = LandcoverClassification;
  78486. // SuperMap.ObjectDetection = ObjectDetection;
  78487. // SuperMap.WebMachineLearning = WebMachineLearning;
  78488. SuperMap.ElasticSearch = ElasticSearch;
  78489. // util
  78490. SuperMap.ArrayStatistic = ArrayStatistic;
  78491. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  78492. // REST
  78493. SuperMap.DataFormat = DataFormat;
  78494. SuperMap.ServerType = ServerType;
  78495. SuperMap.GeometryType = REST_GeometryType;
  78496. SuperMap.QueryOption = QueryOption;
  78497. SuperMap.JoinType = JoinType;
  78498. SuperMap.SpatialQueryMode = SpatialQueryMode;
  78499. SuperMap.SpatialRelationType = SpatialRelationType;
  78500. SuperMap.MeasureMode = MeasureMode;
  78501. SuperMap.Unit = Unit;
  78502. SuperMap.BufferRadiusUnit = BufferRadiusUnit;
  78503. SuperMap.EngineType = EngineType;
  78504. SuperMap.ThemeGraphTextFormat = ThemeGraphTextFormat;
  78505. SuperMap.ThemeGraphType = ThemeGraphType;
  78506. SuperMap.GraphAxesTextDisplayMode = GraphAxesTextDisplayMode;
  78507. SuperMap.GraduatedMode = GraduatedMode;
  78508. SuperMap.RangeMode = RangeMode;
  78509. SuperMap.ThemeType = ThemeType;
  78510. SuperMap.ColorGradientType = ColorGradientType;
  78511. SuperMap.TextAlignment = TextAlignment;
  78512. SuperMap.FillGradientMode = FillGradientMode;
  78513. SuperMap.AlongLineDirection = AlongLineDirection;
  78514. SuperMap.LabelBackShape = LabelBackShape;
  78515. SuperMap.LabelOverLengthMode = LabelOverLengthMode;
  78516. SuperMap.DirectionType = DirectionType;
  78517. SuperMap.OverlayOperationType = OverlayOperationType;
  78518. SuperMap.OutputType = OutputType;
  78519. SuperMap.SideType = SideType;
  78520. SuperMap.SupplyCenterType = SupplyCenterType;
  78521. SuperMap.TurnType = TurnType;
  78522. SuperMap.BufferEndType = BufferEndType;
  78523. SuperMap.SmoothMethod = SmoothMethod;
  78524. SuperMap.SurfaceAnalystMethod = SurfaceAnalystMethod;
  78525. SuperMap.DataReturnMode = DataReturnMode;
  78526. SuperMap.EditType = EditType;
  78527. SuperMap.TransferTactic = TransferTactic;
  78528. SuperMap.TransferPreference = TransferPreference;
  78529. SuperMap.GridType = GridType;
  78530. SuperMap.ColorSpaceType = ColorSpaceType;
  78531. SuperMap.LayerType = LayerType;
  78532. SuperMap.UGCLayerType = UGCLayerType;
  78533. SuperMap.StatisticMode = StatisticMode;
  78534. SuperMap.PixelFormat = PixelFormat;
  78535. SuperMap.SearchMode = SearchMode;
  78536. SuperMap.InterpolationAlgorithmType = InterpolationAlgorithmType;
  78537. SuperMap.VariogramMode = VariogramMode;
  78538. SuperMap.Exponent = Exponent;
  78539. SuperMap.ClientType = ClientType;
  78540. SuperMap.ChartType = ChartType;
  78541. SuperMap.ClipAnalystMode = ClipAnalystMode;
  78542. SuperMap.AnalystAreaUnit = AnalystAreaUnit;
  78543. SuperMap.AnalystSizeUnit = AnalystSizeUnit;
  78544. SuperMap.StatisticAnalystMode = StatisticAnalystMode;
  78545. SuperMap.SummaryType = SummaryType;
  78546. SuperMap.TopologyValidatorRule = TopologyValidatorRule;
  78547. SuperMap.BucketAggType = BucketAggType;
  78548. SuperMap.MetricsAggType = MetricsAggType;
  78549. SuperMap.GetFeatureMode = GetFeatureMode;
  78550. SuperMap.RasterFunctionType = RasterFunctionType;
  78551. SuperMap.ResourceType = ResourceType;
  78552. SuperMap.OrderBy = OrderBy;
  78553. SuperMap.OrderType = OrderType;
  78554. SuperMap.SearchType = SearchType;
  78555. SuperMap.AggregationTypes = AggregationTypes;
  78556. SuperMap.PermissionType = PermissionType;
  78557. SuperMap.EntityType = EntityType;
  78558. SuperMap.WebExportFormatType = WebExportFormatType;
  78559. SuperMap.WebScaleOrientationType = WebScaleOrientationType;
  78560. SuperMap.WebScaleType = WebScaleType;
  78561. SuperMap.WebScaleUnit = WebScaleUnit;
  78562. SuperMap.KnowledgeGraph = KnowledgeGraph
  78563. ;// CONCATENATED MODULE: external "L"
  78564. const external_L_namespaceObject = L;
  78565. var external_L_default = /*#__PURE__*/__webpack_require__.n(external_L_namespaceObject);
  78566. // EXTERNAL MODULE: ./node_modules/proj4/dist/proj4-src.js
  78567. var proj4_src = __webpack_require__(785);
  78568. var proj4_src_default = /*#__PURE__*/__webpack_require__.n(proj4_src);
  78569. ;// CONCATENATED MODULE: ./src/leaflet/core/Proj4Leaflet.js
  78570. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78571. * This program are made available under the terms of the Apache License, Version 2.0
  78572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78573. /**
  78574. * Inspired by https://github.com/kartena/Proj4Leaflet
  78575. */
  78576. window.proj4 = (proj4_src_default());
  78577. window.Proj4js = (proj4_src_default());
  78578. (external_L_default()).Proj = (external_L_default()).Proj || {};
  78579. (external_L_default()).Proj._isProj4Obj = function(a) {
  78580. return typeof a.inverse !== 'undefined' && typeof a.forward !== 'undefined';
  78581. };
  78582. /**
  78583. * @class L.Proj.Projection
  78584. * @private
  78585. * @classdesc Proj 投影定义类。
  78586. * @category BaseTypes Projection
  78587. * @extends {L.Class}
  78588. * @param {string} code - proj srsCode
  78589. * @param {string} def - 投影的 proj4 定义。{@link [详细]{https://iclient.supermap.io/web/introduction/leafletDevelop.html#projection}}
  78590. * @param {L.Bounds} bounds - 投影范围参数
  78591. */
  78592. (external_L_default()).Proj.Projection = external_L_default().Class.extend({
  78593. initialize: function(code, def, bounds, wrapLng) {
  78594. var isP4 = external_L_default().Proj._isProj4Obj(code);
  78595. this._proj = isP4 ? code : this._projFromCodeDef(code, def);
  78596. var boundsOption = bounds;
  78597. if (external_L_default().Util.isArray(bounds)) {
  78598. boundsOption = external_L_default().bounds(bounds);
  78599. }
  78600. this.bounds = isP4 ? def : boundsOption;
  78601. this.wrapLng = wrapLng;
  78602. },
  78603. /**
  78604. * @function L.Proj.Projection.prototype.project
  78605. * @description 通过地理坐标得到投影坐标。
  78606. * @param {L.Latlng} latlng - 经纬度坐标。
  78607. * @returns {L.Point} 返回投影坐标点。
  78608. */
  78609. project: function(latlng) {
  78610. var point = this._proj.forward([latlng.lng, latlng.lat]);
  78611. return new (external_L_default()).Point(point[0], point[1]);
  78612. },
  78613. /**
  78614. * @function L.Proj.Projection.prototype.unproject
  78615. * @description 通过投影坐标得到地理坐标。
  78616. * @param {L.Point} point - 坐标点。
  78617. * @param {number} unbounded - 坐标点高程值等。
  78618. * @returns {L.LatLng} 返回经纬度坐标
  78619. */
  78620. unproject: function(point, zoom) {
  78621. if (this.bounds && !this.wrapLng) {
  78622. point.x =
  78623. point.x < this.bounds.min.x
  78624. ? this.bounds.min.x
  78625. : point.x > this.bounds.max.x
  78626. ? this.bounds.max.x
  78627. : point.x;
  78628. point.y =
  78629. point.y < this.bounds.min.y
  78630. ? this.bounds.min.y
  78631. : point.y > this.bounds.max.y
  78632. ? this.bounds.max.y
  78633. : point.y;
  78634. }
  78635. var point2 = this._proj.inverse([point.x, point.y]);
  78636. return new (external_L_default()).LatLng(point2[1], point2[0], zoom);
  78637. },
  78638. _projFromCodeDef: function(code, def) {
  78639. if (def) {
  78640. proj4_src_default().defs(code, def);
  78641. } else if ((proj4_src_default()).defs[code] === undefined) {
  78642. var urn = code.split(':');
  78643. if (urn.length > 3) {
  78644. code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
  78645. }
  78646. if ((proj4_src_default()).defs[code] === undefined) {
  78647. throw 'No projection definition for code ' + code;
  78648. }
  78649. }
  78650. return proj4_src_default()(code);
  78651. },
  78652. getUnits: function() {
  78653. return this._proj.oProj.units || 'degrees';
  78654. }
  78655. });
  78656. /**
  78657. * @class CRS
  78658. * @aliasclass Proj.CRS
  78659. * @deprecatedclass L.Proj.CRS
  78660. * @deprecatedclassinstance L.supermap.Proj.crs
  78661. * @classdesc 基于 Proj4 坐标系统扩展类。
  78662. * 为计算级别,`options.scales` `options.scaleDenominators` `options.resolutions` `options.bounds` 必须指定一个,先后顺序已按优先级排列。
  78663. * 当指定`options.bounds` 时,第 0 级为一张 256 切片包含整个 bounds,即`Math.max(bounds.getSize().x, bounds.getSize().y)/256` 。
  78664. * 为保证切片行列号正确,`options.origin` `options.bounds` 必须指定一个。
  78665. * 当指定`options.bounds` 时,切片原点为 bounds 的左上角。
  78666. * @category BaseTypes Projection
  78667. * @extends {L.Class}
  78668. * @param {string} srsCode - proj srsCode。
  78669. * @param {Object} options - 参数。
  78670. * @param {string} options.def - 投影的proj4定义。[详细]{@link https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection}
  78671. * @param {(Array.<number>|L.Point)} [options.origin] - 原点。
  78672. * @param {Array.<number>} [options.scales] - 比例尺数组。
  78673. * @param {Array.<number>} [options.scaleDenominators] - 比例尺分母数组。
  78674. * @param {Array.<number>} [options.resolutions] - 分辨率数组。
  78675. * @param {(Array.<number>|L.Bounds)} [options.bounds] - 范围。
  78676. * @param {number} [options.dpi=96] - DPI。
  78677. * @param {Array.<number>} [options.wrapLng] - 定义经度(水平)坐标轴是否在给定范围内环绕。大多数情况下默认为[-180,180]。
  78678. * @example
  78679. * var crs =new CRS("EPSG:4326",{
  78680. * origin: [-180,90],
  78681. * scaleDenominators: [2000,1000,500,200,100,50,20,10],
  78682. * });
  78683. * var map=L.map('map', {
  78684. * crs: crs
  78685. * ...
  78686. * })
  78687. * @usage
  78688. */
  78689. var CRS = external_L_default().Class.extend({
  78690. includes: (external_L_default()).CRS,
  78691. options: {
  78692. transformation: new (external_L_default()).Transformation(1, 0, -1, 0)
  78693. },
  78694. initialize: function(srsCode, options) {
  78695. var code, proj, def;
  78696. if (options.bounds && options.bounds.length === 4) {
  78697. const [p1X, p1Y, p2X, p2Y] = options.bounds;
  78698. options.bounds = [[p1X, p1Y], [p2X, p2Y]];
  78699. }
  78700. if (external_L_default().Proj._isProj4Obj(srsCode)) {
  78701. proj = srsCode;
  78702. code = proj.srsCode;
  78703. options = options || {};
  78704. this.projection = new (external_L_default()).Proj.Projection(proj, options.bounds, options.wrapLng);
  78705. } else {
  78706. code = srsCode;
  78707. options = options || {};
  78708. def = options.def || '';
  78709. this.projection = new (external_L_default()).Proj.Projection(code, def, options.bounds, options.wrapLng);
  78710. }
  78711. external_L_default().Util.setOptions(this, options);
  78712. if (this.options.wrapLng) {
  78713. this.wrapLng = this.options.wrapLng;
  78714. }
  78715. this.code = code;
  78716. this.transformation = this.options.transformation;
  78717. this.options.dpi = this.options.dpi || 96;
  78718. if (this.options.bounds) {
  78719. this.options.bounds = external_L_default().bounds(this.options.bounds);
  78720. }
  78721. if (!this.options.origin && this.options.bounds) {
  78722. this.options.origin = [this.options.bounds.min.x, this.options.bounds.max.y];
  78723. }
  78724. if (this.options.origin) {
  78725. if (this.options.origin instanceof (external_L_default()).Point) {
  78726. this.options.origin = [this.options.origin.x, this.options.origin.y];
  78727. }
  78728. this.transformation = new (external_L_default()).Transformation(1, -this.options.origin[0], -1, this.options.origin[1]);
  78729. }
  78730. if (this.options.scales && this.options.scales.length > 0) {
  78731. this.scales = this.options.scales;
  78732. this._scales = this._toProj4Scales(this.options.scales, this.options.dpi);
  78733. } else if (this.options.scaleDenominators && this.options.scaleDenominators.length > 0) {
  78734. this.scales = [];
  78735. for (let i = 0; i < this.options.scaleDenominators.length; i++) {
  78736. this.scales[i] = 1 / this.options.scaleDenominators[i];
  78737. }
  78738. this._scales = this._toProj4Scales(this.scales, this.options.dpi);
  78739. } else if (this.options.resolutions && this.options.resolutions.length > 0) {
  78740. this._scales = [];
  78741. for (let i = this.options.resolutions.length - 1; i >= 0; i--) {
  78742. if (this.options.resolutions[i]) {
  78743. this._scales[i] = 1 / this.options.resolutions[i];
  78744. }
  78745. }
  78746. } else if (this.options.bounds) {
  78747. this._scales = this._getDefaultProj4ScalesByBounds(this.options.bounds);
  78748. }
  78749. this._rectify();
  78750. this.infinite = !this.options.bounds;
  78751. },
  78752. _rectify: function() {
  78753. if (this._scales) {
  78754. if (!this.resolutions) {
  78755. this.resolutions = [];
  78756. this.resolutions = this._proj4ScalesToResolutions(this._scales);
  78757. }
  78758. if (!this.scales) {
  78759. this.scales = [];
  78760. for (let i = 0; i < this.resolutions.length; i++) {
  78761. var scaleD =
  78762. this.resolutions[i] *
  78763. this.options.dpi *
  78764. (1 / 0.0254) *
  78765. this._getMeterPerMapUnit(this.projection.getUnits());
  78766. this.scales[i] = 1.0 / scaleD;
  78767. }
  78768. }
  78769. }
  78770. },
  78771. /**
  78772. * @function CRS.prototype.scale
  78773. * @description 通过缩放级别获取比例尺值。
  78774. * @param {number} zoom - 缩放级别。
  78775. * @returns 比例尺值。
  78776. */
  78777. scale: function(zoom) {
  78778. var iZoom = Math.floor(zoom),
  78779. baseScale,
  78780. nextScale,
  78781. scaleDiff,
  78782. zDiff;
  78783. if (zoom === iZoom) {
  78784. return this._scales[zoom];
  78785. } else {
  78786. // Non-integer zoom, interpolate
  78787. baseScale = this._scales[iZoom];
  78788. nextScale = this._scales[iZoom + 1];
  78789. scaleDiff = nextScale - baseScale;
  78790. zDiff = zoom - iZoom;
  78791. return baseScale + scaleDiff * zDiff;
  78792. }
  78793. },
  78794. /**
  78795. * @function CRS.prototype.zoom
  78796. * @description 根据比例尺返回缩放级别。
  78797. * @param {number} scale - 比例尺。
  78798. * @returns {number} 缩放级别。
  78799. */
  78800. zoom: function(scale) {
  78801. // Find closest number in this._scales, down
  78802. var downScale = this._closestElement(this._scales, scale),
  78803. downZoom = this._scales.indexOf(downScale),
  78804. nextScale,
  78805. nextZoom,
  78806. scaleDiff;
  78807. // Check if scale is downScale => return array index
  78808. if (!downScale) {
  78809. return 0;
  78810. }
  78811. if (scale === downScale) {
  78812. return downZoom;
  78813. }
  78814. // Interpolate
  78815. nextZoom = downZoom + 1;
  78816. nextScale = this._scales[nextZoom];
  78817. if (nextScale === undefined) {
  78818. return downZoom;
  78819. }
  78820. scaleDiff = nextScale - downScale;
  78821. return (scale - downScale) / scaleDiff + downZoom;
  78822. },
  78823. distance: (external_L_default()).CRS.Earth.distance,
  78824. R: (external_L_default()).CRS.Earth.R,
  78825. /* Get the closest lowest element in an array */
  78826. _closestElement: function(array, element) {
  78827. var low;
  78828. for (var i = array.length; i--; ) {
  78829. if (array[i] <= element && (low === undefined || low < array[i])) {
  78830. low = array[i];
  78831. }
  78832. }
  78833. return low;
  78834. },
  78835. _proj4ScalesToResolutions(_scales) {
  78836. var resolutions = [];
  78837. if (!_scales) {
  78838. return resolutions;
  78839. }
  78840. for (var i = 0; i < _scales.length; i++) {
  78841. resolutions[i] = 1.0 / _scales[i];
  78842. }
  78843. return resolutions;
  78844. },
  78845. _toProj4Scales: function(scales, dpi) {
  78846. var proj4Scales = [];
  78847. if (!scales) {
  78848. return proj4Scales;
  78849. }
  78850. for (var i = 0; i < scales.length; i++) {
  78851. var a = this.projection ? this._getMeterPerMapUnit(this.projection.getUnits()) : 1;
  78852. proj4Scales[i] = 1 / (0.0254 / ((dpi || 96) * scales[i]) / a);
  78853. }
  78854. return proj4Scales;
  78855. },
  78856. _getMeterPerMapUnit: function(mapUnit) {
  78857. var earchRadiusInMeters = 6378137;
  78858. var meterPerMapUnit = 1;
  78859. if (mapUnit === 'meter') {
  78860. meterPerMapUnit = 1;
  78861. } else if (mapUnit === 'degrees' || mapUnit === 'degree') {
  78862. // 每度表示多少米。
  78863. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  78864. } else if (mapUnit === 'kilometer') {
  78865. meterPerMapUnit = 1.0e-3;
  78866. } else if (mapUnit === 'inch') {
  78867. meterPerMapUnit = 1 / 2.5399999918e-2;
  78868. } else if (mapUnit === 'feet') {
  78869. meterPerMapUnit = 0.3048;
  78870. }
  78871. return meterPerMapUnit;
  78872. },
  78873. _getDefaultProj4ScalesByBounds: function(bounds) {
  78874. if (!bounds) {
  78875. return [];
  78876. }
  78877. var boundsSize = bounds.getSize();
  78878. var extendsSize = Math.max(boundsSize.x, boundsSize.y);
  78879. var resolution = extendsSize / 256;
  78880. var scales = [];
  78881. var maxZoom = 23;
  78882. for (var i = 0; i < maxZoom; i++) {
  78883. scales[i] = Math.pow(2, i) / resolution;
  78884. }
  78885. return scales;
  78886. }
  78887. });
  78888. var crs = function(srsCode, options) {
  78889. return new CRS(srsCode, options);
  78890. };
  78891. ;// CONCATENATED MODULE: ./src/leaflet/core/Attributions.js
  78892. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78893. * This program are made available under the terms of the Apache License, Version 2.0
  78894. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78895. /**
  78896. * @enum attribution
  78897. * @description 版权相关配置。
  78898. * @type {string}
  78899. * @private
  78900. */
  78901. let Attributions = {
  78902. Prefix: `Leaflet with <span>© <a href='https://iclient.supermap.io' title='SuperMap iClient' target='_blank'>SuperMap iClient</a></span>`,
  78903. Common: {
  78904. attribution: `Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`
  78905. },
  78906. Online: {
  78907. attribution: `Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>`
  78908. },
  78909. ECharts: {
  78910. attribution: `© 2018 百度 ECharts`
  78911. },
  78912. MapV: {
  78913. attribution: `© 2018 百度 MapV `
  78914. },
  78915. Turf: {
  78916. attribution: `<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>`
  78917. },
  78918. Baidu: {
  78919. attribution: `Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方`
  78920. },
  78921. Cloud: {
  78922. attribution: `Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo`
  78923. },
  78924. Tianditu: {
  78925. attribution: `Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>`
  78926. }
  78927. };
  78928. /* harmony default export */ const core_Attributions = (Attributions);
  78929. ;// CONCATENATED MODULE: ./src/leaflet/core/Base.js
  78930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78931. * This program are made available under the terms of the Apache License, Version 2.0
  78932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78933. external_L_default().Control.Attribution.include({
  78934. options: {
  78935. position: 'bottomright',
  78936. prefix: core_Attributions.Prefix
  78937. }
  78938. });
  78939. external_L_default().Map.include({
  78940. /*
  78941. * 获取精确的像素坐标.
  78942. * 当需要绘制比较平滑的曲线的时候可调用此方法代替latLngToContainerPoint
  78943. * @param latlng
  78944. */
  78945. latLngToAccurateContainerPoint: function (latlng) {
  78946. var projectedPoint = this.project(external_L_default().latLng(latlng));
  78947. var layerPoint = projectedPoint._subtract(this.getPixelOrigin());
  78948. return external_L_default().point(layerPoint).add(this._getMapPanePos());
  78949. }
  78950. });
  78951. wrapToGeoJSON([(external_L_default()).Polyline, (external_L_default()).Polygon, (external_L_default()).Marker, (external_L_default()).CircleMarker, (external_L_default()).Circle, (external_L_default()).LayerGroup]);
  78952. function wrapToGeoJSON(objClassArray) {
  78953. objClassArray.map((objClass) => {
  78954. objClass.defaultFunction = objClass.prototype.toGeoJSON;
  78955. objClass.include({
  78956. toGeoJSON: function (precision) {
  78957. return objClass.defaultFunction.call(this, precision || 10);
  78958. }
  78959. })
  78960. return objClass;
  78961. })
  78962. }
  78963. ;// CONCATENATED MODULE: ./src/leaflet/services/ServiceBase.js
  78964. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78965. * This program are made available under the terms of the Apache License, Version 2.0
  78966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78967. /**
  78968. * @class ServiceBase
  78969. * @classdesc L.supermap 服务基类。
  78970. * @category iServer Core
  78971. * @param {string} url - 服务地址。
  78972. * @param {Object} options - 参数。
  78973. * @param {string} [options.proxy] - 服务代理地址。
  78974. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78975. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78976. * @param {Object} [options.headers] - 请求头。
  78977. * @fires ServiceBase#initialized
  78978. * @fires ServiceBase#destroy
  78979. * @extends {L.Evented}
  78980. * @usage
  78981. */
  78982. var ServiceBase = external_L_default().Evented.extend({
  78983. options: {
  78984. url: null,
  78985. proxy: null,
  78986. withCredentials: false,
  78987. crossOrigin: null
  78988. },
  78989. initialize: function (url, options) {
  78990. if (url) {
  78991. url = (url.indexOf("/") !== url.length - 1) ?
  78992. url : url.substr(0, url.length - 1);
  78993. }
  78994. this.url = url;
  78995. external_L_default().setOptions(this, options);
  78996. /**
  78997. * @event ServiceBase#initialized
  78998. * @description 构造函数构造成功后触发。
  78999. * @property {ServiceBase} this - this 对象。
  79000. */
  79001. this.fire("initialized", this);
  79002. },
  79003. /**
  79004. * @function ServiceBase.prototype.destroy
  79005. * @description 释放资源,将引用的资源属性置空。
  79006. */
  79007. destroy: function () {
  79008. /**
  79009. * @event ServiceBase#destroy
  79010. * @description 资源释放成功后触发。
  79011. * @property {ServiceBase} this - this 对象。
  79012. */
  79013. this.fire("destroy", this);
  79014. }
  79015. });
  79016. ;// CONCATENATED MODULE: ./src/leaflet/services/MapService.js
  79017. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79018. * This program are made available under the terms of the Apache License, Version 2.0
  79019. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79020. /**
  79021. * @class MapService
  79022. * @deprecatedclassinstance L.supermap.mapService
  79023. * @classdesc 地图信息服务类。
  79024. * @category iServer Map
  79025. * @modulecategory Services
  79026. * @extends {ServiceBase}
  79027. * @param {string} url - 服务地址。
  79028. * @param {Object} options - 参数。
  79029. * @param {string} [options.proxy] - 服务代理地址。
  79030. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79031. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79032. * @param {Object} [options.headers] - 请求头。
  79033. * @example
  79034. * new MapService(url)
  79035. * .getMapInfo(function(result){
  79036. * //doSomething
  79037. * })
  79038. * @usage
  79039. */
  79040. var MapService_MapService = ServiceBase.extend({
  79041. options: {
  79042. projection: null
  79043. },
  79044. initialize: function (url, options) {
  79045. options = options || {};
  79046. external_L_default().setOptions(this, options);
  79047. if (options.projection) {
  79048. this.options.projection = options.projection;
  79049. }
  79050. ServiceBase.prototype.initialize.call(this, url, options);
  79051. },
  79052. /**
  79053. * @function MapService.prototype.getMapInfo
  79054. * @description 获取地图信息。
  79055. * @param {RequestCallback} callback - 回调函数。
  79056. */
  79057. getMapInfo: function (callback) {
  79058. var me = this;
  79059. var getMapStatusService = new MapService(me.url, {
  79060. proxy: me.options.proxy,
  79061. withCredentials: me.options.withCredentials,
  79062. crossOrigin: me.options.crossOrigin,
  79063. headers: me.options.headers,
  79064. projection: me.options.projection
  79065. });
  79066. getMapStatusService.processAsync(callback);
  79067. },
  79068. /**
  79069. * @function MapService.prototype.getWkt
  79070. * @description 获取WKT。
  79071. * @param {RequestCallback} callback - 回调函数。
  79072. */
  79073. getWkt(callback) {
  79074. var me = this;
  79075. var getMapStatusService = new MapService(`${me.url}/prjCoordSys.wkt`, {
  79076. proxy: me.options.proxy,
  79077. withCredentials: me.options.withCredentials,
  79078. withoutFormatSuffix: true,
  79079. crossOrigin: me.options.crossOrigin,
  79080. headers: me.options.headers,
  79081. projection: me.options.projection
  79082. });
  79083. getMapStatusService.processAsync(callback);
  79084. },
  79085. /**
  79086. * @function MapService.prototype.getTilesets
  79087. * @description 获取切片列表信息。
  79088. * @param {RequestCallback} callback - 回调函数。
  79089. */
  79090. getTilesets: function (callback) {
  79091. var me = this;
  79092. var tilesetsService = new TilesetsService(me.url, {
  79093. proxy: me.options.proxy,
  79094. withCredentials: me.options.withCredentials,
  79095. crossOrigin: me.options.crossOrigin,
  79096. headers: me.options.headers,
  79097. eventListeners: {
  79098. scope: me,
  79099. processCompleted: callback,
  79100. processFailed: callback
  79101. }
  79102. });
  79103. tilesetsService.processAsync();
  79104. }
  79105. });
  79106. var mapService = function (url, options) {
  79107. return new MapService_MapService(url, options);
  79108. };
  79109. ;// CONCATENATED MODULE: ./src/leaflet/control/ChangeTileVersion.js
  79110. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79111. * This program are made available under the terms of the Apache License, Version 2.0
  79112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79113. /**
  79114. * @class ChangeTileVersion
  79115. * @aliasclass control.ChangeTileVersion
  79116. * @deprecatedclassinstance L.supermap.control.changeTileVersion
  79117. * @classdesc 版本切换控件,支持 IE10 及以上。
  79118. * @category Control
  79119. * @extends {L.Control}
  79120. * @modulecategory Control
  79121. * @example
  79122. * new ChangeTileVersion({
  79123. * layer: baseLayer,
  79124. * position: "topleft",
  79125. * orientation: "horizontal"
  79126. * }).addTo(map);
  79127. * @param {Object} options - 参数。
  79128. * @param {L.Layer} options.layer - Leaflet Layer 对象。
  79129. * @param {string} [options.position='topleft'] - 控件位置继承自 Leaflet control。
  79130. * @param {string} [options.title='switch tile version'] - 鼠标滑过时提示。
  79131. * @param {string} [options.tooltip='top'] - tooltip 提示显示位置 top | right | bottom | left。
  79132. * @param {boolean} [options.collapsed=true] - 是否折叠。
  79133. * @param {string} [options.nextText='+'] - 下一个版本的按钮布局。
  79134. * @param {string} [options.lastText='-'] - 上一个版本的按钮布局。
  79135. * @param {string} [options.ico='v'] - 控件显示的 logo。
  79136. * @param {string} [options.orientation='horizontal'] - 方向 horizontal|vertical。
  79137. * @param {boolean} [options.switch=true] - 是否显示上/下一个版本切换控件。
  79138. * @usage
  79139. */
  79140. var ChangeTileVersion = external_L_default().Control.extend({
  79141. options: {
  79142. //绑定的底图图层
  79143. layer: null,
  79144. //控件位置 继承自leaflet control
  79145. position: 'topleft',
  79146. //鼠标滑过时提示
  79147. title: 'switch tile version',
  79148. //tooltip提示显示位置 top | right | bottom | left
  79149. tooltip: "top",
  79150. //是否折叠
  79151. collapsed: true,
  79152. //下一个版本的按钮布局
  79153. nextText: "+",
  79154. //上一个版本的按钮布局
  79155. lastText: "-",
  79156. //控件显示的logo
  79157. ico: 'V',
  79158. //方向horizontal|vertical
  79159. orientation: 'horizontal',
  79160. //是否显示上/下一个版本切换控件
  79161. switch: true
  79162. },
  79163. /**
  79164. * @private
  79165. * @function ChangeTileVersion.prototype.onAdd
  79166. * @description 添加控件。
  79167. */
  79168. onAdd: function () {
  79169. if (this.options.orientation !== 'vertical') {
  79170. this.options.orientation = 'horizontal';
  79171. }
  79172. var layout = this._initLayout();
  79173. if (this.options.layer) {
  79174. this.setLayer(this.options.layer);
  79175. }
  79176. return layout;
  79177. },
  79178. /**
  79179. * @function ChangeTileVersion.prototype.setContent
  79180. * @description 设置版本信息。
  79181. * @param {Object} version - 版本信息。
  79182. */
  79183. setContent: function (version) {
  79184. var content = external_L_default().Util.extend({}, version);
  79185. this.setVersionName(content.desc).setToolTip(content.desc);
  79186. },
  79187. /**
  79188. * @function ChangeTileVersion.prototype.setVersionName
  79189. * @description 设置版本号。
  79190. * @param {string} content - 版本信息。
  79191. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  79192. */
  79193. setVersionName: function (content) {
  79194. var value = content;
  79195. if (!content) {
  79196. value = this.getValue();
  79197. }
  79198. this._sliderValue.innerHTML = value;
  79199. return this;
  79200. },
  79201. /**
  79202. * @function ChangeTileVersion.prototype.setToolTip
  79203. * @description 设置提示信息。
  79204. * @param {(HTMLElement|string)} tooltip - 提示信息。
  79205. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  79206. */
  79207. setToolTip: function (tooltip) {
  79208. this.tooltip.innerHTML = tooltip;
  79209. return this;
  79210. },
  79211. /**
  79212. * @function ChangeTileVersion.prototype.updateLength
  79213. * @description 更新进度条长度。
  79214. * @param {number} length - 进度长度参数。
  79215. */
  79216. updateLength: function (length) {
  79217. if (length > 0) {
  79218. this.length = length;
  79219. this.max = this.length - 1;
  79220. this.slider.setAttribute("max", this.max);
  79221. }
  79222. },
  79223. /**
  79224. * @function ChangeTileVersion.prototype.setLayer
  79225. * @description 设置需要绑定的图层。
  79226. * @param {TiledMapLayer} layer - 绑定的图层。
  79227. */
  79228. setLayer: function (layer) {
  79229. if (layer) {
  79230. this.options.layer = layer;
  79231. }
  79232. var me = this;
  79233. var tileLayer = me.options.layer;
  79234. tileLayer.on("tilesetsinfoloaded", function (result) {
  79235. var tileVersions = result && result.tileVersions;
  79236. me.update(tileVersions);
  79237. });
  79238. tileLayer.on("tileversionschanged", function (result) {
  79239. var tileVersions = result && result.tileVersion;
  79240. me.setContent(tileVersions);
  79241. });
  79242. me.getTileSetsInfo();
  79243. },
  79244. /**
  79245. * @function ChangeTileVersion.prototype.update
  79246. * @description 更新缓存切片集和进度条长度。
  79247. * @param {number} tileVersions - 待更新的切片版本号。
  79248. */
  79249. update: function (tileVersions) {
  79250. this.tileVersions = tileVersions || [];
  79251. this.updateLength(this.tileVersions.length);
  79252. },
  79253. /**
  79254. * @function ChangeTileVersion.prototype.getTileSetsInfo
  79255. * @description 获取切片集信息。
  79256. */
  79257. getTileSetsInfo: function () {
  79258. var me = this;
  79259. if (me.options.layer) {
  79260. new MapService_MapService(me.options.layer._url).getTilesets(function getTilesInfoSucceed(info) {
  79261. me.options.layer.setTileSetsInfo(info.result);
  79262. });
  79263. }
  79264. },
  79265. /**
  79266. * @function ChangeTileVersion.prototype.removeLayer
  79267. * @description 移除绑定的地图图层。
  79268. */
  79269. removeLayer: function () {
  79270. this.options.layer = null;
  79271. },
  79272. /**
  79273. * @function ChangeTileVersion.prototype.nextTilesVersion
  79274. * @description 下一个版本,首次调用该函数默认为无版本。
  79275. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  79276. */
  79277. nextTilesVersion: function () {
  79278. if (this.firstLoad) {
  79279. this.options.layer.nextTilesVersion();
  79280. this.firstLoad = !!0;
  79281. return this;
  79282. }
  79283. if (parseInt(this.slider.value) > this.max-1) {
  79284. return this;
  79285. }
  79286. this.slider.value = parseInt(this.slider.value) + 1;
  79287. this.options.layer.nextTilesVersion();
  79288. return this;
  79289. },
  79290. /**
  79291. * @function ChangeTileVersion.prototype.lastTilesVersion
  79292. * @description 上一个版本。
  79293. */
  79294. lastTilesVersion: function () {
  79295. if (parseInt(this.slider.value) < this.min + 1) {
  79296. return this;
  79297. }
  79298. this.slider.value = parseInt(this.slider.value) - 1;
  79299. this.options.layer.lastTilesVersion();
  79300. return this;
  79301. },
  79302. /**
  79303. * @function ChangeTileVersion.prototype.tilesVersion
  79304. * @description 请求指定版本。
  79305. * @param {string} version - 版本号参数。
  79306. */
  79307. tilesVersion: function (version) {
  79308. var layer = this.options.layer,
  79309. tileVersions = this.tileVersions;
  79310. var len = tileVersions.length;
  79311. for (var i = 0; i < len; i++) {
  79312. if (tileVersions[i].name == version) {
  79313. layer.updateCurrentTileSetsIndex(i);
  79314. layer.changeTilesVersion();
  79315. break;
  79316. }
  79317. }
  79318. },
  79319. /**
  79320. * @function ChangeTileVersion.prototype.getValue
  79321. * @description 获取进度条的值。(注:进度条的值并不是版本号)。
  79322. */
  79323. getValue: function () {
  79324. return this.slider.value;
  79325. },
  79326. /**
  79327. * @function ChangeTileVersion.prototype.getVersion
  79328. * @description 获取当前进度条的值对应的版本号。
  79329. */
  79330. getVersion: function () {
  79331. var version = this.tileVersions[this.getValue()];
  79332. return version && version.name;
  79333. },
  79334. _initLayout: function () {
  79335. var className = 'leaflet-control-ctv';
  79336. this._container = external_L_default().DomUtil.create('div', className + ' ' + className + '-' + this.options.orientation);
  79337. //正常情况下显示btn
  79338. this._sliderBtn = external_L_default().DomUtil.create('a', className + '-toggle', this._container);
  79339. this._sliderBtn.setAttribute("title", this.options.title);
  79340. this._sliderBtn.innerHTML = this.options.ico;
  79341. //滑块拖动时值显示区域
  79342. this._sliderValue = external_L_default().DomUtil.create('p', className + '-value', this._container);
  79343. this._sliderValue.innerHTML = this.options.ico;
  79344. var sliderClassName = "leaflet-ctv-slider";
  79345. this._sliderContent = external_L_default().DomUtil.create('div', sliderClassName + "-main" + " tooltip", this._container);
  79346. //tooltip提示框
  79347. this.tooltip = external_L_default().DomUtil.create("span", "tooltip-text" + " " + "tooltip-" + this.options.tooltip, this._sliderContent);
  79348. this.tooltip.innerHTML = this.options.ico;
  79349. //加控件
  79350. if (this.options.switch) {
  79351. this._next = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-next', this._sliderContent);
  79352. this._next.innerHTML = this.options.nextText;
  79353. external_L_default().DomEvent.on(this._next, 'click', this.nextTilesVersion, this);
  79354. external_L_default().DomUtil.addClass(this._container, className + '-incdec');
  79355. }
  79356. //滑块
  79357. this._sliderContainer = external_L_default().DomUtil.create('div', sliderClassName + '-container', this._sliderContent);
  79358. this.slider = external_L_default().DomUtil.create('input', sliderClassName, this._sliderContainer);
  79359. this.min = this.min == null || isNaN(this.min) ? 0 : parseInt(this.min);
  79360. this.slider.setAttribute("title", this.options.title);
  79361. this.slider.setAttribute("id", "slider");
  79362. this.slider.setAttribute("type", "range");
  79363. this.slider.setAttribute("min", this.min);
  79364. this.slider.setAttribute("max", 0);
  79365. this.slider.setAttribute("step", 1);
  79366. this.slider.setAttribute("value", 0);
  79367. // //判断浏览器是否支持Range滑动条
  79368. // if (this.slider.type == "text") {
  79369. // console.error("抱歉,您的浏览器不支持HTML5 range滑动条,请使用高版本浏览器");
  79370. // }
  79371. this.firstLoad = true;
  79372. if ('oninput' in this.slider || 'onchange' in this.slider) {
  79373. external_L_default().DomEvent.on(this.slider, "change", this._tilesVersion, this);
  79374. } else {
  79375. this.slider.onpropertychange = this._tilesVersion;
  79376. }
  79377. //减控件
  79378. if (this.options.switch) {
  79379. this._last = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-last', this._sliderContent);
  79380. this._last.innerHTML = this.options.lastText;
  79381. external_L_default().DomEvent.on(this._last, 'click', this.lastTilesVersion, this);
  79382. }
  79383. //if (window.matchMedia("screen and (-webkit-min-device-pixel-ratio:0)").matches && this.options.orientation == 'vertical') {
  79384. if (this.options.orientation === 'vertical') {
  79385. this.slider.style.width = 170 + 'px';
  79386. this._sliderContainer.style.height = 170 + 'px';
  79387. } else {
  79388. this._sliderContainer.style.width = 150 + 'px';
  79389. }
  79390. external_L_default().DomEvent.disableClickPropagation(this._container);
  79391. if (this.options.collapsed) {
  79392. if (!(external_L_default()).Browser.android) {
  79393. external_L_default().DomEvent
  79394. .on(this._container, 'mouseenter', this._expand, this)
  79395. .on(this._container, 'mouseleave', this._collapse, this);
  79396. }
  79397. if ((external_L_default()).Browser.touch) {
  79398. external_L_default().DomEvent
  79399. .on(this._sliderBtn, 'click', (external_L_default()).DomEvent.stop)
  79400. .on(this._sliderBtn, 'click', this._expand, this);
  79401. } else {
  79402. external_L_default().DomEvent.on(this._sliderBtn, 'focus', this._expand, this);
  79403. }
  79404. } else {
  79405. this._expand();
  79406. }
  79407. return this._container;
  79408. },
  79409. _expand: function () {
  79410. external_L_default().DomUtil.addClass(this._container, 'leaflet-control-ctv-expanded');
  79411. },
  79412. _collapse: function () {
  79413. external_L_default().DomUtil.removeClass(this._container, 'leaflet-control-ctv-expanded');
  79414. },
  79415. _tilesVersion: function () {
  79416. var version = this.getVersion();
  79417. this.tilesVersion(version);
  79418. }
  79419. });
  79420. external_L_default().Map.mergeOptions({
  79421. changeTileVersionControl: false
  79422. });
  79423. external_L_default().Map.addInitHook(function () {
  79424. if (this.options.changeTileVersionControl) {
  79425. this.changeTileVersionControl = new ChangeTileVersion();
  79426. this.addControl(this.changeTileVersionControl);
  79427. }
  79428. });
  79429. var changeTileVersion = function (options) {
  79430. return new ChangeTileVersion(options);
  79431. };
  79432. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  79433. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79434. * This program are made available under the terms of the Apache License, Version 2.0
  79435. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79436. var LogoBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF4AAAAdCAYAAAAjHtusAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozYWZlOGIwMi01MWE3LTRiZjYtYWVkYS05MGQ2ZTQ4YjZiMmUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODg0NkFBQUE3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODg0NkFBQTk3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4MWI3NzdhNC1lZmEyLTQ1MzUtOGQzNi03MmRjNDkyODMzN2UiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpjYTYzODVjMi1jNDQ1LTExN2EtYTc0ZC1lM2I5MzJlMGE4Y2QiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5q1HM0AAAF/ElEQVR42tSabYhUVRjHZ7W01C1uaCRW4F3oi9SXCUnwQ9gsGUFvOEtQH1bLu5VS9sbYh5KicjYt29qiGQwVg2xWWKgocob91AvC+CWsoJqB3qHMSdTMpZyeU/+Df07n3pk7997Z6cBv99z7nHvOvf/z/pxJNZvNVI/jCKXmv6EquAmVkxPSlvtp2GItr0/96fFQForChJAWDiVYTkMYMu4XBFcYjLOwWS3sNwmn8NGzZ0h4Flv/zwIdchAnh/slCGmmKUNIBzYPaXOUr0vPuEjD71JAPh7l61embzinhV3V8nnCGmGT8LwlzSL8/yUh4Tfjo9T/CgnCIYNKycA2Qq21AcHU/VHE80Idoo3Qs0W6p0UtUnkZvEMDeVcCyqxEafF7hL8Qf0oYsIj+lfC9cH1CwhchWAGCtZO+AooQOkdC1Km1VtCb63StW73uFSzgKFUkNwBbmZGGmqowhvg8ZNpH9oXChcIcYRdeNomgxLkaH+S1SGubAxyIpFv+Zp+0DYjrAS00j/dem2VGEl6FJ4Qa4quEu8j2hTCJ+GJhe4JjfQMf6JCYPPbysMPxBlp0BUKOogEF9Rg9/heNvNKYfM0KsZUZaYxX4STGrzJa+zbhPeFH2DcK10KItcI+pI0rVElwXl1ULaKnIJhDw0oRQpTQc1zcbwRU8ATy4DR6yMlTzwkqMziEWHvubJ4Nk4ZtHdnqwvwY17xq3Z4FjrG+z2Kdrdf2ZSGD+xlLPh6t1R0jP9fI22ZzKI92yvQl7EbmBxI4S7Y+vIAOL87QZqsc5uNnssxZIcfYjXT9snCR7jjobidp+FkxA2v+Cq1QervMDmp4P7Xs3YZtE9kOC3P/By6JGaETl8ElwueYTNTDq4UDsKnd7YfCNbT239LF1udS72xYJt1UWxNfN4IIP4bWuTpEja01JtMFZFsm/AHbtHBlDE6yasA4moYTrUbvdBTXHqUrAH4uSadbyzF+vbBM2IsNkS3MNa5305JxqfA02T4TnkX8XOH1mPw8ruVejpxbI9hZD2Cz1U7LdrrUvjP/WfZinNZhr6V27hP+FPZh9aLvLxVO4DllX0G2OcKnlO/DCblxaz6uXBtmi+8mBaP3/SP8IuEIiTRoPPQm2TaEmEyXo0JU+F0YiPFD0hhOsiE/vqeEVwyTgF8L51OilcIZ2I4Ll5NttvAJPfukUeB2sk0ZPSbKIUUJpCII7+DasWy08uhNNazT0wGHI7mAtB7KqMKm38HhDdAUibTVKGicbB8YAqrJ9DRsp43JdB4qUof1HQrPE6XTQWu3Ce/inVzjXhXpMiTwUYugNVQ+p80jrUsV5EH0POKeuXO9QjhFq5GryNYvfEMCDhsftYVsB9ETtG0V9ZjfhCURhbcJFpfwVZ9jvhxsLHwTYtp2svlWQw3vXL8UnqHVSIG8l8ex+tHhBXgjddgqHEZ8ufAA2aaEnYgrF/KrPXrEmMUqZ9THLW06xhoBaVueQpkug+ewOUphE3Qv2Q5gGamXYa+QbVq4O+DQ5FHyZqrjxNt7UHh9uuRa0F7HjCF8o9PCTOGnscM7g2u1Hl9C9oeEnxC/1ajZg8JLiM9Hj9GHJseMShwL2DO0G5yEWn3Zh1QUods5CPkIoqlwAZxhXMsb6HrcEPBxchhdJ6wj29vCW4hfLOzo8J3rltYX50nXQAATSf/K4DEaGlTLvplsk/QCpoD60EQ7gLYZc8H9wq+I3yncEOEcNhuz6HWf3XEiwU/4Y8YEqVp2P10rt+8REvBGw026i4aDcbL9jF8r8Blmf4fCOzhViiscskygXRdehf3CO4hfigmTBXyQrl8TFtD1IzQX3CbcQrY3hPcRv4z8OmHPXwchVNln2MmE7BX6VwIFi/he6uxvb6JM3m0fdqvx/ATidxg2JeC7VDErAw5NzGfvwRJVheEIQ8Mg/pdwIM+UOmi9Q8ivCsrIy0tF+wVbEcLrd3Pb2XisEb4Tdlhsi4WP4RBbaLGrHfC3PrvMIezy9rTpGm5lz9LOMG15xvFxD/j5gjzjjDbMOzk+9zzt3v5bgAEAibzFeFHVgYkAAAAASUVORK5CYII=";
  79437. ;// CONCATENATED MODULE: ./src/leaflet/control/Logo.js
  79438. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79439. * This program are made available under the terms of the Apache License, Version 2.0
  79440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79441. /**
  79442. * @class Logo
  79443. * @aliasclass control.Logo
  79444. * @deprecatedclassinstance L.supermap.control.logo
  79445. * @classdesc Logo 控件。
  79446. * @category Control
  79447. * @modulecategory Control
  79448. * @extends {L.Control}
  79449. * @example
  79450. * new Logo({
  79451. * imageUrl: xxx,//非必填项
  79452. * }).addTo(map);
  79453. * @param {Object} options - 参数。
  79454. * @param {string} [options.position='bottomright'] - 控件位置继承自 leaflet control。
  79455. * @param {string} [options.imageUrl] - logo 图片地址。
  79456. * @param {string} [options.width] - logo 图片宽度。
  79457. * @param {string} [options.height] - logo 图片高度。
  79458. * @param {string} [options.link] - 跳转链接。
  79459. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示的提示文本。
  79460. * @usage
  79461. */
  79462. var Logo = external_L_default().Control.extend({
  79463. options: {
  79464. position: 'bottomright',
  79465. //logo图片地址
  79466. imageUrl: null,
  79467. //跳转链接
  79468. link: null,
  79469. //logo图片宽
  79470. width: null,
  79471. //logo图片高
  79472. height: null,
  79473. //logo图片失效时显示文本
  79474. alt: "SuperMap iClient"
  79475. },
  79476. /**
  79477. * @private
  79478. * @function Logo.prototype.onAdd
  79479. * @override
  79480. * @description 添加 logo。
  79481. * @returns {HTMLElement} 返回创建 logo 的 div。
  79482. */
  79483. onAdd: function () {
  79484. var div = external_L_default().DomUtil.create('div', 'iclient-leaflet-logo');
  79485. div.style.marginTop = 0;
  79486. div.style.marginBottom = 0;
  79487. div.style.marginLeft = 0;
  79488. div.style.marginRight = 0;
  79489. //iClient.png base64
  79490. var imgSrc = LogoBase64;
  79491. if (this.options.imageUrl) {
  79492. imgSrc = this.options.imageUrl;
  79493. }
  79494. var alt = this.options.alt;
  79495. var imageWidth = "94px";
  79496. var imageHeight = "29px";
  79497. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  79498. if (this.options.imageUrl) {
  79499. imageWidth = this.options.width;
  79500. imageHeight = this.options.height;
  79501. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  79502. if (!imageWidth || !imageHeight) {
  79503. styleSize = "";
  79504. }
  79505. }
  79506. var link = this.options.link;
  79507. div.innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
  79508. "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "margin-right:5px;margin-bottom:2px;white-space: nowrap'></a>";
  79509. return div;
  79510. }
  79511. });
  79512. //map默认开启logoControl
  79513. external_L_default().Map.mergeOptions({
  79514. logoControl: true
  79515. });
  79516. //map默认开启logoControl
  79517. external_L_default().Map.addInitHook(function () {
  79518. if (!this._logoAdded && this.options.logoControl) {
  79519. if (this.options.logoControl === true) {
  79520. this.logoControl = new Logo();
  79521. } else if (this.options.logoControl instanceof (external_L_default()).Control) {
  79522. this.logoControl = this.options.logoControl;
  79523. }
  79524. if (this.logoControl) {
  79525. this.addControl(this.logoControl);
  79526. this._logoAdded = true;
  79527. }
  79528. }
  79529. });
  79530. var logo = function (options) {
  79531. return new Logo(options);
  79532. };
  79533. ;// CONCATENATED MODULE: ./src/leaflet/control/index.js
  79534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79535. * This program are made available under the terms of the Apache License, Version 2.0
  79536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79537. ;// CONCATENATED MODULE: ./src/leaflet/core/CommontypesConversion.js
  79538. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79539. * This program are made available under the terms of the Apache License, Version 2.0
  79540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79541. const isArray = function(obj) {
  79542. return Object.prototype.toString.call(obj) == '[object Array]';
  79543. }
  79544. /**
  79545. * @class CommontypesConversion
  79546. * @category BaseTypes Util
  79547. * @classdesc Leaflet 对象和 SuperMap 对象转换工具。
  79548. * @usage
  79549. */
  79550. const CommontypesConversion = {
  79551. /**
  79552. * @function CommontypesConversion.toSuperMapBounds
  79553. * @description 将 Leaflet 对象的 bounds 转成 SuperMap 的 bounds对象。
  79554. * @param {(L.Bounds|L.LatLngBounds)} bounds - 图层显示范围。
  79555. * @returns {Bounds} SuperMap 的 bounds 对象。
  79556. */
  79557. toSuperMapBounds(bounds) {
  79558. if (bounds && ["FeatureCollection", "Feature"].indexOf(bounds.type) !== -1) {
  79559. bounds = external_L_default().geoJSON(bounds).getBounds();
  79560. }
  79561. if (bounds instanceof (external_L_default()).LatLngBounds) {
  79562. return new Bounds(
  79563. bounds.getSouthWest().lng,
  79564. bounds.getSouthWest().lat,
  79565. bounds.getNorthEast().lng,
  79566. bounds.getNorthEast().lat
  79567. );
  79568. }
  79569. if (bounds instanceof (external_L_default()).Bounds) {
  79570. return new Bounds(
  79571. bounds.min.x,
  79572. bounds.min.y,
  79573. bounds.max.x,
  79574. bounds.max.y
  79575. );
  79576. }
  79577. if (isArray(bounds)) {
  79578. return new Bounds(
  79579. bounds[0],
  79580. bounds[1],
  79581. bounds[2],
  79582. bounds[3]
  79583. );
  79584. }
  79585. return new Bounds();
  79586. },
  79587. /**
  79588. * @function CommontypesConversion.isArray
  79589. * @description 判断是否为数组格式。
  79590. * @param {Object} obj - 待判断的对象。
  79591. * @returns {boolean} 是否是数组。
  79592. */
  79593. isArray,
  79594. /**
  79595. * @function CommontypesConversion.toProcessingParam
  79596. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  79597. * @param {Array} points - Region 各个节点数组。
  79598. * @returns processing 服务裁剪、查询分析的分析参数。
  79599. */
  79600. toProcessingParam(points) {
  79601. var geometryParam = {};
  79602. if (points.length < 1) {
  79603. geometryParam = "";
  79604. } else {
  79605. var results = [];
  79606. for (var i = 0; i < points.length; i++) {
  79607. var point = {};
  79608. point.x = points[i][0];
  79609. point.y = points[i][1];
  79610. results.push(point);
  79611. }
  79612. geometryParam.type = "REGION";
  79613. geometryParam.points = results;
  79614. }
  79615. return geometryParam;
  79616. }
  79617. }
  79618. ;// CONCATENATED MODULE: ./src/leaflet/core/ExtendsCRS.js
  79619. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79620. * This program are made available under the terms of the Apache License, Version 2.0
  79621. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79622. /**
  79623. * @name BaiduCRS
  79624. * @description 百度坐标对象。
  79625. * @namespace
  79626. * @category BaseTypes Projection
  79627. * @usage
  79628. * ```
  79629. * // 浏览器
  79630. * <script type="text/javascript" src="{cdn}"></script>
  79631. * <script>
  79632. * const baiduCRS = {namespace}.CRS.BaiduCRS;
  79633. *
  79634. * // 弃用的写法
  79635. * const baiduCRS = L.CRS.BaiduCRS;
  79636. *
  79637. * </script>
  79638. * //ES6 Import
  79639. * import { BaiduCRS } from "{npm}";
  79640. *
  79641. * const baiduCRS = BaiduCRS;
  79642. * ```
  79643. */
  79644. var BaiduCRS = external_L_default().extend({}, (external_L_default()).CRS.EPSG3857, {
  79645. code: 'Baidu',
  79646. scale: function (zoom) {
  79647. return (6378137 * Math.PI * 2) / Math.pow(2, 18 - zoom)
  79648. },
  79649. transformation: (function () {
  79650. var scale = 0.5 / (Math.PI * 6378137);
  79651. return new (external_L_default()).Transformation(scale, 0, -scale, 0);
  79652. }())
  79653. });
  79654. var tdt_WGS84_resolutions = [];
  79655. for (let i = 1; i < 19; i++) {
  79656. tdt_WGS84_resolutions.push(0.703125 * 2 / (Math.pow(2, i)));
  79657. }
  79658. /**
  79659. * @name TianDiTu_WGS84CRS
  79660. * @deprecatedclass L.CRS.TianDiTu_WGS84CRS
  79661. * @description 天地图 WGS84 坐标对象。
  79662. * @namespace
  79663. * @category BaseTypes Projection
  79664. * @usage
  79665. * ```
  79666. * // 浏览器
  79667. * <script type="text/javascript" src="{cdn}"></script>
  79668. * <script>
  79669. * const tianDiTu_WGS84CRS = {namespace}.CRS.TianDiTu_WGS84CRS;
  79670. *
  79671. * // 弃用的写法
  79672. * const tianDiTu_WGS84CRS = L.CRS.TianDiTu_WGS84CRS;
  79673. *
  79674. * </script>
  79675. * //ES6 Import
  79676. * import { TianDiTu_WGS84CRS } from "{npm}";
  79677. *
  79678. * const tianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
  79679. *
  79680. * ```
  79681. */
  79682. var TianDiTu_WGS84CRS = crs("EPSG:4326",{
  79683. origin: [-180, 90],
  79684. resolutions: tdt_WGS84_resolutions,
  79685. bounds: external_L_default().bounds([-180, -90], [180, 90]),
  79686. wrapLng: [-180, 180]
  79687. });
  79688. const c = Math.PI * 2 * 6378137;
  79689. const halfC = c / 2;
  79690. var tdt_Mercator_resolutions = [];
  79691. for (let i = 1; i < 19; i++) {
  79692. tdt_Mercator_resolutions.push(c / 256 / Math.pow(2, i));
  79693. }
  79694. /**
  79695. * @name TianDiTu_MercatorCRS
  79696. * @deprecatedclass L.CRS.TianDiTu_MercatorCRS
  79697. * @description 天地图墨卡托坐标对象。
  79698. * @category BaseTypes Projection
  79699. * @namespace
  79700. * @usage
  79701. * ```
  79702. * // 浏览器
  79703. * <script type="text/javascript" src="{cdn}"></script>
  79704. * <script>
  79705. * const tianDiTu_MercatorCRS = {namespace}.CRS.TianDiTu_MercatorCRS;
  79706. *
  79707. * // 弃用的写法
  79708. * const tianDiTu_MercatorCRS = L.CRS.TianDiTu_MercatorCRS;
  79709. *
  79710. * </script>
  79711. * //ES6 Import
  79712. * import { TianDiTu_MercatorCRS } from "{npm}";
  79713. *
  79714. * const tianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
  79715. *
  79716. * ```
  79717. */
  79718. var TianDiTu_MercatorCRS = crs('EPSG:3857', {
  79719. origin: [-halfC, halfC],
  79720. resolutions: tdt_Mercator_resolutions,
  79721. bounds: external_L_default().bounds([-halfC, -halfC], [halfC, halfC]),
  79722. wrapLng: [-180, 180]
  79723. });
  79724. ;// CONCATENATED MODULE: ./src/leaflet/core/NonEarthCRS.js
  79725. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79726. * This program are made available under the terms of the Apache License, Version 2.0
  79727. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79728. /**
  79729. * @private
  79730. * @class NonProjection
  79731. * @classdesc 平面无投影对象。
  79732. * @category BaseTypes Projection
  79733. * @extends {L.Class}
  79734. * @param {L.Bounds} bounds - 坐标范围
  79735. */
  79736. var NonProjection = external_L_default().Class.extend({
  79737. initialize: function (bounds) {
  79738. this.bounds = bounds;
  79739. },
  79740. project: function (latlng) {
  79741. return new (external_L_default()).Point(latlng.lng, latlng.lat);
  79742. },
  79743. unproject: function (point) {
  79744. return new (external_L_default()).LatLng(point.y, point.x);
  79745. }
  79746. });
  79747. var nonProjection = function (bounds) {
  79748. return new NonProjection(bounds);
  79749. };
  79750. /**
  79751. * @class NonEarthCRS
  79752. * @aliasclass CRS.NonEarthCRS
  79753. * @deprecatedclass L.CRS.NonEarthCRS
  79754. * @deprecatedclassinstance L.supermap.CRS.nonEarthCRS
  79755. * @classdesc 平面无投影坐标类。
  79756. * @category BaseTypes Projection
  79757. * @extends {L.Class}
  79758. * @param {Object} options - 参数。
  79759. * @param {Object} options.origin - 原点。
  79760. * @param {L.Bounds} options.bounds - 范围。
  79761. * @param {Array.<number>} [options.resolutions] - 分辨率。
  79762. * @usage
  79763. */
  79764. var NonEarthCRS = external_L_default().Class.extend({
  79765. /**
  79766. * @member {Object} [NonEarthCRS.prototype.includes=L.CRS]
  79767. * @description 坐标对象。
  79768. */
  79769. includes: (external_L_default()).CRS,
  79770. initialize: function (options) {
  79771. if (options.origin) {
  79772. this.transformation = new (external_L_default()).Transformation(1, -options.origin.x, -1, options.origin.y);
  79773. }
  79774. this.projection = nonProjection(options.bounds);
  79775. this.bounds = options.bounds;
  79776. this.origin = options.origin;
  79777. this.resolutions = options.resolutions;
  79778. },
  79779. /**
  79780. * @function NonEarthCRS.prototype.scale
  79781. * @description 通过缩放级别计算比例尺。
  79782. * @param {number} zoom - 缩放级别。
  79783. * @returns {number} 返回比例尺值。
  79784. */
  79785. scale: function (zoom) {
  79786. let defaultScale;
  79787. if (!this.resolutions || this.resolutions.length === 0) {
  79788. const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
  79789. defaultScale = 1.0 / (width / 256);
  79790. return defaultScale * Math.pow(2, zoom);
  79791. }
  79792. if (this.resolutions[zoom]) {
  79793. return 1.0 / this.resolutions[zoom];
  79794. }
  79795. return (1.0 / this.resolutions[0]) * Math.pow(2, zoom);
  79796. },
  79797. /**
  79798. * @function NonEarthCRS.prototype.zoom
  79799. * @description 通过比例尺计算范围。
  79800. * @param {number} scale - 比例尺。
  79801. * @returns {number} 返回空间范围值。
  79802. */
  79803. zoom: function (scale) {
  79804. let defaultScale;
  79805. if (!this.resolutions || this.resolutions.length === 0) {
  79806. const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
  79807. defaultScale = 1.0 / (width / 256);
  79808. return Math.log(scale / defaultScale) / Math.LN2;
  79809. }
  79810. const index = this.resolutions.indexOf(1.0 / scale);
  79811. if (index > -1) {
  79812. return index;
  79813. }
  79814. return Math.log(scale / (1.0 / this.resolutions[0])) / Math.LN2;
  79815. },
  79816. /**
  79817. * @function NonEarthCRS.prototype.distance
  79818. * @description 通过两个坐标点计算之间的距离。
  79819. * @param {L.LatLng} latlng1 - 坐标点1。
  79820. * @param {L.LatLng} latlng2 - 坐标点2。
  79821. * @returns {number} 返回距离长度。
  79822. */
  79823. distance: function (latlng1, latlng2) {
  79824. var dx = latlng2.lng - latlng1.lng,
  79825. dy = latlng2.lat - latlng1.lat;
  79826. return Math.sqrt(dx * dx + dy * dy);
  79827. },
  79828. infinite: false
  79829. });
  79830. var nonEarthCRS = function (options) {
  79831. return new NonEarthCRS(options);
  79832. };
  79833. ;// CONCATENATED MODULE: ./src/leaflet/core/Util.js
  79834. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79835. * This program are made available under the terms of the Apache License, Version 2.0
  79836. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79837. /**
  79838. * @function toGeoJSON
  79839. * @category BaseTypes Util
  79840. * @description 将传入对象转为 GeoJSON 格式。
  79841. * @param {Object} feature - 待转参数。
  79842. * @usage
  79843. * ```
  79844. * // 浏览器
  79845. * <script type="text/javascript" src="{cdn}"></script>
  79846. * <script>
  79847. * const result = {namespace}.Util.toGeoJSON(feature);
  79848. *
  79849. * </script>
  79850. *
  79851. * // ES6 Import
  79852. * import { toGeoJSON } from '{npm}';
  79853. *
  79854. * const result = toGeoJSON(feature);
  79855. * ```
  79856. */
  79857. var toGeoJSON = function(feature) {
  79858. if (!feature) {
  79859. return feature;
  79860. }
  79861. return new GeoJSON().toGeoJSON(feature);
  79862. };
  79863. /**
  79864. * @function toSuperMapGeometry
  79865. * @category BaseTypes Util
  79866. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  79867. * @param {GeoJSONObject} geometry - GeoJSON 对象。
  79868. * @usage
  79869. * ```
  79870. * // 浏览器
  79871. * <script type="text/javascript" src="{cdn}"></script>
  79872. * <script>
  79873. * const result = {namespace}.Util.toSuperMapGeometry(geometry);
  79874. *
  79875. * </script>
  79876. *
  79877. * // ES6 Import
  79878. * import { toSuperMapGeometry } from '{npm}';
  79879. *
  79880. * const result = toSuperMapGeometry(geometry);
  79881. * ```
  79882. */
  79883. var Util_toSuperMapGeometry = function(geometry) {
  79884. if (!geometry) {
  79885. return geometry;
  79886. }
  79887. var result,
  79888. format = new GeoJSON();
  79889. if (['FeatureCollection', 'Feature', 'Geometry'].indexOf(geometry.type) != -1) {
  79890. result = format.read(geometry, geometry.type);
  79891. } else if (typeof geometry.toGeoJSON === 'function') {
  79892. var geojson = geometry.toGeoJSON();
  79893. result = geojson ? format.read(geojson, geojson.type) : geometry;
  79894. }
  79895. var serverResult = result || geometry;
  79896. if (external_L_default().Util.isArray(result)) {
  79897. if (result.length === 1) {
  79898. serverResult = result[0];
  79899. } else if (result.length > 1) {
  79900. serverResult = [];
  79901. result.map(function(item) {
  79902. serverResult.push(item.geometry);
  79903. return item;
  79904. });
  79905. }
  79906. }
  79907. return serverResult && serverResult.geometry ? serverResult.geometry : serverResult;
  79908. };
  79909. var Util_getMeterPerMapUnit = getMeterPerMapUnit;
  79910. /**
  79911. * @function resolutionToScale
  79912. * @category BaseTypes Util
  79913. * @description 通过分辨率计算比例尺。
  79914. * @param {number} resolution - 分辨率。
  79915. * @param {number} dpi - 屏幕分辨率。
  79916. * @param {string} mapUnit - 地图单位。
  79917. * @returns {number} 比例尺。
  79918. * @usage
  79919. * ```
  79920. * // 浏览器
  79921. * <script type="text/javascript" src="{cdn}"></script>
  79922. * <script>
  79923. * const result = {namespace}.Util.resolutionToScale(resolution, dpi, mapUnit);
  79924. *
  79925. * </script>
  79926. *
  79927. * // ES6 Import
  79928. * import { resolutionToScale } from '{npm}';
  79929. *
  79930. * const result = resolutionToScale(resolution, dpi, mapUnit);
  79931. * ```
  79932. */
  79933. var resolutionToScale = function(resolution, dpi, mapUnit) {
  79934. var inchPerMeter = 1 / 0.0254;
  79935. // 地球半径。
  79936. var meterPerMapUnit = Util_getMeterPerMapUnit(mapUnit);
  79937. var scale = resolution * dpi * inchPerMeter * meterPerMapUnit;
  79938. scale = 1 / scale;
  79939. return scale;
  79940. };
  79941. /**
  79942. * @function scaleToResolution
  79943. * @category BaseTypes Util
  79944. * @description 通过比例尺计算分辨率。
  79945. * @param {number} scale - 比例尺。
  79946. * @param {number} dpi - 屏幕分辨率。
  79947. * @param {string} mapUnit - 地图单位。
  79948. * @returns {number} 分辨率。
  79949. * @usage
  79950. * ```
  79951. * // 浏览器
  79952. * <script type="text/javascript" src="{cdn}"></script>
  79953. * <script>
  79954. * const result = {namespace}.Util.scaleToResolution(scale, dpi, mapUnit);
  79955. *
  79956. * </script>
  79957. *
  79958. * // ES6 Import
  79959. * import { scaleToResolution } from '{npm}';
  79960. *
  79961. * const result = scaleToResolution(scale, dpi, mapUnit);
  79962. * ```
  79963. */
  79964. var Util_scaleToResolution = function(scale, dpi, mapUnit) {
  79965. var inchPerMeter = 1 / 0.0254;
  79966. var meterPerMapUnitValue = Util_getMeterPerMapUnit(mapUnit);
  79967. var resolution = scale * dpi * inchPerMeter * meterPerMapUnitValue;
  79968. resolution = 1 / resolution;
  79969. return resolution;
  79970. };
  79971. /**
  79972. * @function normalizeScale
  79973. * @category BaseTypes Util
  79974. * @description 转换比例尺。
  79975. * @param {number} scale - 比例尺。
  79976. * @returns {number} 正常的 scale 值。
  79977. * @usage
  79978. * ```
  79979. * // 浏览器
  79980. * <script type="text/javascript" src="{cdn}"></script>
  79981. * <script>
  79982. * const result = {namespace}.Util.normalizeScale(scale);
  79983. *
  79984. * // 弃用的写法
  79985. * const result = L.supermap.Util.NormalizeScale(scale);
  79986. * const result = L.Util.NormalizeScale(scale);
  79987. * </script>
  79988. *
  79989. * // ES6 Import
  79990. * import { normalizeScale } from '{npm}';
  79991. *
  79992. * const result = normalizeScale(scale);
  79993. * ```
  79994. */
  79995. var normalizeScale = function(scale) {
  79996. return scale > 1.0 ? 1.0 / scale : scale;
  79997. };
  79998. /**
  79999. * @function getResolutionFromScaleDpi
  80000. * @category BaseTypes Util
  80001. * @description 根据比例尺和 DPI 计算屏幕分辨率。
  80002. * @param {number} scale - 比例尺。
  80003. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  80004. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  80005. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  80006. * @returns {number} 当前比例尺下的屏幕分辨率。
  80007. * @usage
  80008. * ```
  80009. * // 浏览器
  80010. * <script type="text/javascript" src="{cdn}"></script>
  80011. * <script>
  80012. * const result = {namespace}.Util.getResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
  80013. *
  80014. * // 弃用的写法
  80015. * const result = L.supermap.Util.GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
  80016. * const result = L.Util.GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
  80017. * </script>
  80018. *
  80019. * // ES6 Import
  80020. * import { getResolutionFromScaleDpi } from '{npm}';
  80021. *
  80022. * const result = getResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
  80023. * ```
  80024. */
  80025. var getResolutionFromScaleDpi = function(scale, dpi, coordUnit, datumAxis) {
  80026. var resolution = null,
  80027. ratio = 10000;
  80028. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  80029. datumAxis = datumAxis || 6378137;
  80030. coordUnit = coordUnit || '';
  80031. if (scale > 0 && dpi > 0) {
  80032. scale = normalizeScale(scale);
  80033. if (
  80034. coordUnit.toLowerCase() === 'degree' ||
  80035. coordUnit.toLowerCase() === 'degrees' ||
  80036. coordUnit.toLowerCase() === 'dd'
  80037. ) {
  80038. //scale = CommonUtil.normalizeScale(scale);
  80039. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  80040. return resolution;
  80041. } else {
  80042. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  80043. return resolution;
  80044. }
  80045. }
  80046. return -1;
  80047. };
  80048. ;// CONCATENATED MODULE: ./src/leaflet/core/Transform.js
  80049. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80050. * This program are made available under the terms of the Apache License, Version 2.0
  80051. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80052. /**
  80053. * @function transform
  80054. * @description 转换要素坐标。
  80055. * @category BaseTypes Util
  80056. * @param {(L.Marker|L.CircleMarker|L.Polyline|L.Polygon|L.Rectangle|L.LatLngBounds|L.Bounds|Object)} feature - 待转换要素:Leaflet Vector Layers 的 {@link L.Marker}|{@link L.CircleMarker}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Rectangle}|{@link L.LatLngBounds}|{@link L.Bounds}|{@link GeoJSONObject} 类型。
  80057. * @param {CRS} [sourceCRS=L.CRS.EPSG4326] - 转换要素的源坐标系。
  80058. * @param {CRS} targetCRS - 转换要素的目标坐标系。
  80059. * @returns {GeoJSONObject} 返回 GeoJSON 规范的数据类型。
  80060. * @usage
  80061. * ```
  80062. * // 浏览器
  80063. * <script type="text/javascript" src="{cdn}"></script>
  80064. * <script>
  80065. * const result = {namespace}.Util.transform(feature, sourceCRS, targetCRS);
  80066. *
  80067. * // 弃用的写法:
  80068. * L.Util.transform(feature, sourceCRS, targetCRS);
  80069. *
  80070. * </script>
  80071. *
  80072. * // ES6 Import
  80073. * import { transform } from '{npm}';
  80074. *
  80075. * const result = transform(feature, sourceCRS, targetCRS);
  80076. * ```
  80077. */
  80078. var transform = function (feature, sourceCRS = (external_L_default()).CRS.EPSG4326, targetCRS) {
  80079. let selfFeatures = null;
  80080. let selfCallback = null;
  80081. //将数据统一为 geojson 格式处理:
  80082. if (["FeatureCollection", "Feature", "Geometry"].indexOf(feature.type) === -1) {
  80083. if (feature.toGeoJSON) {
  80084. feature = feature.toGeoJSON();
  80085. } else if (feature instanceof (external_L_default()).LatLngBounds) {
  80086. feature = external_L_default().rectangle(feature).toGeoJSON();
  80087. } else if (feature instanceof (external_L_default()).Bounds) {
  80088. feature = external_L_default().rectangle([[feature.getTopLeft().x, feature.getTopLeft().y],
  80089. [feature.getBottomRight().x, feature.getBottomRight().y]]).toGeoJSON();
  80090. } else {
  80091. throw new Error("This tool only supports data conversion in geojson format or Vector Layers of Leaflet.")
  80092. }
  80093. }
  80094. //geojson 几种数据类型及处理形式
  80095. const parseCoords = {
  80096. "point": function (array) {
  80097. return selfCallback(array);
  80098. },
  80099. "multipoint": function (array) {
  80100. return parseCoords["linestring"].apply(this, [array])
  80101. },
  80102. "linestring": function (array) {
  80103. let points = [];
  80104. let p = null;
  80105. for (let i = 0, len = array.length; i < len; ++i) {
  80106. try {
  80107. p = parseCoords["point"].apply(this, [array[i]]);
  80108. } catch (err) {
  80109. throw err;
  80110. }
  80111. points.push(p);
  80112. }
  80113. return points;
  80114. },
  80115. "multilinestring": function (array) {
  80116. return parseCoords["polygon"].apply(this, [array]);
  80117. },
  80118. "polygon": function (array) {
  80119. let rings = [];
  80120. let l;
  80121. for (let i = 0, len = array.length; i < len; ++i) {
  80122. try {
  80123. l = parseCoords["linestring"].apply(this, [array[i]]);
  80124. } catch (err) {
  80125. throw err;
  80126. }
  80127. rings.push(l);
  80128. }
  80129. return rings;
  80130. },
  80131. "multipolygon": function (array) {
  80132. let polys = [];
  80133. let p = null;
  80134. for (let i = 0, len = array.length; i < len; ++i) {
  80135. try {
  80136. p = parseCoords["polygon"].apply(this, [array[i]]);
  80137. } catch (err) {
  80138. throw err;
  80139. }
  80140. polys.push(p);
  80141. }
  80142. return polys;
  80143. }
  80144. };
  80145. //返回结果:
  80146. return featureTransform(feature, _transformCoordinates);
  80147. function featureTransform(feature, callback) {
  80148. selfFeatures = feature;
  80149. selfCallback = callback;
  80150. //分离处理:
  80151. if (feature.type === "Feature") {
  80152. selfFeatures = _prepareFeatuers(feature);
  80153. } else if (feature.type === "FeatureCollection") {
  80154. let featureResults = [];
  80155. for (let i = 0; i < feature.features.length; ++i) {
  80156. try {
  80157. featureResults.push(_prepareFeatuers(feature.features[i]));
  80158. } catch (err) {
  80159. featureResults = null;
  80160. }
  80161. }
  80162. selfFeatures.features = featureResults;
  80163. }
  80164. return selfFeatures;
  80165. }
  80166. function _prepareFeatuers(feature) {
  80167. const geometry = feature.geometry;
  80168. if (!(Util_Util.isArray(geometry.coordinates))) {
  80169. throw "Geometry must have coordinates array: " + geometry;
  80170. }
  80171. if (!parseCoords[geometry.type.toLowerCase()]) {
  80172. throw "Unsupported geometry type: " + geometry.type;
  80173. }
  80174. try {
  80175. geometry.coordinates = parseCoords[geometry.type.toLowerCase()].apply(
  80176. this, [geometry.coordinates]
  80177. );
  80178. } catch (err) {
  80179. throw err;
  80180. }
  80181. feature.geometry = geometry;
  80182. return feature;
  80183. }
  80184. function _transformCoordinates(coordinates) {
  80185. //判断code 是投影坐标还是地理坐标
  80186. var point = sourceCRS.unproject({x: coordinates[0], y: coordinates[1]});
  80187. const transform = targetCRS.project(point);
  80188. return [transform.x, transform.y];
  80189. }
  80190. };
  80191. ;// CONCATENATED MODULE: ./src/leaflet/core/index.js
  80192. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80193. * This program are made available under the terms of the Apache License, Version 2.0
  80194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80195. ;// CONCATENATED MODULE: ./src/leaflet/mapping/BaiduTileLayer.js
  80196. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80197. * This program are made available under the terms of the Apache License, Version 2.0
  80198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80199. /**
  80200. * @class BaiduTileLayer
  80201. * @deprecatedclassinstance L.supermap.baiduTileLayer
  80202. * @classdesc 百度地图图层类。
  80203. * @category ThirdPartyMap
  80204. * @modulecategory Mapping
  80205. * @extends {L.TileLayer}
  80206. * @param {string} [url='https://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1'] - 切片地址。
  80207. * @param {Object} options - 参数。
  80208. * @param {number} [options.minZoom=3] - 最小缩放级别。
  80209. * @param {number} [options.maxZoom=19] - 最大缩放级别。
  80210. * @param {L.LatLngBounds} [options.bounds=L.latLngBounds([-85.0511287798, -180],[85.0511287798, 180])] - 显示范围。
  80211. * @param {L.Browser} [options.retina=L.Browser.retina] - 浏览器显示分辨率。
  80212. * @param {string} [options.tileProxy] - 服务代理地址。
  80213. * @param {string} [options.attribution='Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方'] - 版权信息。
  80214. * @usage
  80215. */
  80216. var BaiduTileLayer = external_L_default().TileLayer.extend({
  80217. /**
  80218. * @member {string} BaiduTileLayer.prototype.url
  80219. * @description 切片地址。
  80220. */
  80221. url: "http://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1",
  80222. options: {
  80223. minZoom: 3,
  80224. maxZoom: 19,
  80225. bounds: external_L_default().latLngBounds(external_L_default().latLng(-85.0511287798, -180), external_L_default().latLng(85.0511287798, 180)),
  80226. retina: (external_L_default()).Browser.retina,
  80227. attribution: core_Attributions.Baidu.attribution
  80228. },
  80229. initialize: function (url, options) {
  80230. if (url) {
  80231. this.url = url;
  80232. }
  80233. external_L_default().setOptions(this, options);
  80234. if (this.options.retina) {
  80235. this.options.maxZoom = 18;
  80236. }
  80237. external_L_default().stamp(this);
  80238. },
  80239. /**
  80240. * @function BaiduTileLayer.prototype.getTileUrl
  80241. * @description 获取切片地址。
  80242. * @param {Object} coords - 行列号。
  80243. * @returns {string} 切片地址。
  80244. */
  80245. getTileUrl: function (coords) {
  80246. var url = external_L_default().Util.template(this.url, {
  80247. num: Math.abs((coords.x + coords.y) % 8) + 1,
  80248. x: coords.x,
  80249. y: -coords.y - 1,
  80250. z: this._getZoomForUrl(),
  80251. styles: this.options.retina ? 'ph' : 'pl'
  80252. });
  80253. //支持代理
  80254. if (this.options.tileProxy) {
  80255. url = this.options.tileProxy + encodeURIComponent(url);
  80256. }
  80257. return url;
  80258. }
  80259. });
  80260. var baiduTileLayer = function (url, options) {
  80261. return new BaiduTileLayer(url, options);
  80262. };
  80263. ;// CONCATENATED MODULE: ./src/leaflet/mapping/CloudTileLayer.js
  80264. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80265. * This program are made available under the terms of the Apache License, Version 2.0
  80266. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80267. /**
  80268. * @class CloudTileLayer
  80269. * @deprecatedclassinstance L.supermap.cloudTileLayer
  80270. * @classdesc 超图云服务图层类。
  80271. * @category ThirdPartyMap
  80272. * @modulecategory Mapping
  80273. * @extends {L.TileLayer}
  80274. * @param {string} [url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
  80275. * @param {Object} options - 参数。
  80276. * @param {string} [options.type='web'] - type。
  80277. * @param {number} [options.minZoom=3] - 最小缩放级别。
  80278. * @param {number} [options.maxZoom=18] - 最大缩放级别。
  80279. * @param {string} [options.mapName='quanguo'] - 地图名称。
  80280. * @param {string} [options.attribution='Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo'] - 版权信息。
  80281. * @usage
  80282. */
  80283. var CloudTileLayer = external_L_default().TileLayer.extend({
  80284. defaultURL: 'http://t2.dituhui.com/FileService/image',
  80285. options: {
  80286. /**
  80287. * @member {string} [CloudTileLayer.prototype.options='quanguo']
  80288. * @description 地图名称。
  80289. */
  80290. mapName: "quanguo",
  80291. /**
  80292. * @member {string} CloudTileLayer.prototype.type
  80293. * @description 地图投影。
  80294. */
  80295. type: "web",
  80296. minZoom: 3,
  80297. maxZoom: 18,
  80298. attribution: core_Attributions.Cloud.attribution
  80299. },
  80300. initialize: function (url, options) {
  80301. external_L_default().setOptions(this, options);
  80302. var cloudURL = url || this.defaultURL;
  80303. this._url = cloudURL + "?map=" + this.options.mapName + "&type=" + this.options.type;
  80304. external_L_default().stamp(this);
  80305. },
  80306. /**
  80307. * @function CloudTileLayer.prototype.getTileUrl
  80308. * @description 获取切片地址。
  80309. * @param {Object} coords - 行列号。
  80310. * @returns {string} 切片地址。
  80311. */
  80312. getTileUrl: function (coords) {
  80313. var layerUrl = this._url;
  80314. var tileUrl = layerUrl + "&x=" + coords.x + "&y=" + coords.y + "&z=" + coords.z;
  80315. //支持代理
  80316. if (this.options.tileProxy) {
  80317. tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
  80318. }
  80319. return tileUrl;
  80320. }
  80321. });
  80322. var cloudTileLayer = function (url, options) {
  80323. return new CloudTileLayer(url, options);
  80324. };
  80325. ;// CONCATENATED MODULE: ./src/leaflet/mapping/ImageMapLayer.js
  80326. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80327. * This program are made available under the terms of the Apache License, Version 2.0
  80328. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80329. /**
  80330. * @class ImageMapLayer
  80331. * @deprecatedclassinstance L.supermap.imageMapLayer
  80332. * @classdesc SuperMap iServer 的 REST 地图服务的图层类(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 Image 资源出图。
  80333. * @category iServer Map Tile
  80334. * @modulecategory Mapping
  80335. * @extends {L.Layer}
  80336. * @example
  80337. * new ImageMapLayer(url).addTo(map);
  80338. * @param {string} url - 服务地址,如:http://{ip}:{port}/iserver/services/map-china400/rest/maps/China。
  80339. * @param {Object} options - 参数。
  80340. * @param {string} [options.layersID] - 获取需要切片的地图图层 ID,即指定需要切片的地图图层,可以是临时图层集,也可以是当前地图中图层的组合。
  80341. * @param {boolean} [options.redirect=false] - 是否重定向,如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
  80342. * @param {boolean} [options.transparent=true] - 地图瓦片是否透明。
  80343. * @param {boolean} [options.cacheEnabled=true] - 是否启用缓存。
  80344. * @param {boolean} [options.clipRegionEnabled=false] - 是否启用地图裁剪。
  80345. * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域(区域为一个面对象)。当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  80346. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。如:prjCoordSys={"epsgCode":3857}。
  80347. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内,是否重叠显示。
  80348. * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
  80349. * @param {number} [options.opacity=1] - 图层不透明度。
  80350. * @param {string} [options.alt] - 图像无法显示时的提示文字。
  80351. * @param {string} [options.pane='tilePane'] - 图层所归属的 map DOM 的分组。
  80352. * @param {boolean} [options.interactive=false] - 是否响应鼠标点击或悬停等交互事件。
  80353. * @param {boolean} [options.crossOrigin=false] - 是否设置跨域属性。
  80354. * @param {string} [options.errorOverlayUrl] - 图层未能加载时显示的瓦片地址。
  80355. * @param {number} [options.zIndex=1] - 设置图层的层级。
  80356. * @param {string} [options.className] - 自定义 dom 元素的 className。
  80357. * @param {number} [options.updateInterval=150] - 平移时图层延迟刷新间隔时间。
  80358. * @param {string} [options.tileProxy] - 服务代理地址。
  80359. * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、"gif" 等图片格式。
  80360. * @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  80361. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  80362. * @fires ImageMapLayer#load
  80363. * @fires ImageMapLayer#error
  80364. * @fires ImageMapLayer#loading
  80365. * @usage
  80366. */
  80367. var ImageMapLayer = external_L_namespaceObject.Layer.extend({
  80368. options: {
  80369. //如果有layersID,则是在使用专题图
  80370. layersID: null,
  80371. //如果为 true,则将请求重定向到图片的真实地址;如果为 false,则响应体中是图片的字节流
  80372. redirect: false,
  80373. //地图图片是否透明
  80374. transparent: true,
  80375. //是否启用服务器缓存
  80376. cacheEnabled: true,
  80377. //地图显示裁剪的区域是否有效
  80378. clipRegionEnabled: false,
  80379. //地图显示裁剪的区域
  80380. clipRegion: null,
  80381. //请求的地图的坐标参考系统。如:prjCoordSys= {"epsgCode":3857}。
  80382. prjCoordSys: null,
  80383. //地图对象在同一范围内,是否重叠显示
  80384. overlapDisplayed: false,
  80385. //避免地图对象压盖显示的过滤选项
  80386. overlapDisplayedOptions: null,
  80387. //图层不透明度
  80388. opacity: 1,
  80389. //图像无法显示时的提示文字
  80390. alt: '',
  80391. //图层所归属的map DOM的分组。默认为:"tilePane"
  80392. pane: 'tilePane',
  80393. //是否响应鼠标点击或悬停交互事件
  80394. interactive: false,
  80395. //是否设置跨域属性
  80396. crossOrigin: false,
  80397. //图层未能加载时显示的瓦片地址
  80398. errorOverlayUrl: '',
  80399. //设置图层的显示层级
  80400. zIndex: 1,
  80401. //自定义的html class name
  80402. className: '',
  80403. //版权信息
  80404. attribution: core_Attributions.Common.attribution,
  80405. //平移时图层延迟刷新间隔时间。
  80406. updateInterval: 150,
  80407. //启用托管地址。
  80408. tileProxy: null,
  80409. format: 'png'
  80410. },
  80411. initialize: function(url, options) {
  80412. this._url = url;
  80413. external_L_namespaceObject.Util.setOptions(this, options);
  80414. },
  80415. /**
  80416. * @private
  80417. * @function ImageMapLayer.prototype.onAdd
  80418. * @description 添加到地图。
  80419. * @param {L.Map} map - Leaflet Map 对象。
  80420. */
  80421. onAdd: function(map) {
  80422. this.update = external_L_namespaceObject.Util.throttle(this.update, this.options.updateInterval, this);
  80423. map.on('moveend', this.update, this);
  80424. if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) {
  80425. map.addLayer(this._currentImage);
  80426. } else if (this._currentImage) {
  80427. this._map.removeLayer(this._currentImage);
  80428. this._currentImage = null;
  80429. }
  80430. this.update();
  80431. },
  80432. /**
  80433. * @private
  80434. * @function ImageMapLayer.prototype.onRemove
  80435. * @description 从地图上移除。
  80436. */
  80437. onRemove: function() {
  80438. // eslint-disable-line no-unused-vars
  80439. if (this._currentImage) {
  80440. this._map.removeLayer(this._currentImage);
  80441. }
  80442. this._map.off('moveend', this.update, this);
  80443. },
  80444. /**
  80445. * @function ImageMapLayer.prototype.bringToFront
  80446. * @description 置顶当前图层。
  80447. */
  80448. bringToFront: function() {
  80449. this.options.position = 'front';
  80450. if (this._currentImage) {
  80451. this._currentImage.bringToFront();
  80452. }
  80453. return this;
  80454. },
  80455. /**
  80456. * @function ImageMapLayer.prototype.bringToBack
  80457. * @description 置底当前图层。
  80458. */
  80459. bringToBack: function() {
  80460. this.options.position = 'back';
  80461. if (this._currentImage) {
  80462. this._currentImage.bringToBack();
  80463. }
  80464. return this;
  80465. },
  80466. /**
  80467. * @function ImageMapLayer.prototype.getOpacity
  80468. * @description 获取图层透明度。
  80469. * @returns {number} 图层的透明度。
  80470. */
  80471. getOpacity: function() {
  80472. return this.options.opacity;
  80473. },
  80474. /**
  80475. * @function ImageMapLayer.prototype.setOpacity
  80476. * @description 设置图层不透明度。
  80477. */
  80478. setOpacity: function(opacity) {
  80479. this.options.opacity = opacity;
  80480. if (this._currentImage) {
  80481. this._currentImage.setOpacity(opacity);
  80482. }
  80483. return this;
  80484. },
  80485. /**
  80486. * @function ImageMapLayer.prototype.getImageUrl
  80487. * @description 获取 image 图层请求地址,子类可重写实现。
  80488. * @returns {string} 请求瓦片地址。
  80489. */
  80490. getImageUrl: function(params) {
  80491. let serviceUrl = Util_Util.urlPathAppend(this._url, `image.${this.options.format}`);
  80492. let imageUrl =
  80493. serviceUrl + external_L_namespaceObject.Util.getParamString(Object.assign({}, this._initAllRequestParams(), params), serviceUrl);
  80494. imageUrl = SecurityManager.appendCredential(imageUrl);
  80495. //支持代理
  80496. if (this.options.tileProxy) {
  80497. imageUrl = this.options.tileProxy + encodeURIComponent(imageUrl);
  80498. }
  80499. if (!this.options.cacheEnabled) {
  80500. imageUrl += '&_t=' + new Date().getTime();
  80501. }
  80502. return imageUrl;
  80503. },
  80504. //获取请求瓦片宽高以及请求范围参数
  80505. _getImageParams: function(bounds) {
  80506. var size = this._calculateImageSize(bounds);
  80507. return {
  80508. viewBounds: this._compriseBounds(this._calculateBounds(bounds)),
  80509. width: size.x,
  80510. height: size.y
  80511. };
  80512. },
  80513. //初始化服务请求参数
  80514. _initAllRequestParams: function() {
  80515. var me = this,
  80516. options = me.options || {},
  80517. params = {};
  80518. var redirect = options.redirect === true ? options.redirect : false;
  80519. params['redirect'] = redirect;
  80520. var transparent = options.transparent === true ? options.transparent : false;
  80521. params['transparent'] = transparent;
  80522. var cacheEnabled = options.cacheEnabled === false ? options.cacheEnabled : true;
  80523. params['cacheEnabled'] = cacheEnabled;
  80524. if (options.prjCoordSys) {
  80525. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  80526. }
  80527. if (options.layersID) {
  80528. params['layersID'] = options.layersID;
  80529. }
  80530. if (options.rasterfunction) {
  80531. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  80532. }
  80533. if (options.clipRegionEnabled && options.clipRegion) {
  80534. params['clipRegionEnabled'] = options.clipRegionEnabled;
  80535. params['clipRegion'] = JSON.stringify(ServerGeometry.fromGeometry(Util_toSuperMapGeometry(options.clipRegion)));
  80536. }
  80537. if (options.overlapDisplayed === false) {
  80538. params['overlapDisplayed'] = false;
  80539. if (options.overlapDisplayedOptions) {
  80540. params['overlapDisplayedOptions'] = me.overlapDisplayedOptions.toString();
  80541. }
  80542. } else {
  80543. params['overlapDisplayed'] = true;
  80544. }
  80545. return params;
  80546. },
  80547. //初始化请求链接
  80548. _requestImage: function(params, bounds) {
  80549. var imageUrl = this.getImageUrl(params);
  80550. this._loadImage(imageUrl, bounds);
  80551. },
  80552. //加载请求图层
  80553. _loadImage: function(url, bounds) {
  80554. if (!this._map) {
  80555. return;
  80556. }
  80557. var image = new external_L_namespaceObject.ImageOverlay(url, bounds, {
  80558. opacity: 0,
  80559. alt: this.options.alt,
  80560. zIndex: this.options.zIndex,
  80561. className: this.options.className,
  80562. errorOverlayUrl: this.options.error,
  80563. crossOrigin: this.options.crossOrigin,
  80564. pane: this.options.pane || this.getPane(),
  80565. interactive: this.options.interactive
  80566. }).addTo(this._map);
  80567. var onLoad = function(e) {
  80568. image.off('error', onError, this);
  80569. var map = this._map;
  80570. if (!map) {
  80571. return;
  80572. }
  80573. var newImage = e.target;
  80574. var oldImage = this._currentImage;
  80575. if (newImage._bounds && newImage._bounds.equals(bounds) && newImage._bounds.equals(map.getBounds())) {
  80576. this._currentImage = newImage;
  80577. if (this.options.position === 'front') {
  80578. this.bringToFront();
  80579. }
  80580. if (this.options.position === 'back') {
  80581. this.bringToBack();
  80582. }
  80583. if (this._currentImage._map) {
  80584. this._currentImage.setOpacity(this.options.opacity);
  80585. }
  80586. oldImage && map.removeLayer(oldImage);
  80587. oldImage && oldImage._map && oldImage._map.removeLayer(oldImage);
  80588. } else {
  80589. map.removeLayer(newImage);
  80590. }
  80591. /**
  80592. * @event ImageMapLayer#load
  80593. * @description 请求图层加载完成后触发。
  80594. * @property {L.Bounds} bounds - 图层 bounds。
  80595. */
  80596. this.fire('load', { bounds: bounds });
  80597. };
  80598. var onError = function() {
  80599. this._map.removeLayer(image);
  80600. /**
  80601. * @event ImageMapLayer#error
  80602. * @description 请求图层加载失败后触发。
  80603. */
  80604. this.fire('error');
  80605. image.off('load', onLoad, this);
  80606. }
  80607. image.once('load', onLoad, this);
  80608. image.once('error', onError, this);
  80609. /**
  80610. * @event ImageMapLayer#loading
  80611. * @description 请求图层加载中触发。
  80612. * @property {L.Bounds} bounds - 图层 bounds。
  80613. */
  80614. this.fire('loading', { bounds: bounds });
  80615. },
  80616. /**
  80617. * @function ImageMapLayer.prototype.update
  80618. * @description 更新图层。
  80619. */
  80620. update: function() {
  80621. if (!this._map) {
  80622. return;
  80623. }
  80624. var zoom = this._map.getZoom();
  80625. var bounds = this._map.getBounds();
  80626. if (zoom > (this._map.options.maxZoom|| 18) || zoom < (this._map.options.minZoom || 0)) {
  80627. if (this._currentImage) {
  80628. this._currentImage._map.removeLayer(this._currentImage);
  80629. this._currentImage = null;
  80630. }
  80631. return;
  80632. }
  80633. var params = this._getImageParams(bounds);
  80634. if (params) {
  80635. this._requestImage(params, bounds);
  80636. } else if (this._currentImage) {
  80637. this._currentImage._map.removeLayer(this._currentImage);
  80638. this._currentImage = null;
  80639. }
  80640. },
  80641. //将像素坐标转成点坐标
  80642. _calculateBounds: function(bounds) {
  80643. var neProjected = this._map.options.crs.project(bounds.getNorthEast());
  80644. var swProjected = this._map.options.crs.project(bounds.getSouthWest());
  80645. return external_L_default().bounds(neProjected, swProjected);
  80646. },
  80647. //转换viewBounds为JSON字符串
  80648. _compriseBounds: function(boundsProjected) {
  80649. var projBounds = {
  80650. leftBottom: {
  80651. x: boundsProjected.getBottomLeft().x,
  80652. y: boundsProjected.getTopRight().y
  80653. },
  80654. rightTop: {
  80655. x: boundsProjected.getTopRight().x,
  80656. y: boundsProjected.getBottomLeft().y
  80657. }
  80658. };
  80659. return JSON.stringify(projBounds);
  80660. },
  80661. //计算图层的宽高
  80662. _calculateImageSize: function(bounds) {
  80663. // 与imageoverlay 内部逻辑一致
  80664. var sizeBounds = new (external_L_default()).Bounds(
  80665. this._map.latLngToLayerPoint(bounds.getNorthWest()),
  80666. this._map.latLngToLayerPoint(bounds.getSouthEast()));
  80667. return sizeBounds.getSize();
  80668. }
  80669. });
  80670. var imageMapLayer = function(url, options) {
  80671. return new ImageMapLayer(url, options);
  80672. };
  80673. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TileLayer.WMTS.js
  80674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80675. * This program are made available under the terms of the Apache License, Version 2.0
  80676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80677. /**
  80678. * @class WMTSLayer
  80679. * @deprecatedclassinstance L.supermap.wmtsLayer
  80680. * @classdesc wmts 图层类。
  80681. * @category OGC
  80682. * @modulecategory Mapping
  80683. * @extends {L.TileLayer}
  80684. * @param {string} url - 服务地址。
  80685. * @param {Object} options - 参数。
  80686. * @param {string} options.layer - 显示的图层。
  80687. * @param {string} [options.tileProxy] - 服务代理地址。
  80688. * @param {Object} [options.style] - 图层样式。
  80689. * @param {string} [options.format='image/png'] - wmts 图像格式('image/png'用于具有透明度的图层)。
  80690. * @param {(number|L.Point)} [options.tileSize='256'] - 瓦片大小。
  80691. * @param {string} [options.requestEncoding='KVP'] - KVP 或者 REST 的请求方式。
  80692. * @param {string} [options.tilematrixSet] - 瓦片矩阵集。
  80693. * @param {Array.<WMTSLayer.matrix>} [options.matrixIds] - 瓦片矩阵对象。不设置时,默认为获取当前级别为 tilematrix 参数。
  80694. * @param {string} [options.version='1.0.0'] - 版本。
  80695. * @param {string} [options.attribution] - 版权信息。
  80696. * @param {string} [options.noWrap=true] - 图层是否 X 方向平铺。
  80697. * @usage
  80698. */
  80699. /**
  80700. * @typedef {Object} WMTSLayer.matrix
  80701. * @description 瓦片矩阵。
  80702. * @property {string} identifier - 瓦片矩阵标识符。
  80703. */
  80704. var WMTSLayer = external_L_default().TileLayer.extend({
  80705. options: {
  80706. version: '1.0.0',
  80707. style: '',
  80708. tilematrixSet: '',
  80709. format: 'image/png',
  80710. tileSize: 256,
  80711. matrixIds: null,
  80712. layer: '',
  80713. requestEncoding: 'KVP',
  80714. attribution: '',
  80715. noWrap: true
  80716. },
  80717. //todo 自动获取Capabilities
  80718. initialize: function (url, options) { // (String, Object)
  80719. this._url = url;
  80720. external_L_default().setOptions(this, options);
  80721. var opt = this.options;
  80722. if (opt.requestEncoding === "REST") {
  80723. var formatSuffixMap = {
  80724. "image/png": "png",
  80725. "image/png8": "png",
  80726. "image/png24": "png",
  80727. "image/png32": "png",
  80728. "png": "png",
  80729. "image/jpeg": "jpg",
  80730. "image/jpg": "jpg",
  80731. "jpeg": "jpg",
  80732. "jpg": "jpg"
  80733. };
  80734. this.formatSuffix = "." + (formatSuffixMap[opt.format] || opt.format.split("/").pop() || "png");
  80735. } else {
  80736. opt.requestEncoding = "KVP";
  80737. }
  80738. },
  80739. /**
  80740. * @function WMTSLayer.prototype.getTileUrl
  80741. * @description 获取切片地址。
  80742. * @param {Object} coords - 行列号。
  80743. * @returns {string} 切片地址。
  80744. */
  80745. getTileUrl: function (coords) { // (Point, Number) -> String
  80746. var zoom = this._getZoomForUrl();
  80747. var ident = this.options.matrixIds ? this.options.matrixIds[zoom].identifier : zoom;
  80748. var index = this._url.indexOf('?');
  80749. var url = index > -1 ? this._url.substring(0, this._url.indexOf('?')) : this._url;
  80750. var urlParams = index > -1 ? this._url.substring(this._url.indexOf('?')) : '';
  80751. url = external_L_default().Util.template(url, {s: this._getSubdomain(coords)});
  80752. var obj = {
  80753. service: 'WMTS',
  80754. request: 'GetTile',
  80755. version: this.options.version,
  80756. style: this.options.style,
  80757. tilematrixSet: this.options.tilematrixSet,
  80758. format: this.options.format,
  80759. width: this.options.tileSize,
  80760. height: this.options.tileSize,
  80761. layer: this.options.layer,
  80762. tilematrix: ident,
  80763. tilerow: coords.y,
  80764. tilecol: coords.x
  80765. };
  80766. if (this.options.tileProxy) {
  80767. url = this.options.tileProxy + url;
  80768. }
  80769. if (this.options.requestEncoding === 'KVP') {
  80770. url += external_L_default().Util.getParamString(obj, url);
  80771. } else if (this.options.requestEncoding === 'REST') {
  80772. var params = "/" + obj.layer + "/" + obj.style + "/" + obj.tilematrixSet + "/" + obj.tilematrix + "/" + obj.tilerow + "/" + obj.tilecol + this.formatSuffix;
  80773. url += params;
  80774. }
  80775. url = Util_Util.urlAppend(url, urlParams);
  80776. url = SecurityManager.appendCredential(url);
  80777. return url;
  80778. }
  80779. });
  80780. var wmtsLayer = function (url, options) {
  80781. return new WMTSLayer(url, options);
  80782. };
  80783. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiandituTileLayer.js
  80784. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80785. * This program are made available under the terms of the Apache License, Version 2.0
  80786. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80787. /**
  80788. * @class TiandituTileLayer
  80789. * @deprecatedclassinstance L.supermap.tiandituTileLayer
  80790. * @classdesc 天地图图层类。
  80791. * @category ThirdPartyMap
  80792. * @modulecategory Mapping
  80793. * @extends WMTSLayer
  80794. * @param {Object} options - 参数。
  80795. * @param {string} [options.url='https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?'] - 服务地址。
  80796. * @param {string} options.key - 天地图服务密钥。详见 {@link https://lbs.tianditu.gov.cn/server/MapService.html}
  80797. * @param {string} [options.layerType='vec'] - 图层类型。( vec: 矢量图层,img: 影像图层,ter: 地形图层)
  80798. * @param {string} [options.style='default'] - 图层风格。
  80799. * @param {string} [options.format='tiles'] - 格式。
  80800. * @param {boolean} [options.isLabel=false] - 是否是标注图层。
  80801. * @param {Array.<number>} [options.subdomains=[0, 1, 2, 3, 4, 5, 6, 7]] - 子域名数组。
  80802. * @param {string} [options.attribution='Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>'] - 版权信息。
  80803. * @param {string} [options.noWrap=true] - 图层是否 X 方向平铺。
  80804. * @usage
  80805. */
  80806. var TiandituTileLayer = WMTSLayer.extend({
  80807. layerLabelMap: {
  80808. vec: 'cva',
  80809. ter: 'cta',
  80810. img: 'cia'
  80811. },
  80812. layerZoomMap: {
  80813. vec: 18,
  80814. ter: 14,
  80815. img: 18
  80816. },
  80817. options: {
  80818. layerType: 'vec', //(vec:矢量图层,vec:矢量标签图层,img:影像图层,cia:影像标签图层,ter:地形,cta:地形标签图层)
  80819. isLabel: false,
  80820. attribution: core_Attributions.Tianditu.attribution,
  80821. url: 'https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?',
  80822. zoomOffset: 1,
  80823. key: '',
  80824. dpi: 96,
  80825. style: 'default',
  80826. format: 'tiles',
  80827. subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
  80828. bounds: [
  80829. [-90, -180],
  80830. [90, 180]
  80831. ],
  80832. noWrap: true
  80833. },
  80834. initialize: function (options) {
  80835. options = options || {};
  80836. external_L_default().setOptions(this, options);
  80837. this.options.layer = this.options.isLabel ? this.layerLabelMap[this.options.layerType] : this.options.layerType;
  80838. this.options.maxZoom = this.layerZoomMap[this.options.layerType] - 1;
  80839. WMTSLayer.prototype.initialize.call(this, this.options.url, this.options);
  80840. external_L_default().stamp(this);
  80841. if (this.options.key) {
  80842. this._url = `${this._url}tk=${this.options.key}`;
  80843. }
  80844. },
  80845. onAdd: function (map) {
  80846. this.options.tilematrixSet = map.options.crs.code === "EPSG:4326" ? "c" : "w";
  80847. this._url = this._url.replace("{layer}", this.options.layer).replace("{proj}", this.options.tilematrixSet);
  80848. WMTSLayer.prototype.onAdd.call(this, map);
  80849. },
  80850. _isValidTile: function (coords) {
  80851. const crs = this._map.options.crs;
  80852. if (!crs.infinite) {
  80853. const bounds = this._globalTileRange;
  80854. if (
  80855. ((!crs.wrapLng || this.options.noWrap) && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
  80856. (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))
  80857. ) {
  80858. return false;
  80859. }
  80860. }
  80861. if (!this.options.bounds) {
  80862. return true;
  80863. }
  80864. const tileBounds = this._tileCoordsToBounds(coords);
  80865. return external_L_default().latLngBounds(this.options.bounds).overlaps(tileBounds);
  80866. }
  80867. });
  80868. var tiandituTileLayer = function (options) {
  80869. return new TiandituTileLayer(options);
  80870. };
  80871. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiledMapLayer.js
  80872. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80873. * This program are made available under the terms of the Apache License, Version 2.0
  80874. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80875. /**
  80876. * @class TiledMapLayer
  80877. * @deprecatedclassinstance L.supermap.tiledMapLayer
  80878. * @classdesc SuperMap iServer 的 REST 地图服务的图层(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 TileImage 资源出图。
  80879. * @category iServer Map Tile
  80880. * @extends {L.TileLayer}
  80881. * @modulecategory Mapping
  80882. * @example
  80883. * new TiledMapLayer(url).addTo(map);
  80884. * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  80885. * @param {Object} options - 参数。
  80886. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合
  80887. * @param {boolean} [options.redirect=false] - 是否重定向,如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
  80888. * @param {boolean} [options.transparent=true] - 是否背景透明。
  80889. * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
  80890. * @param {boolean} [options.clipRegionEnabled=false] - 是否启用地图裁剪。
  80891. * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  80892. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。如:prjCoordSys={"epsgCode":3857}。
  80893. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  80894. * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
  80895. * @param {string} [options.tileversion] - 切片版本名称,cacheEnabled 为 true 时有效。如果没有设置 tileversion 参数,而且当前地图的切片集中存在多个版本,则默认使用最后一个更新版本。
  80896. * @param {CRS} [options.crs] - 坐标系统类。
  80897. * @param {string} [options.tileProxy] - 服务代理地址。
  80898. * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png"、"webp"、"bmp"、"jpg"、"gif" 等图片格式。
  80899. * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
  80900. * @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  80901. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  80902. * @param {Array.<number>} [options.subdomains] - 子域名数组。
  80903. * @fires TiledMapLayer#tilesetsinfoloaded
  80904. * @fires TiledMapLayer#tileversionschanged
  80905. * @usage
  80906. */
  80907. var TiledMapLayer = external_L_default().TileLayer.extend({
  80908. options: {
  80909. //如果有layersID,则是在使用专题图
  80910. layersID: null,
  80911. //如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流
  80912. redirect: false,
  80913. transparent: true,
  80914. cacheEnabled: true,
  80915. clipRegionEnabled: false,
  80916. //地图显示裁剪的区域
  80917. clipRegion: null,
  80918. //请求的地图的坐标参考系统。如:prjCoordSys={"epsgCode":3857}
  80919. prjCoordSys: null,
  80920. //地图对象在同一范围内时,是否重叠显示
  80921. overlapDisplayed: false,
  80922. //避免地图对象压盖显示的过滤选项
  80923. overlapDisplayedOptions: null,
  80924. //切片版本名称,cacheEnabled 为 true 时有效。
  80925. tileversion: null,
  80926. crs: null,
  80927. format: 'png',
  80928. //启用托管地址。
  80929. tileProxy:null,
  80930. attribution: core_Attributions.Common.attribution,
  80931. subdomains: null
  80932. },
  80933. initialize: function (url, options) {
  80934. this._url = url;
  80935. external_L_default().TileLayer.prototype.initialize.apply(this, arguments);
  80936. external_L_default().setOptions(this, options);
  80937. external_L_default().stamp(this);
  80938. //当前切片在切片集中的index
  80939. this.tileSetsIndex = -1;
  80940. this.tempIndex = -1;
  80941. },
  80942. /**
  80943. * @private
  80944. * @function TiledMapLayer.prototype.onAdd
  80945. * @description 添加地图。
  80946. * @param {L.Map} map - Leaflet Map 对象。
  80947. */
  80948. onAdd: function (map) {
  80949. this._crs = this.options.crs || map.options.crs;
  80950. external_L_default().TileLayer.prototype.onAdd.call(this, map);
  80951. },
  80952. /**
  80953. * @function TiledMapLayer.prototype.getTileUrl
  80954. * @description 根据行列号获取瓦片地址。
  80955. * @param {Object} coords - 行列号。
  80956. * @returns {string} 瓦片地址。
  80957. */
  80958. getTileUrl: function (coords) {
  80959. var scale = this.getScaleFromCoords(coords);
  80960. var layerUrl = this._getLayerUrl();
  80961. var tileUrl = layerUrl + "&scale=" + scale + "&x=" + coords.x + "&y=" + coords.y;
  80962. //支持代理
  80963. if (this.options.tileProxy) {
  80964. tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
  80965. }
  80966. if (!this.options.cacheEnabled) {
  80967. tileUrl += "&_t=" + new Date().getTime();
  80968. }
  80969. if (this.options.subdomains) {
  80970. tileUrl = external_L_default().Util.template(tileUrl, {s: this._getSubdomain(coords)});
  80971. }
  80972. return tileUrl;
  80973. },
  80974. /**
  80975. * @function TiledMapLayer.prototype.getScale
  80976. * @description 根据缩放级别获取比例尺。
  80977. * @param {number} zoom - 缩放级别。
  80978. * @returns {number} 比例尺。
  80979. */
  80980. getScale: function (zoom) {
  80981. var me = this;
  80982. //返回当前比例尺
  80983. var z = zoom || me._map.getZoom();
  80984. return me.scales[z];
  80985. },
  80986. /**
  80987. * @function TiledMapLayer.prototype.getScaleFromCoords
  80988. * @description 通过行列号获取比例尺。
  80989. * @param {Object} coords - 行列号。
  80990. * @returns {number} 比例尺。
  80991. */
  80992. getScaleFromCoords: function (coords) {
  80993. var me = this,
  80994. scale;
  80995. if (me.scales && me.scales[coords.z]) {
  80996. return me.scales[coords.z];
  80997. }
  80998. me.scales = me.scales || {};
  80999. scale = me.getDefaultScale(coords);
  81000. me.scales[coords.z] = scale;
  81001. return scale;
  81002. },
  81003. /**
  81004. * @private
  81005. * @function TiledMapLayer.prototype.getDefaultScale
  81006. * @description 获取默认比例尺信息。
  81007. * @param {Object} coords - 坐标对象参数。
  81008. */
  81009. getDefaultScale: function (coords) {
  81010. var me = this,
  81011. crs = me._crs;
  81012. if (crs.scales) {
  81013. return crs.scales[coords.z];
  81014. } else {
  81015. var tileBounds = me._tileCoordsToBounds(coords);
  81016. var ne = crs.project(tileBounds.getNorthEast());
  81017. var sw = crs.project(tileBounds.getSouthWest());
  81018. var tileSize = me.options.tileSize;
  81019. var resolution = Math.max(
  81020. Math.abs(ne.x - sw.x) / tileSize,
  81021. Math.abs(ne.y - sw.y) / tileSize
  81022. );
  81023. var mapUnit = Unit.METER;
  81024. if (crs.code) {
  81025. var array = crs.code.split(':');
  81026. if (array && array.length > 1) {
  81027. var code = parseInt(array[1]);
  81028. mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
  81029. }
  81030. }
  81031. return resolutionToScale(resolution, 96, mapUnit);
  81032. }
  81033. },
  81034. /**
  81035. * @function TiledMapLayer.prototype.setTileSetsInfo
  81036. * @description 设置瓦片集信息。
  81037. * @param {Object} tileSets - 瓦片对象集。
  81038. */
  81039. setTileSetsInfo: function (tileSets) {
  81040. this.tileSets = tileSets;
  81041. if (external_L_default().Util.isArray(this.tileSets)) {
  81042. this.tileSets = this.tileSets[0];
  81043. }
  81044. if (!this.tileSets) {
  81045. return;
  81046. }
  81047. /**
  81048. * @event TiledMapLayer#tilesetsinfoloaded
  81049. * @description 瓦片集信息设置完成后触发。
  81050. * @property {Array.<Object>} tileVersions - 瓦片集信息。
  81051. */
  81052. this.fire('tilesetsinfoloaded', {
  81053. tileVersions: this.tileSets.tileVersions
  81054. });
  81055. this.changeTilesVersion();
  81056. },
  81057. /**
  81058. * @function TiledMapLayer.prototype.lastTilesVersion
  81059. * @description 请求上一个版本切片,并重新绘制。
  81060. */
  81061. lastTilesVersion: function () {
  81062. this.tempIndex = this.tileSetsIndex - 1;
  81063. this.changeTilesVersion();
  81064. },
  81065. /**
  81066. * @function TiledMapLayer.prototype.nextTilesVersion
  81067. * @description 请求下一个版本切片,并重新绘制。
  81068. */
  81069. nextTilesVersion: function () {
  81070. this.tempIndex = this.tileSetsIndex + 1;
  81071. this.changeTilesVersion();
  81072. },
  81073. /**
  81074. * @function TiledMapLayer.prototype.changeTilesVersion
  81075. * @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引
  81076. */
  81077. changeTilesVersion: function () {
  81078. var me = this;
  81079. //切片版本集信息是否存在
  81080. if (me.tileSets == null) {
  81081. //版本信息为空,重新查询,查询成功继续跳转到相应的版本
  81082. //me.getTileSetsInfo();
  81083. return;
  81084. }
  81085. if (me.tempIndex === me.tileSetsIndex || this.tempIndex < 0) {
  81086. return;
  81087. }
  81088. //检测index是否可用
  81089. var tileVersions = me.tileSets.tileVersions;
  81090. if (tileVersions && me.tempIndex < tileVersions.length && me.tempIndex >= 0) {
  81091. var name = tileVersions[me.tempIndex].name;
  81092. var result = me.mergeTileVersionParam(name);
  81093. if (result) {
  81094. me.tileSetsIndex = me.tempIndex;
  81095. /**
  81096. * @event TiledMapLayer#tileversionschanged
  81097. * @description 切片的版本切换和重绘成功之后触发。
  81098. * @property {Object} tileVersion - 该版本的切片。
  81099. */
  81100. me.fire('tileversionschanged', {
  81101. tileVersion: tileVersions[me.tempIndex]
  81102. });
  81103. }
  81104. }
  81105. },
  81106. /**
  81107. * @function TiledMapLayer.prototype.updateCurrentTileSetsIndex
  81108. * @description 手动设置当前切片集索引,目前主要提供给控件使用。
  81109. * @param {number} index - 索引值。
  81110. */
  81111. updateCurrentTileSetsIndex: function (index) {
  81112. this.tempIndex = index;
  81113. },
  81114. /**
  81115. * @function TiledMapLayer.prototype.mergeTileVersionParam
  81116. * @description 更改URL请求参数中的切片版本号,并重绘。
  81117. * @param {string} version - 切片版本号。
  81118. * @returns {boolean} 是否成功。
  81119. */
  81120. mergeTileVersionParam: function (version) {
  81121. if (version) {
  81122. this.requestParams["tileversion"] = version;
  81123. this._paramsChanged = true;
  81124. this.redraw();
  81125. this._paramsChanged = false;
  81126. return true;
  81127. }
  81128. return false;
  81129. },
  81130. _getLayerUrl: function () {
  81131. if (this._paramsChanged) {
  81132. this._layerUrl = this._createLayerUrl();
  81133. }
  81134. return this._layerUrl || this._createLayerUrl();
  81135. },
  81136. _createLayerUrl: function () {
  81137. let layerUrl = Util_Util.urlPathAppend(this._url, `tileImage.${this.options.format}`);
  81138. this.requestParams = this.requestParams || this._getAllRequestParams();
  81139. layerUrl = Util_Util.urlAppend(layerUrl, external_L_namespaceObject.Util.getParamString(this.requestParams));
  81140. layerUrl = SecurityManager.appendCredential(layerUrl);
  81141. this._layerUrl = layerUrl;
  81142. return layerUrl;
  81143. },
  81144. _getAllRequestParams: function () {
  81145. var me = this,
  81146. options = me.options || {},
  81147. params = {};
  81148. var tileSize = this.options.tileSize;
  81149. if (!(tileSize instanceof (external_L_default()).Point)) {
  81150. tileSize = external_L_default().point(tileSize, tileSize);
  81151. }
  81152. params["width"] = tileSize.x;
  81153. params["height"] = tileSize.y;
  81154. params["redirect"] = options.redirect === true;
  81155. params["transparent"] = options.transparent === true;
  81156. params["cacheEnabled"] = !(options.cacheEnabled === false);
  81157. if (options.prjCoordSys) {
  81158. params["prjCoordSys"] = JSON.stringify(options.prjCoordSys);
  81159. }
  81160. if (options.layersID) {
  81161. params["layersID"] = options.layersID.toString();
  81162. }
  81163. if (options.clipRegionEnabled && options.clipRegion) {
  81164. options.clipRegion = ServerGeometry.fromGeometry(Util_toSuperMapGeometry(options.clipRegion));
  81165. params["clipRegionEnabled"] = options.clipRegionEnabled;
  81166. params["clipRegion"] = JSON.stringify(options.clipRegion);
  81167. }
  81168. //切片的起始参考点,默认为地图范围的左上角。
  81169. var crs = me._crs;
  81170. if (crs.options && crs.options.origin) {
  81171. params["origin"] = JSON.stringify({
  81172. x: crs.options.origin[0],
  81173. y: crs.options.origin[1]
  81174. });
  81175. } else if (crs.projection && crs.projection.bounds) {
  81176. var bounds = crs.projection.bounds;
  81177. var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
  81178. params["origin"] = JSON.stringify({
  81179. x: tileOrigin.x,
  81180. y: tileOrigin.y
  81181. });
  81182. }
  81183. if (options.overlapDisplayed === false) {
  81184. params["overlapDisplayed"] = false;
  81185. if (options.overlapDisplayedOptions) {
  81186. params["overlapDisplayedOptions"] = options.overlapDisplayedOptions;
  81187. }
  81188. } else {
  81189. params["overlapDisplayed"] = true;
  81190. }
  81191. if (params.cacheEnabled === true && options.tileversion) {
  81192. params["tileversion"] = options.tileversion.toString();
  81193. }
  81194. if (options.rasterfunction) {
  81195. params["rasterfunction"] = JSON.stringify(options.rasterfunction);
  81196. }
  81197. return params;
  81198. }
  81199. });
  81200. var tiledMapLayer = function (url, options) {
  81201. return new TiledMapLayer(url, options);
  81202. };
  81203. // EXTERNAL MODULE: ./node_modules/jsonsql/index.js
  81204. var jsonsql = __webpack_require__(545);
  81205. var jsonsql_default = /*#__PURE__*/__webpack_require__.n(jsonsql);
  81206. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoDefaultStyle.js
  81207. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81208. * This program are made available under the terms of the Apache License, Version 2.0
  81209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81210. /**
  81211. * @constant DefaultStyle
  81212. * @description 这个 style 对应的是默认设置。
  81213. * @category BaseTypes Style
  81214. * @private
  81215. */
  81216. var DefaultStyle = {
  81217. /**
  81218. * @constant DefaultStyle.prototype.TEXT
  81219. * @description 默认文本样式。
  81220. */
  81221. "TEXT": {
  81222. fontSize: "14px",
  81223. fontFamily: "Arial Unicode MS Regular,Microsoft YaHei",
  81224. textAlign: "left",
  81225. color: "rgba(255,255,255,0)",
  81226. fillColor: "rgba(80,80,80,1)",
  81227. weight: 1,
  81228. globalAlpha: 1
  81229. },
  81230. /**
  81231. * @constant DefaultStyle.prototype.POINT
  81232. * @description 默认点样式。
  81233. */
  81234. "POINT": {
  81235. fillColor: "#ffcc00",
  81236. color: "#cc3333",
  81237. weight: 1,
  81238. radius: 3,
  81239. opacity: 1
  81240. },
  81241. /**
  81242. * @constant DefaultStyle.prototype.LINE
  81243. * @description 默认线样式。
  81244. */
  81245. "LINE": {
  81246. color: "rgba(0,0,0,0)",
  81247. weight: 1,
  81248. lineCap: "butt",
  81249. lineJoin: "round",
  81250. dashOffset: 0,
  81251. dashArray: [],
  81252. opacity: 1
  81253. },
  81254. /**
  81255. * @constant DefaultStyle.prototype.REGION
  81256. * @description 默认多边形样式。
  81257. */
  81258. "REGION": {
  81259. color: "rgba(0,0,0,0)",
  81260. fillColor: "rgba(0,0,0,0)",
  81261. weight: 1,
  81262. lineCap: "butt",
  81263. lineJoin: "round",
  81264. dashOffset: 0,
  81265. opacity: 1,
  81266. fillOpacity: 1,
  81267. dashArray: []
  81268. }
  81269. };
  81270. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoStyleMap.js
  81271. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81272. * This program are made available under the terms of the Apache License, Version 2.0
  81273. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81274. /**
  81275. * @constant CartoStyleMap
  81276. * @description CartoCSS 中的 style 属性名与 leaflet 的 style 属性名的对应表。
  81277. * @category BaseTypes Style
  81278. * @private
  81279. */
  81280. var CartoStyleMap = {
  81281. /*
  81282. * @constant CartoStyleMap.prototype.TEXT
  81283. * @description 默认文本样式。
  81284. */
  81285. "TEXT": {
  81286. "text-size": "fontSize",
  81287. "text-face-name": "fontFamily",
  81288. "text-align": "textAlign",
  81289. "text-name": "textName",
  81290. 'text-weight': 'fontWeight',
  81291. "text-halo-color": "color",
  81292. "text-fill": "fillColor",
  81293. "text-comp-op": "globalCompositeOperation"
  81294. },
  81295. /*
  81296. * @constant CartoStyleMap.prototype.POINT
  81297. * @description 默认点样式。
  81298. */
  81299. "POINT": {
  81300. "point-file": "iconUrl",
  81301. "point-fill": "fillColor",
  81302. "point-radius": "radius",
  81303. "point-halo-color": "color",
  81304. "point-comp-op": "globalCompositeOperation"
  81305. },
  81306. /*
  81307. * @constant CartoStyleMap.prototype.LINE
  81308. * @description 默认线样式。
  81309. */
  81310. "LINE": {
  81311. "line-color": "color",
  81312. "line-width": "weight",
  81313. "line-cap": "lineCap",
  81314. "line-join": "lineJoin",
  81315. "line-dash-offset": "dashOffset",
  81316. "line-opacity": "opacity",
  81317. "line-dasharray": "dashArray",
  81318. "line-comp-op": "globalCompositeOperation"
  81319. },
  81320. /*
  81321. * @constant CartoStyleMap.prototype.REGION
  81322. * @description 默认多边形样式。
  81323. */
  81324. "REGION": {
  81325. "line-color": "color",
  81326. "line-width": "weight",
  81327. "line-cap": "lineCap",
  81328. "line-join": "lineJoin",
  81329. "line-dash-offset": "dashOffset",
  81330. "line-opacity": "opacity",
  81331. "line-dasharray": "dashArray",
  81332. "polygon-fill": "fillColor",
  81333. "polygon-opacity": "fillOpacity",
  81334. "polygon-comp-op": "globalCompositeOperation"
  81335. }
  81336. };
  81337. /**
  81338. * @constant ServerStyleMap
  81339. * @description 服务端传过来的 style 属性名与 leaflet 的 style 属性名的对应表。
  81340. * @private
  81341. */
  81342. var ServerStyleMap = {
  81343. /**
  81344. * @member ServerStyleMap.prototype.lineWidth
  81345. * @description 线宽。
  81346. */
  81347. lineWidth: {
  81348. leafletStyle: "weight",
  81349. type: "number",
  81350. unit: "mm",
  81351. defaultValue: 0.1
  81352. },
  81353. /**
  81354. * @member ServerStyleMap.prototype.fillForeColor
  81355. * @description 填充前景色。
  81356. */
  81357. fillForeColor: {
  81358. leafletStyle: "fillColor",
  81359. type: "color",
  81360. defaultValue: "rgba(0,0,0,0)"
  81361. },
  81362. /**
  81363. * @member ServerStyleMap.prototype.foreColor
  81364. * @description 前景色。
  81365. */
  81366. foreColor: {
  81367. leafletStyle: "color",
  81368. type: "color",
  81369. defaultValue: "rgba(0,0,0,0)"
  81370. },
  81371. /**
  81372. * @member ServerStyleMap.prototype.markerSize
  81373. * @description 图标大小。
  81374. */
  81375. markerSize: {
  81376. leafletStyle: "markerSize",
  81377. type: "number",
  81378. unit: "mm",
  81379. defaultValue: 2.4
  81380. },
  81381. /**
  81382. * @member ServerStyleMap.prototype.lineColor
  81383. * @description 线要素颜色。
  81384. */
  81385. lineColor: {
  81386. leafletStyle: "color",
  81387. type: "color",
  81388. defaultValue: "#000000"
  81389. }
  81390. };
  81391. /**
  81392. * @constant CompOpMap
  81393. * @description Canvas 中的 globalCompositeOperation 属性值与 CartoCSS 中的 CompOp 属性值对照表。
  81394. * @private
  81395. */
  81396. var CompOpMap = {
  81397. "clear": "",
  81398. "src": "",
  81399. "dst": "",
  81400. "src-over": "source-over",
  81401. "dst-over": "destination-over",
  81402. "src-in": "source-in",
  81403. "dst-in": "destination-in",
  81404. "src-out": "source-out",
  81405. "dst-out": "destination-out",
  81406. "src-atop": "source-atop",
  81407. "dst-atop": "destination-atop",
  81408. "xor": "xor",
  81409. "plus": "lighter",
  81410. "minus": "",
  81411. "multiply": "",
  81412. "screen": "",
  81413. "overlay": "",
  81414. "darken": "",
  81415. "lighten": "lighter",
  81416. "color-dodge": "",
  81417. "color-burn": "",
  81418. "hard-light": "",
  81419. "soft-light": "",
  81420. "difference": "",
  81421. "exclusion": "",
  81422. "contrast": "",
  81423. "invert": "",
  81424. "invert-rgb": "",
  81425. "grain-merge": "",
  81426. "grain-extract": "",
  81427. "hue": "",
  81428. "saturation": "",
  81429. "color": "",
  81430. "value": ""
  81431. };
  81432. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoCSSToLeaflet.js
  81433. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81434. * This program are made available under the terms of the Apache License, Version 2.0
  81435. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81436. /**
  81437. * @class CartoCSSToLeaflet
  81438. * @classdesc CartoCSS 样式转 Leaflet 样式类。
  81439. * @category BaseTypes Style
  81440. * @param {string} url - 服务地址。
  81441. * @private
  81442. */
  81443. class CartoCSSToLeaflet {
  81444. constructor(url) {
  81445. /**
  81446. * @member CartoCSSToLeaflet.prototype.cartoCSS
  81447. * @description CartoCSS 样式。
  81448. */
  81449. this.cartoCSS = null;
  81450. /**
  81451. * @member CartoCSSToLeaflet.prototype.mapUrl
  81452. * @description 地图服务地址。
  81453. */
  81454. this.mapUrl = url;
  81455. }
  81456. /**
  81457. * @function CartoCSSToLeaflet.prototype.pretreatedCartoCSS
  81458. * @description CartoCSS 样式预处理。
  81459. * @param {string} cartoStr - Carto 信息。
  81460. * @param {Object} processCharacters - 需要处理的特征对象。
  81461. */
  81462. pretreatedCartoCSS(cartoStr, processCharacters) {
  81463. if (processCharacters) {
  81464. cartoStr = this.processCharacters(cartoStr);
  81465. }
  81466. this.cartoCSS = this.cartoCSS || {};
  81467. var shaders = new CartoCSS(cartoStr).getShaders();
  81468. if (!shaders) {
  81469. return;
  81470. }
  81471. for (var i = 0; i < shaders.length; i++) {
  81472. var element = shaders[i].elements[0];
  81473. var attachment = shaders[i].attachment;
  81474. this.cartoCSS[element.clean] = this.cartoCSS[element.clean] || {};
  81475. this.cartoCSS[element.clean][attachment] = this.cartoCSS[element.clean][attachment] || [];
  81476. this.cartoCSS[element.clean][attachment].push(shaders[i]);
  81477. }
  81478. }
  81479. /**
  81480. * @function CartoCSSToLeaflet.prototype.processCharacters
  81481. * @description 替换一些关键符号。
  81482. * @param {string} cartoCSSStr - cartoCSSS 信息。
  81483. */
  81484. processCharacters(cartoCSSStr) {
  81485. var style = cartoCSSStr;
  81486. if (!style) {
  81487. return;
  81488. }
  81489. var me = this;
  81490. style = style.replace(/[@]/gi, "___");
  81491. style = style.replace(/\\#/gi, "\#");
  81492. var cachedLayer = {};
  81493. me.layersInfo && Object.keys(me.layersInfo).sort().forEach(function (attr) {
  81494. var newAttr = attr.replace(/[@#\s]/gi, "___");
  81495. var to = attr;
  81496. var keys = Object.keys(cachedLayer);
  81497. for (let index = keys.length; index > -1; index--) {
  81498. if (attr.indexOf(keys[index]) > -1) {
  81499. to = attr.replace(keys[index], cachedLayer[keys[index]]);
  81500. break;
  81501. }
  81502. }
  81503. to = to.replace(/[#]/gi, "\#");
  81504. cachedLayer[attr] = newAttr;
  81505. style = style.replace(new RegExp(to, "g"), newAttr);
  81506. })
  81507. style = style.replace(/[#]/gi, "\n#");
  81508. //将zoom转化为scale,以免引起混淆
  81509. style = style.replace(/\[zoom/gi, "[scale");
  81510. return style;
  81511. }
  81512. /**
  81513. * @function CartoCSSToLeaflet.prototype.pickShader
  81514. * @description 拾取着色对象。
  81515. * @param {string} layerName - 图层名称。
  81516. */
  81517. pickShader(layerName) {
  81518. if (!this.cartoCSS) {
  81519. return null;
  81520. }
  81521. var name = layerName.replace(/[@#\s]/gi, "___");
  81522. return this.cartoCSS[name];
  81523. }
  81524. /**
  81525. * @function CartoCSSToLeaflet.prototype.getDefaultStyle
  81526. * @description 获取默认风格。
  81527. * @param {string} type - 默认风格类型。
  81528. */
  81529. getDefaultStyle(type) {
  81530. var style = {};
  81531. //设置默认值
  81532. var expandStyle = DefaultStyle[type];
  81533. for (var prop in expandStyle) {
  81534. var val = expandStyle[prop];
  81535. style[prop] = val;
  81536. }
  81537. return style;
  81538. }
  81539. /**
  81540. * @function CartoCSSToLeaflet.prototype.getStyleFromiPortalMarker
  81541. * @description 从 iPortalMarker 中获取样式。
  81542. * @param {string} icon - iPortal 图标。
  81543. */
  81544. getStyleFromiPortalMarker(icon) {
  81545. if (icon.indexOf("./") == 0) {
  81546. return null;
  81547. }
  81548. //兼容iportal示例的问题
  81549. // if (icon.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  81550. // icon = icon.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  81551. // }
  81552. return external_L_default().icon({
  81553. iconUrl: icon,
  81554. iconSize: external_L_default().point(48, 43),
  81555. iconAnchor: external_L_default().point(24, 43),
  81556. popupAnchor: external_L_default().point(0, -43)
  81557. });
  81558. }
  81559. /**
  81560. * @function CartoCSSToLeaflet.prototype.getStyleFromiPortalStyle
  81561. * @description 从 iPortal 的风格中获取样式。
  81562. * @param {Object} iPortalStyle - iPortal 的样式对象。
  81563. * @param {string} type - 样式类型。
  81564. * @param {Object} [fStyle] - 图标参数。
  81565. */
  81566. getStyleFromiPortalStyle(iPortalStyle, type, fStyle) {
  81567. var featureStyle = fStyle ? JSON.parse(fStyle) : null;
  81568. var style = {};
  81569. if (type === 'Point' || type === 'MultiPoint') {
  81570. var pointStyle = featureStyle || iPortalStyle.pointStyle;
  81571. if (pointStyle.externalGraphic) {
  81572. if (pointStyle.externalGraphic.indexOf("./") == 0) {
  81573. return null;
  81574. }
  81575. //兼容iportal示例的问题
  81576. // if (pointStyle.externalGraphic.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  81577. // pointStyle.externalGraphic = pointStyle.externalGraphic.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  81578. // }
  81579. return external_L_default().icon({
  81580. iconUrl: pointStyle.externalGraphic,
  81581. iconSize: external_L_default().point(pointStyle.graphicWidth, pointStyle.graphicHeight),
  81582. iconAnchor: external_L_default().point(-pointStyle.graphicXOffset, -pointStyle.graphicYOffset),
  81583. popupAnchor: external_L_default().point(0, -pointStyle.graphicHeight)
  81584. });
  81585. }
  81586. style.radius = pointStyle.pointRadius;
  81587. style.color = pointStyle.strokeColor;
  81588. style.opacity = pointStyle.strokeOpacity;
  81589. style.lineCap = pointStyle.strokeLineCap;
  81590. style.weight = pointStyle.strokeWidth;
  81591. style.fillColor = pointStyle.fillColor;
  81592. style.fillOpacity = pointStyle.fillOpacity;
  81593. style.dashArray = this.dashStyle(pointStyle, 1);
  81594. return style;
  81595. }
  81596. if (type === 'LineString' || type === 'MultiLineString' || type === 'Box') {
  81597. var lineStyle = featureStyle || iPortalStyle.lineStyle;
  81598. style.color = lineStyle.strokeColor;
  81599. style.opacity = lineStyle.strokeOpacity;
  81600. style.fillOpacity = lineStyle.fillOpacity;
  81601. style.lineCap = lineStyle.strokeLineCap;
  81602. style.weight = lineStyle.strokeWidth;
  81603. style.dashArray = this.dashStyle(lineStyle, 1);
  81604. return style;
  81605. }
  81606. if (type === 'Polygon' || type === 'MultiPolygon') {
  81607. var polygonStyle = featureStyle || iPortalStyle.polygonStyle;
  81608. style.color = polygonStyle.strokeColor;
  81609. style.opacity = polygonStyle.strokeOpacity;
  81610. style.lineCap = polygonStyle.strokeLineCap;
  81611. style.weight = polygonStyle.strokeWidth;
  81612. style.fillColor = polygonStyle.fillColor;
  81613. style.fillOpacity = polygonStyle.fillOpacity;
  81614. style.dashArray = this.dashStyle(polygonStyle, 1);
  81615. return style;
  81616. }
  81617. }
  81618. /**
  81619. * @function CartoCSSToLeaflet.prototype.dashStyle
  81620. * @description 符号样式。
  81621. * @param {Object} style - 样式参数。
  81622. * @param {number} widthFactor - 宽度系数。
  81623. */
  81624. dashStyle(style, widthFactor) {
  81625. if (!style) {
  81626. return [];
  81627. }
  81628. var w = style.strokeWidth * widthFactor;
  81629. var str = style.strokeDashstyle;
  81630. switch (str) {
  81631. case 'solid':
  81632. return [];
  81633. case 'dot':
  81634. return [1, 4 * w];
  81635. case 'dash':
  81636. return [4 * w, 4 * w];
  81637. case 'dashdot':
  81638. return [4 * w, 4 * w, 1, 4 * w];
  81639. case 'longdash':
  81640. return [8 * w, 4 * w];
  81641. case 'longdashdot':
  81642. return [8 * w, 4 * w, 1, 4 * w];
  81643. default:
  81644. if (!str) {
  81645. return [];
  81646. }
  81647. if (Util_Util.isArray(str)) {
  81648. return str;
  81649. }
  81650. str = StringExt.trim(str).replace(/\s+/g, ",");
  81651. return str.replace(/\[|\]/gi, "").split(",");
  81652. }
  81653. }
  81654. /**
  81655. * @function CartoCSSToLeaflet.prototype.getValidStyleFromCarto
  81656. * @description 从 Carto 中获取有效的样式。
  81657. * @param {number} zoom - 缩放级别。
  81658. * @param {number} scale - 比例尺。
  81659. * @param {Array.<Object>} shader - 渲染器对象数组。
  81660. * @param {Object} feature - 要素。
  81661. * @param {string} [fromServer] - 服务源。
  81662. */
  81663. getValidStyleFromCarto(zoom, scale, shader, feature, fromServer) {
  81664. if (!shader) {
  81665. return null;
  81666. }
  81667. var type = feature.type,
  81668. attributes = feature.properties.attributes || {},
  81669. style = this.getDefaultStyle(type);
  81670. fromServer = (fromServer === undefined) ? true : fromServer;
  81671. attributes.FEATUREID = feature.properties.id;
  81672. attributes.SCALE = scale;
  81673. var cartoStyleMap = CartoStyleMap[type];
  81674. var fontSize, fontName;
  81675. for (var i = 0, len = shader.length; i < len; i++) {
  81676. var _shader = shader[i];
  81677. var prop = cartoStyleMap[_shader.property];
  81678. var value = _shader.getValue(attributes, zoom, true);
  81679. if ((value !== null) && prop) {
  81680. if (prop === "fontSize") {
  81681. if (fromServer) {
  81682. value *= 0.8
  81683. }
  81684. fontSize = value + "px";
  81685. style.fontSize = fontSize;
  81686. } else if (prop === "fontName") {
  81687. fontName = value;
  81688. style.fontName = fontName;
  81689. } else {
  81690. if (prop === "globalCompositeOperation") {
  81691. value = CompOpMap[value];
  81692. if (!value) {
  81693. continue;
  81694. }
  81695. } else if (fromServer && prop === 'iconUrl') {
  81696. value = this.mapUrl + '/tileFeature/symbols/' + value.replace(/(___)/gi, '@');
  81697. value = value.replace(/(__0__0__)/gi, '__8__8__');
  81698. style["iconUrl"] = value;
  81699. continue;
  81700. }
  81701. if (prop === 'weight' && value < 1) {
  81702. value = Math.ceil(value);
  81703. }
  81704. style[prop] = value;
  81705. }
  81706. }
  81707. }
  81708. return style;
  81709. }
  81710. /**
  81711. * @function CartoCSSToLeaflet.prototype.getValidStyleFromLayerInfo
  81712. * @description 通过图层信息获取有效的样式。
  81713. * @param {Feature} feature - 要素。
  81714. * @param {Object} layerInfo - 图层信息。
  81715. */
  81716. getValidStyleFromLayerInfo(feature, layerInfo) {
  81717. var type = feature.type,
  81718. style = this.getDefaultStyle(type),
  81719. shader = layerInfo && layerInfo.layerStyle;
  81720. if (!shader) {
  81721. return style;
  81722. }
  81723. if (type === "POINT") {
  81724. var size = Math.ceil(shader.markerSize * DOTS_PER_INCH * INCHES_PER_UNIT["mm"]) || 8;
  81725. var symbolParameters = {
  81726. "transparent": true,
  81727. "resourceType": "SYMBOLMARKER",
  81728. "picWidth": size,
  81729. "picHeight": size,
  81730. "style": JSON.stringify(shader)
  81731. };
  81732. style.iconUrl = Util_Util.urlAppend(this.mapUrl + "/symbol.png", Util_Util.getParameterString(symbolParameters));
  81733. style.iconSize = [size, size];
  81734. return style;
  81735. }
  81736. if (type === "TEXT") {
  81737. shader = feature.properties.textStyle || layerInfo.layerStyle;
  81738. //设置文本是否使用粗体
  81739. style.fontWeight = shader.bold ? shader.fontWeight : "normal";
  81740. //设置文本的尺寸(对应fontHeight属性)和行高,行高iserver不支持,默认5像素
  81741. //固定大小的时候单位是毫米
  81742. if (shader.fontHeight) {
  81743. var text_h = shader.fontHeight * DOTS_PER_INCH * INCHES_PER_UNIT["mm"] * 0.85; //毫米转像素,服务端的字体貌似要稍微小一点
  81744. style.fontSize = text_h + "px";
  81745. style.textHeight = text_h;
  81746. }
  81747. //设置文本字体类型
  81748. //在桌面字体钱加@时为了解决对联那种形式,但是在canvas不支持,并且添加了@会导致
  81749. //字体大小被固定,这里需要去掉
  81750. if (shader.fontName) {
  81751. style.fontFamily = (shader.fontName.indexOf("@")) ?
  81752. shader.fontName.replace(/@/g, "") : shader.fontName;
  81753. }
  81754. //设置对齐方式
  81755. if (shader.align) {
  81756. var alignStr = shader.align.replace(/TOP|MIDDLE|BASELINE|BOTTOM/, "");
  81757. style.textAlign = alignStr.toLowerCase();
  81758. }
  81759. style.weight = shader.outline ? shader.outlineWidth : 0;
  81760. if (shader.backColor) {
  81761. style.color = "rgba(" + shader.backColor.red + "," +
  81762. shader.backColor.green + "," +
  81763. shader.backColor.blue +
  81764. ",1)";
  81765. }
  81766. if (shader.foreColor) {
  81767. style.fillColor = "rgba(" + shader.foreColor.red + "," +
  81768. shader.foreColor.green + "," +
  81769. shader.foreColor.blue +
  81770. ",1)";
  81771. }
  81772. style.rotation = shader.rotation || 0;
  81773. return style;
  81774. }
  81775. //目前只实现桌面系统默认的几种symbolID,非系统默认的面用颜色填充替代,线则用实线来替代
  81776. var fillSymbolID = shader["fillSymbolID"] > 7 ? 0 : shader["fillSymbolID"];
  81777. var lineSymbolID = shader["lineSymbolID"] > 5 ? 0 : shader["lineSymbolID"];
  81778. for (var attr in shader) {
  81779. var obj = ServerStyleMap[attr];
  81780. if (!obj) {
  81781. continue;
  81782. }
  81783. var leafletStyle = obj.leafletStyle;
  81784. switch (obj.type) {
  81785. case "number":
  81786. {
  81787. let value = shader[attr];
  81788. if (obj.unit) {
  81789. value = value * DOTS_PER_INCH * INCHES_PER_UNIT[obj.unit] * 2.5;
  81790. }
  81791. style[leafletStyle] = value;
  81792. break;
  81793. }
  81794. case "color":
  81795. {
  81796. var color = shader[attr];
  81797. let value, alpha = 1;
  81798. if (leafletStyle === "fillColor") {
  81799. if (fillSymbolID === 0 || fillSymbolID === 1) {
  81800. //当fillSymbolID为0时,用颜色填充,为1是无填充,即为透明填充,alpha通道为0
  81801. alpha = 1 - fillSymbolID;
  81802. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  81803. }
  81804. } else if (leafletStyle === "color") {
  81805. if (lineSymbolID === 0 || lineSymbolID === 5) {
  81806. //对于lineSymbolID为0时,线为实线,为lineSymbolID为5时,为无线模式,即线为透明,即alpha通道为0
  81807. alpha = lineSymbolID === 0 ? 1 : 0;
  81808. } else {
  81809. //以下几种linePattern分别模拟了桌面的SymbolID为1~4几种符号的linePattern
  81810. var linePattern = [1, 0];
  81811. switch (lineSymbolID) {
  81812. case 1:
  81813. linePattern = [9.7, 3.7];
  81814. break;
  81815. case 2:
  81816. linePattern = [3.7, 3.7];
  81817. break;
  81818. case 3:
  81819. linePattern = [9.7, 3.7, 2.3, 3.7];
  81820. break;
  81821. case 4:
  81822. linePattern = [9.7, 3.7, 2.3, 3.7, 2.3, 3.7];
  81823. break;
  81824. default:
  81825. break
  81826. }
  81827. style.lineDasharray = linePattern;
  81828. }
  81829. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  81830. }
  81831. style[leafletStyle] = value;
  81832. break;
  81833. }
  81834. default:
  81835. break;
  81836. }
  81837. }
  81838. //处理标签文本的情况
  81839. if (layerInfo.textField) {
  81840. style.textAlign = "LEFT";
  81841. }
  81842. return style;
  81843. }
  81844. }
  81845. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/Graphic.js
  81846. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81847. * This program are made available under the terms of the Apache License, Version 2.0
  81848. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81849. /**
  81850. * @class Graphic
  81851. * @deprecatedclassinstance L.supermap.graphic
  81852. * @classdesc 高效率点图层要素类。
  81853. * @category Visualization Graphic
  81854. * @extends {L.Class}
  81855. * @param {Object} options - 参数。
  81856. * @param {L.LatLng} options.latLng - 经纬度。
  81857. * @param {number} options.id - 要素ID。
  81858. * @param {(CircleStyle|CloverStyle|ImageStyle)} [options.style] - 点样式。
  81859. * @param {Object} [options.attributes] - 要素属性。
  81860. * @usage
  81861. */
  81862. var Graphic = external_L_default().Class.extend({
  81863. initialize: function (options) {
  81864. options = options || {};
  81865. var latLng = options.latLng || options._latLng;
  81866. this._latLng = external_L_default().latLng(latLng.lat, latLng.lng);
  81867. this._style = options.style || options._canvas;
  81868. this.attributes = options.attributes;
  81869. this.id = options.id ? options.id : null;
  81870. },
  81871. /**
  81872. * @function Graphic.prototype.getId
  81873. * @description 获取当前要素 ID。
  81874. * @returns {string} 要素 ID。
  81875. */
  81876. getId() {
  81877. return this.id;
  81878. },
  81879. /**
  81880. * @function Graphic.prototype.setId
  81881. * @description 设置当前要素 ID。
  81882. * @param {string} id - 要素 ID。
  81883. */
  81884. setId(id) {
  81885. this.id = id;
  81886. },
  81887. /**
  81888. * @function Graphic.prototype.setLatLng
  81889. * @description 设置经纬度。
  81890. * @param {L.LatLng} latLng - 经纬度参数。
  81891. */
  81892. setLatLng: function (latLng) {
  81893. this._latLng = latLng;
  81894. },
  81895. /**
  81896. * @deprecated
  81897. * @function Graphic.prototype.setCanvas
  81898. * @description 设置画布,已弃用该设置,请使用 setStyle 接口。
  81899. * @param {HTMLCanvasElement} canvas - 传入需要设置的画布。
  81900. */
  81901. setCanvas: function (canvas) {
  81902. this._style = canvas;
  81903. },
  81904. /**
  81905. * @function Graphic.prototype.setAttributes
  81906. * @description 设置要素属性。
  81907. * @param {Object} attributes - 属性对象。
  81908. */
  81909. setAttributes: function (attributes) {
  81910. this.attributes = attributes;
  81911. },
  81912. /**
  81913. * @function Graphic.prototype.getLatLng
  81914. * @description 获取经纬度。
  81915. * @returns {L.LatLng} 经纬度。
  81916. */
  81917. getLatLng: function () {
  81918. return this._latLng;
  81919. },
  81920. /**
  81921. * @deprecated
  81922. * @function Graphic.prototype.getCanvas
  81923. * @description 获取画布,已弃用该设置,请使用 getStyle 接口。
  81924. * @returns {HTMLCanvasElement} 画布。
  81925. */
  81926. getCanvas: function () {
  81927. return this._style;
  81928. },
  81929. /**
  81930. * @function Graphic.prototype.getAttributes
  81931. * @description 获取要素属性。
  81932. * @returns {Object} 要素属性。
  81933. */
  81934. getAttributes: function () {
  81935. return this.attributes;
  81936. },
  81937. /**
  81938. * @function Graphic.prototype.setStyle
  81939. * @description 设置样式。
  81940. * @param {(CircleStyle|ImageStyle|CloverStyle)} style - 样式。
  81941. */
  81942. setStyle: function (style) {
  81943. this._style = style;
  81944. },
  81945. /**
  81946. * @function Graphic.prototype.getStyle
  81947. * @description 获取样式。
  81948. * @returns {(CircleStyle|ImageStyle|CloverStyle)} 样式。
  81949. */
  81950. getStyle: function () {
  81951. return this._style;
  81952. }
  81953. });
  81954. var graphic = function (options) {
  81955. return new Graphic(options);
  81956. };
  81957. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeFeature.js
  81958. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81959. * This program are made available under the terms of the Apache License, Version 2.0
  81960. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81961. /**
  81962. * @class ThemeFeature
  81963. * @deprecatedclassinstance L.supermap.themeFeature
  81964. * @classdesc 客户端专题图要素类。
  81965. * 支持的 geometry 参数类型为 {@link L.Point},{@link L.LatLng},{@link L.Polyline},{@link L.Polygon}。
  81966. * @category Visualization Theme
  81967. * @extends {L.Class}
  81968. * @param {(L.Path|L.Point|L.LatLng)} geometry - 要素图形。
  81969. * @param {Object} attributes - 要素属性。
  81970. * @usage
  81971. */
  81972. var ThemeFeature = external_L_default().Class.extend({
  81973. initialize: function (geometry, attributes) {
  81974. this.geometry = geometry;
  81975. this.attributes = attributes;
  81976. },
  81977. /**
  81978. * @function ThemeFeature.prototype.toFeature
  81979. * @description 转为内部矢量要素。
  81980. * @returns {FeatureVector} 内部矢量要素。
  81981. */
  81982. toFeature: function () {
  81983. let geometry = this.geometry;
  81984. if (geometry.toGeoJSON) {
  81985. const geojsonObject = geometry.toGeoJSON();
  81986. geojsonObject.properties = this.attributes;
  81987. return new GeoJSON().read(geojsonObject)[0];
  81988. }
  81989. if (geometry.length === 3) {
  81990. geometry = new GeoText(geometry[1], geometry[0], geometry[2]);
  81991. } else if (geometry.length === 2) {
  81992. geometry = new Point(geometry[0], geometry[1]);
  81993. } else if (geometry instanceof (external_L_default()).LatLng) {
  81994. geometry = new Point(geometry.lng, geometry.lat);
  81995. } else if (geometry instanceof (external_L_default()).Point) {
  81996. geometry = new Point(geometry.x, geometry.y);
  81997. } else if (geometry instanceof (external_L_default()).CircleMarker) {
  81998. var latLng = geometry.getLatLng();
  81999. geometry = new Point(latLng.lng, latLng.lat);
  82000. }
  82001. return new Vector(geometry, this.attributes);
  82002. },
  82003. /**
  82004. * @function ThemeFeature.prototype.reverseLatLngs
  82005. * @description 坐标反转。
  82006. * @param {L.LatLng} latlngs - 坐标值。
  82007. */
  82008. reverseLatLngs: function (latlngs) {
  82009. if (!external_L_default().Util.isArray(latlngs)) {
  82010. latlngs = [latlngs];
  82011. }
  82012. for (var i = 0; i < latlngs.length; i++) {
  82013. latlngs[i] = [latlngs[i].lng, latlngs[i].lat];
  82014. }
  82015. return latlngs;
  82016. }
  82017. });
  82018. var themeFeature = function (geometry, attributes) {
  82019. return new ThemeFeature(geometry, attributes);
  82020. };
  82021. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeLayer.js
  82022. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82023. * This program are made available under the terms of the Apache License, Version 2.0
  82024. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82025. /**
  82026. * @class ThemeLayer
  82027. * @classdesc 专题图层基类,调用建议使用其子类实现类。
  82028. * @category Visualization Theme
  82029. * @extends {L.Layer}
  82030. * @param {string} name - 专题图图层名称。
  82031. * @param {Object} options - 参数。
  82032. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  82033. * @param {number} [options.opacity=1] - 图层透明度。
  82034. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  82035. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  82036. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  82037. * @fires ThemeLayer#featuresremoved
  82038. * @usage
  82039. */
  82040. var ThemeLayer = external_L_default().Layer.extend({
  82041. options: {
  82042. //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
  82043. alwaysMapCRS: false,
  82044. id: Util_Util.createUniqueID("themeLayer_"),
  82045. opacity: 1,
  82046. // {Array} 专题要素事件临时存储,临时保存图层未添加到 map 前用户添加的事件监听,待图层添加到 map 后把这些事件监听添加到图层上,清空此图层。
  82047. //这是一个二维数组,组成二维数组的每个一维数组长度为 2,分别是 event, callback。
  82048. TFEvents: [],
  82049. attribution: core_Attributions.Common.attribution
  82050. },
  82051. initialize: function (name, options) {
  82052. external_L_default().Util.setOptions(this, options);
  82053. this.name = name;
  82054. this.features = [];
  82055. this.TFEvents = this.options.TFEvents;
  82056. this.levelRenderer = new LevelRenderer();
  82057. this.movingOffset = [0, 0];
  82058. },
  82059. /**
  82060. * @function ThemeLayer.prototype.getEvents
  82061. * @description 获取图层事件。
  82062. * @returns {Object} 返回图层事件。
  82063. */
  82064. getEvents: function () {
  82065. var me = this;
  82066. var events = {
  82067. zoomend: me._reset,
  82068. moveend: me._reset,
  82069. resize: me._resize
  82070. };
  82071. if (this._map._zoomAnimated) {
  82072. events.zoomanim = me._zoomAnim;
  82073. }
  82074. return events;
  82075. },
  82076. /**
  82077. * @function ThemeLayer.prototype.onRemove
  82078. * @description 删除某个地图。
  82079. * @param {L.Map} map - Leaflet Map 对象。
  82080. */
  82081. onRemove: function (map) {
  82082. var me = this;
  82083. external_L_default().DomUtil.remove(me.container);
  82084. map.off("mousemove", me.mouseMoveHandler);
  82085. },
  82086. /**
  82087. * @function ThemeLayer.prototype.onAdd
  82088. * @description 添加专题图。
  82089. * @param {L.Map} map - Leaflet Map 对象。
  82090. * @private
  82091. */
  82092. onAdd: function (map) {
  82093. var me = this;
  82094. me.map = me._map = map;
  82095. me._initContainer();
  82096. if (!me.levelRenderer) {
  82097. map.removeLayer(me);
  82098. return;
  82099. }
  82100. //初始化渲染器
  82101. var size = map.getSize();
  82102. me.container.style.width = size.x + "px";
  82103. me.container.style.height = size.y + "px";
  82104. me._updateOpacity();
  82105. me.renderer = me.levelRenderer.init(me.container);
  82106. me.renderer.clear();
  82107. if (me.features && me.features.length > 0) {
  82108. me._reset();
  82109. }
  82110. //处理用户预先(在图层添加到 map 前)监听的事件
  82111. me.addTFEvents();
  82112. me.mouseMoveHandler = function (e) {
  82113. var xy = e.layerPoint;
  82114. me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
  82115. };
  82116. map.on("mousemove", me.mouseMoveHandler);
  82117. me.update(map.getBounds());
  82118. },
  82119. /**
  82120. * @function L.supermap.ThemeLayer.prototype.addFeatures
  82121. * @description 向专题图图层中添加数据。
  82122. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加要素。
  82123. */
  82124. addFeatures: function (features) { // eslint-disable-line no-unused-vars
  82125. //子类实现此方法
  82126. },
  82127. /**
  82128. * @function ThemeLayer.prototype.redrawThematicFeatures
  82129. * @description 抽象方法,实例化子类前先执行此方法。
  82130. * @param {L.Bounds} bounds - 重绘专题要素范围。
  82131. */
  82132. redrawThematicFeatures: function (bounds) { // eslint-disable-line no-unused-vars
  82133. //子类必须实现此方法
  82134. },
  82135. /**
  82136. * @function ThemeLayer.prototype.destroyFeatures
  82137. * @description 销毁要素。
  82138. * @param {Array.<FeatureVector>|FeatureVector} features - 将被销毁的要素。
  82139. */
  82140. destroyFeatures: function (features) {
  82141. if (features === undefined) {
  82142. features = this.features;
  82143. }
  82144. if (!features) {
  82145. return;
  82146. }
  82147. this.removeFeatures(features);
  82148. if (!Array.isArray(features)) {
  82149. features = [features];
  82150. }
  82151. for (var i = features.length - 1; i >= 0; i--) {
  82152. features[i].destroy();
  82153. }
  82154. },
  82155. /**
  82156. * @function L.supermap.ThemeLayer.prototype.removeFeatures
  82157. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  82158. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 将被删除的要素或用来过滤的回调函数。
  82159. */
  82160. removeFeatures: function (features) {
  82161. var me = this;
  82162. if (!features) {
  82163. return;
  82164. }
  82165. if (features === me.features) {
  82166. return me.removeAllFeatures();
  82167. }
  82168. if (!external_L_default().Util.isArray(features) && !(typeof features === 'function')) {
  82169. features = [features];
  82170. }
  82171. var featuresFailRemoved = [];
  82172. for (var i = 0; i < me.features.length; i++) {
  82173. var feature = me.features[i];
  82174. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  82175. //并将其放入未删除的数组中。
  82176. if (features && typeof features === 'function') {
  82177. if (features(feature)) {
  82178. me.features.splice(i--, 1);
  82179. }
  82180. } else {
  82181. var findex = external_L_default().Util.indexOf(features, feature);
  82182. if (findex === -1) {
  82183. featuresFailRemoved.push(feature);
  82184. } else {
  82185. me.features.splice(i--, 1);
  82186. }
  82187. }
  82188. }
  82189. var drawFeatures = [];
  82190. for (var hex = 0, len = me.features.length; hex < len; hex++) {
  82191. feature = me.features[hex];
  82192. drawFeatures.push(feature);
  82193. }
  82194. me.features = [];
  82195. me.addFeatures(drawFeatures);
  82196. //绘制专题要素
  82197. if (me.renderer) {
  82198. if (me._map) {
  82199. me.redrawThematicFeatures(me._map.getBounds());
  82200. } else {
  82201. me.redrawThematicFeatures();
  82202. }
  82203. }
  82204. var succeed = featuresFailRemoved.length == 0;
  82205. /**
  82206. * @event ThemeLayer#featuresremoved
  82207. * @description 删除的要素成功之后触发。
  82208. * @property {Array.<FeatureVector>} features - 删除失败的要素数组。
  82209. * @property {boolean} succeed - 要输是否删除成功,true 为删除成功,false 为删除失败。
  82210. */
  82211. me.fire("featuresremoved", {
  82212. features: featuresFailRemoved,
  82213. succeed: succeed
  82214. });
  82215. },
  82216. /**
  82217. * @function ThemeLayer.prototype.removeAllFeatures
  82218. * @description 清除当前图层所有的矢量要素。
  82219. */
  82220. removeAllFeatures: function () {
  82221. var me = this;
  82222. if (me.renderer) {
  82223. me.renderer.clear();
  82224. }
  82225. me.features = [];
  82226. me.fire("featuresremoved", {
  82227. features: [],
  82228. succeed: true
  82229. });
  82230. },
  82231. /**
  82232. * @function ThemeLayer.prototype.getFeatures
  82233. * @description 查看当前图层中的有效数据。
  82234. * @param {Function} [filter] - 根据条件过滤要素的回调函数。
  82235. * @returns {Array.<FeatureVector>} 返回图层中的要素。
  82236. */
  82237. getFeatures: function (filter) {
  82238. var len = this.features.length;
  82239. var clonedFeatures = [];
  82240. for (var i = 0; i < len; ++i) {
  82241. if (!filter || (filter && typeof filter === 'function' && filter(this.features[i]))) {
  82242. clonedFeatures.push(this.features[i]);
  82243. }
  82244. }
  82245. return clonedFeatures;
  82246. },
  82247. /**
  82248. * @function L.supermap.ThemeLayer.prototype.getFeatureBy
  82249. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。
  82250. * @param {string} property - 要的某个属性名。
  82251. * @param {string} value - 对应属性名得值。
  82252. * @returns {Array.<FeatureVector>} 返回图层中的要素。
  82253. */
  82254. getFeatureBy: function (property, value) {
  82255. var me = this;
  82256. var feature = null;
  82257. for (var id in me.features) {
  82258. if (me.features[id][property] !== value) {
  82259. continue;
  82260. }
  82261. feature = me.features[id];
  82262. break;
  82263. }
  82264. return feature;
  82265. },
  82266. /**
  82267. * @function ThemeLayer.prototype.getFeatureById
  82268. * @description 返回指定 ID 的矢量要素,不存在则返回 null。
  82269. * @param {number} featureId - 要素 ID。
  82270. * @returns {Array.<FeatureVector>} 返回图层中的要素。
  82271. */
  82272. getFeatureById: function (featureId) {
  82273. return this.getFeatureBy('id', featureId);
  82274. },
  82275. /**
  82276. * @function L.supermap.ThemeLayer.prototype.getFeaturesByAttribute
  82277. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  82278. * @param {string} attrName - key 值。
  82279. * @param {string} attrValue - value 值。
  82280. * @returns {Array.<FeatureVector>} 返回所有匹配的要素数组。
  82281. */
  82282. getFeaturesByAttribute: function (attrName, attrValue) {
  82283. var me = this,
  82284. feature,
  82285. foundFeatures = [];
  82286. for (var id in me.features) {
  82287. feature = me.features[id];
  82288. if (feature && feature.attributes && (feature.attributes[attrName] === attrValue)) {
  82289. foundFeatures.push(feature);
  82290. }
  82291. }
  82292. return foundFeatures;
  82293. },
  82294. /**
  82295. * @function ThemeLayer.prototype.update
  82296. * @description 更新图层。
  82297. * @param {L.Bounds} bounds - 图层范围。
  82298. */
  82299. update: function (bounds) {
  82300. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  82301. external_L_default().DomUtil.setPosition(this.container, mapOffset);
  82302. var me = this;
  82303. // var bounds = me._map.getBounds();
  82304. // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
  82305. // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
  82306. // // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
  82307. // // offsetLeft = -Math.round(offsetLeft);
  82308. // //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
  82309. // //offsetTop = -Math.round(offsetTop);
  82310. // me.container.style.left = mapOffset[0] + 'px';
  82311. // me.container.style.top = mapOffset[1] + 'px';
  82312. //绘制专题要素
  82313. if (me.renderer) {
  82314. me.redrawThematicFeatures(bounds);
  82315. }
  82316. if (me.currentMousePosition) {
  82317. me.currentMousePosition = external_L_default().point(
  82318. me.currentMousePosition.x - me.movingOffset[0],
  82319. me.currentMousePosition.y - me.movingOffset[1]);
  82320. }
  82321. me.movingOffset = [0, 0];
  82322. me._zoom = me._map.getZoom();
  82323. me._center = me._map.getCenter();
  82324. },
  82325. /**
  82326. * @function ThemeLayer.prototype.setOpacity
  82327. * @description 设置图层的不透明度,取值 [0-1] 之间。
  82328. * @param {number} opacity - 不透明度。
  82329. */
  82330. setOpacity: function (opacity) {
  82331. var me = this;
  82332. if (opacity === me.options.opacity) {
  82333. return;
  82334. }
  82335. if (!isNaN(opacity)) {
  82336. me.options.opacity = opacity;
  82337. me._updateOpacity();
  82338. }
  82339. },
  82340. /**
  82341. * @function ThemeLayer.prototype.redraw
  82342. * @description 重绘该图层。
  82343. * @returns {boolean} 返回是否重绘成功。
  82344. */
  82345. redraw: function () {
  82346. var me = this;
  82347. if (!me.renderer) {
  82348. return false;
  82349. }
  82350. if (me._map) {
  82351. me.redrawThematicFeatures(me._map.getBounds());
  82352. } else {
  82353. me.redrawThematicFeatures();
  82354. }
  82355. return true;
  82356. },
  82357. /**
  82358. * @function ThemeLayer.prototype.on
  82359. * @description 监听事件。监听专题要素事件。
  82360. * @param {Event} event - 监听事件。
  82361. * @param {function} callback - 回调函数。
  82362. * @param {string} context - 信息。
  82363. */
  82364. on: function (event, callback, context) { // eslint-disable-line no-unused-vars
  82365. if (this.renderer) {
  82366. this.renderer.on(event, callback);
  82367. } else {
  82368. external_L_default().Layer.prototype.on.call(this, event, callback);
  82369. }
  82370. return this;
  82371. },
  82372. /**
  82373. * @function ThemeLayer.prototype.off
  82374. * @description 移除事件监听。
  82375. * @param {Event} event - 监听事件。
  82376. * @param {function} callback - 回调函数。
  82377. * @param {string} context - 信息。
  82378. */
  82379. off: function (event, callback, context) { // eslint-disable-line no-unused-vars
  82380. var me = this;
  82381. if (me.renderer) {
  82382. me.renderer.un(event, callback);
  82383. } else {
  82384. external_L_default().Layer.prototype.off.call(this, event, callback);
  82385. }
  82386. return this;
  82387. },
  82388. fire: function (type, data, propagate) { // eslint-disable-line no-unused-vars
  82389. if (this.renderer) {
  82390. this.renderer.trigger(type, data);
  82391. }
  82392. external_L_default().Layer.prototype.fire.call(this, type, data, propagate);
  82393. return this;
  82394. },
  82395. /**
  82396. * @function ThemeLayer.prototype.addTFEvents
  82397. * @description 先把事件监听添加到图层,再把图层添加到地图。
  82398. * @private
  82399. */
  82400. addTFEvents: function () {
  82401. var me = this;
  82402. var tfEs = me.TFEvents;
  82403. var len = tfEs.length;
  82404. for (var i = 0; i < len; i++) {
  82405. me.renderer.on(tfEs[i][0], tfEs[i][1]);
  82406. }
  82407. },
  82408. /**
  82409. * @function ThemeLayer.prototype.getLocalXY
  82410. * @description 地理坐标转为像素坐标。
  82411. * @param {Array} coordinate
  82412. */
  82413. getLocalXY: function (coordinate) {
  82414. if (!this._map) {
  82415. return coordinate;
  82416. }
  82417. var coor = coordinate;
  82418. if (external_L_default().Util.isArray(coordinate)) {
  82419. coor = external_L_default().point(coordinate[0], coordinate[1]);
  82420. }
  82421. if (!(coordinate instanceof (external_L_default()).Point)) {
  82422. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  82423. coor = external_L_default().point(coordinate.x, coordinate.y);
  82424. } else {
  82425. coor = external_L_default().point(coordinate.lon, coordinate.lat);
  82426. }
  82427. }
  82428. var point = this._map.latLngToAccurateContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
  82429. return [point.x, point.y];
  82430. },
  82431. /**
  82432. * @function ThemeLayer.prototype.toiClientFeature
  82433. * @description 转为 iClient 要素。
  82434. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
  82435. * @returns {Array.<FeatureVector>} 转换后的 iClient 要素。
  82436. */
  82437. toiClientFeature: function (features) {
  82438. //若 features 非数组形式 feature 则先做以下处理:
  82439. if (!Util_Util.isArray(features)) {
  82440. features = [features];
  82441. }
  82442. let featuresTemp = [];
  82443. for (let i = 0; i < features.length; i++) {
  82444. //themeFeature 数据类型
  82445. if (features[i] instanceof ThemeFeature) {
  82446. featuresTemp.push(features[i].toFeature());
  82447. } else if (features[i] instanceof Vector) {
  82448. // 若是 FeatureVector 类型直接返回
  82449. featuresTemp.push(features[i]);
  82450. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  82451. //GeoJSON 规范数据类型
  82452. const format = new GeoJSON();
  82453. featuresTemp = featuresTemp.concat(format.read(features[i]));
  82454. } else if (features[i].geometry && features[i].geometry.parts) {
  82455. //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
  82456. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  82457. } else {
  82458. throw new Error(`features[${i}]'s type is not be supported.`);
  82459. }
  82460. }
  82461. return featuresTemp;
  82462. },
  82463. /**
  82464. * @function ThemeLayer.prototype.toFeature
  82465. * @deprecated
  82466. * @description 转为 iClient 要素,该方法将被弃用,由 {@link ThemeLayer#toiClientFeature} 代替。
  82467. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
  82468. * @returns {FeatureVector} 转换后的 iClient 要素。
  82469. */
  82470. toFeature: function (features) {
  82471. return this.toiClientFeature(features);
  82472. },
  82473. _initContainer: function () {
  82474. var parentContainer = this.getPane();
  82475. var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
  82476. var className = 'themeLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
  82477. this.container = external_L_default().DomUtil.create("div", className, parentContainer);
  82478. var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  82479. this.container.id = this.options.id;
  82480. this.container.style[originProp] = '50% 50%';
  82481. this.container.style.position = "absolute";
  82482. this.container.style.zIndex = 200;
  82483. },
  82484. _zoomAnim: function (e) {
  82485. var scale = this._map.getZoomScale(e.zoom),
  82486. offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
  82487. if ((external_L_default()).DomUtil.setTransform) {
  82488. external_L_default().DomUtil.setTransform(this.container, offset, scale);
  82489. } else {
  82490. this.container.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
  82491. }
  82492. },
  82493. _updateOpacity: function () {
  82494. var me = this;
  82495. Util_Util.modifyDOMElement(me.container, null, null, null, null, null, null, me.options.opacity);
  82496. if (me._map !== null) {
  82497. /**
  82498. * @event ThemeLayer#changelayer
  82499. * @description 图层属性改变之后触发。
  82500. * @property {Object} layer - 图层。
  82501. * @property {string} property - 图层属性。
  82502. */
  82503. me._map.fire("changelayer", {
  82504. layer: me,
  82505. property: "opacity"
  82506. });
  82507. }
  82508. },
  82509. //缩放移动重绘
  82510. _reset: function () {
  82511. var me = this;
  82512. var latLngBounds = me._map.getBounds();
  82513. me.update(latLngBounds);
  82514. var size = me._map.getSize();
  82515. // var bounds = me._map.getBounds();
  82516. // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
  82517. // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
  82518. // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
  82519. // offsetLeft = -Math.round(offsetLeft);
  82520. //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
  82521. //offsetTop = -Math.round(offsetTop);
  82522. //me.container.style.left = mapOffset[0] + 'px';
  82523. //me.container.style.top = mapOffset[1] + 'px';
  82524. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  82525. external_L_default().DomUtil.setPosition(this.container, mapOffset);
  82526. if (parseFloat(me.container.width) !== parseFloat(size.x)) {
  82527. me.container.width = size.x + 'px';
  82528. }
  82529. if (parseFloat(me.container.height) !== parseFloat(size.y)) {
  82530. me.container.height = size.y + 'px';
  82531. }
  82532. me.redraw();
  82533. },
  82534. //通知渲染器的尺寸变化
  82535. _resize: function () {
  82536. var me = this;
  82537. var newSize = me._map.getSize();
  82538. me.container.style.width = newSize.x + "px";
  82539. me.container.style.height = newSize.y + "px";
  82540. me.renderer.resize();
  82541. }
  82542. });
  82543. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/GeoFeatureThemeLayer.js
  82544. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82545. * This program are made available under the terms of the Apache License, Version 2.0
  82546. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82547. /**
  82548. * @class GeoFeatureThemeLayer
  82549. * @classdesc 地理几何专题要素型专题图层基类。此类型专题图的专题要素形状就是由 feature.geometry 决定。此类不建议直接实例化调用。
  82550. * @category Visualization Theme
  82551. * @extends ThemeLayer
  82552. * @category Visualization Graphic
  82553. * @param {string} name - 专题图名。
  82554. * @param {Object} options - 参数。
  82555. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  82556. * @param {number} [options.opacity=1] - 图层透明度。
  82557. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  82558. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  82559. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  82560. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  82561. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  82562. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  82563. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  82564. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style)中的有效属性应用到专题图层。
  82565. * 禁止对专题要素使用数据(feature)的 style。
  82566. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature)对应专题要素赋予独立 style。
  82567. * @fires GeoFeatureThemeLayer#beforefeaturesadded
  82568. * @usage
  82569. */
  82570. var GeoFeatureThemeLayer = ThemeLayer.extend({
  82571. options: {
  82572. // {number} 节点抽稀像素距离,默认值 2。
  82573. nodesClipPixel: 2,
  82574. //{boolean} 图形是否在 hover 时高亮 ,默认值:false。
  82575. isHoverAble: false,
  82576. //{boolean} 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面),默认值:false。
  82577. isMultiHover: false,
  82578. // {boolean} 图形是否可点击,默认 true
  82579. isClickAble: true,
  82580. //是否允许 feature 样式(style)中的有效属性应用到专题图层。
  82581. //默认值为: false,禁止对专题要素使用数据(feature)的 style。
  82582. //此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  82583. //的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature)对应专题要素赋予独立 style。
  82584. isAllowFeatureStyle: false
  82585. },
  82586. initialize: function (name, options) {
  82587. ThemeLayer.prototype.initialize.call(this, name, options);
  82588. external_L_default().Util.setOptions(this, options);
  82589. var me = this;
  82590. me.cache = {};
  82591. me.cacheFields = [];
  82592. me.style = {};
  82593. me.highlightStyle = {};
  82594. },
  82595. /**
  82596. * @function GeoFeatureThemeLayer.prototype.addFeatures
  82597. * @description 添加数据。
  82598. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加的要素。
  82599. */
  82600. addFeatures: function (features) {
  82601. var me = this;
  82602. /**
  82603. * @event GeoFeatureThemeLayer#beforefeaturesadded
  82604. * @description 添加数据之前触发。
  82605. * @property {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 要素。
  82606. */
  82607. me.fire("beforefeaturesadded", {features: features});
  82608. //转换 features 形式
  82609. this.features = this.toiClientFeature(features);
  82610. if (!me.isCustomSetMaxCacheCount) {
  82611. me.maxCacheCount = me.features.length * 5;
  82612. }
  82613. if (!me.renderer) {
  82614. return;
  82615. }
  82616. //绘制专题要素
  82617. if (me._map) {
  82618. me.redrawThematicFeatures(me._map.getBounds());
  82619. } else {
  82620. me.redrawThematicFeatures();
  82621. }
  82622. },
  82623. /**
  82624. * @function GeoFeatureThemeLayer.prototype.removeFeatures
  82625. * @description 删除专题图中 features。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  82626. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除的要素或用于条件删除的回调函数。
  82627. */
  82628. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  82629. this.clearCache();
  82630. ThemeLayer.prototype.removeFeatures.call(this, features);
  82631. },
  82632. /**
  82633. * @function GeoFeatureThemeLayer.prototype.removeAllFeatures
  82634. * @description 清除当前图层所有的矢量要素。
  82635. */
  82636. removeAllFeatures: function () {
  82637. this.clearCache();
  82638. ThemeLayer.prototype.removeAllFeatures.call(this, arguments);
  82639. },
  82640. /**
  82641. * @function GeoFeatureThemeLayer.prototype.redrawThematicFeatures
  82642. * @description 重绘所有专题要素。
  82643. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  82644. * 地图漫游时调用此方法进行图层刷新。
  82645. * @param {L.Bounds} bounds - 重绘的范围。
  82646. */
  82647. redrawThematicFeatures: function (bounds) {
  82648. var me = this;
  82649. //获取高亮专题要素对应的用户 id
  82650. var hoverone = me.renderer.getHoverOne();
  82651. var hoverFid = null;
  82652. if (hoverone && hoverone.refDataID) {
  82653. hoverFid = hoverone.refDataID;
  82654. }
  82655. if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
  82656. var crs = this._map.options.crs;
  82657. bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
  82658. }
  82659. bounds = CommontypesConversion.toSuperMapBounds(bounds);
  82660. //清除当前所有可视元素
  82661. me.renderer.clearAll();
  82662. var features = me.features;
  82663. var cache = me.cache;
  82664. var cacheFields = me.cacheFields;
  82665. var cmZoom = me._map.getZoom();
  82666. var maxCC = me.maxCacheCount;
  82667. for (var i = 0, len = features.length; i < len; i++) {
  82668. var feature = features[i];
  82669. var feaBounds = feature.geometry.getBounds();
  82670. //剔除当前视图(地理)范围以外的数据
  82671. if (bounds && !bounds.intersectsBounds(feaBounds)) {
  82672. continue;
  82673. }
  82674. //缓存字段
  82675. var fields = feature.id + "_zoom_" + cmZoom.toString();
  82676. if (cache[fields]) {
  82677. cache[fields].updateAndAddShapes();
  82678. continue;
  82679. }
  82680. var thematicFeature = me.createThematicFeature(features[i]);
  82681. //检查 thematicFeature 是否有可视化图形
  82682. if (thematicFeature.getShapesCount() < 1) {
  82683. continue;
  82684. }
  82685. //加入缓存
  82686. cache[fields] = thematicFeature;
  82687. cacheFields.push(fields);
  82688. //缓存数量限制
  82689. if (cacheFields.length > maxCC) {
  82690. var fieldsTemp = cacheFields[0];
  82691. cacheFields.splice(0, 1);
  82692. delete cache[fieldsTemp];
  82693. }
  82694. }
  82695. me.renderer.render();
  82696. //地图漫游后,重新高亮图形
  82697. if (hoverFid && me.options.isHoverAble && me.options.isMultiHover) {
  82698. var hShapes = this.getShapesByFeatureID(hoverFid);
  82699. this.renderer.updateHoverShapes(hShapes);
  82700. }
  82701. },
  82702. /**
  82703. * @function GeoFeatureThemeLayer.prototype.createThematicFeature
  82704. * @description 创建专题要素。
  82705. * @param {FeatureVector} feature - 要创建的要素。
  82706. * @returns {Array.<FeatureVector>} 返回矢量要素。
  82707. */
  82708. createThematicFeature: function (feature) {
  82709. var me = this;
  82710. var style = me.getStyleByData(feature);
  82711. if (feature.style && me.isAllowFeatureStyle) {
  82712. style = Util_Util.copyAttributesWithClip(feature.style);
  82713. }
  82714. //创建专题要素时的可选参数
  82715. var options = {};
  82716. options.nodesClipPixel = me.options.nodesClipPixel;
  82717. options.isHoverAble = me.options.isHoverAble;
  82718. options.isMultiHover = me.options.isMultiHover;
  82719. options.isClickAble = me.options.isClickAble;
  82720. options.highlightStyle = ShapeFactory.transformStyle(me.highlightStyle);
  82721. //将数据转为专题要素(Vector)
  82722. var thematicFeature = new ThemeVector(feature, me, ShapeFactory.transformStyle(style), options);
  82723. //直接添加图形到渲染器
  82724. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  82725. me.renderer.addShape(thematicFeature.shapes[m]);
  82726. }
  82727. return thematicFeature;
  82728. },
  82729. /**
  82730. * @function GeoFeatureThemeLayer.prototype.redraw
  82731. * @description 重绘该图层。
  82732. */
  82733. redraw: function () {
  82734. this.clearCache();
  82735. return ThemeLayer.prototype.redraw.apply(this, arguments);
  82736. },
  82737. /**
  82738. * @function GeoFeatureThemeLayer.prototype.clearCache
  82739. * @description 清除缓存数据。
  82740. */
  82741. clearCache: function () {
  82742. this.cache = {};
  82743. this.cacheFields = [];
  82744. },
  82745. /**
  82746. * @function GeoFeatureThemeLayer.prototype.clear
  82747. * @description 清除的内容包括数据(features)、专题要素、缓存。
  82748. */
  82749. clear: function () {
  82750. var me = this;
  82751. me.renderer.clearAll();
  82752. me.renderer.refresh();
  82753. me.removeAllFeatures();
  82754. me.clearCache();
  82755. },
  82756. /**
  82757. * @function GeoFeatureThemeLayer.prototype.getCacheCount
  82758. * @description 获取当前缓存数量。
  82759. * @returns {number} 返回当前缓存数量。
  82760. */
  82761. getCacheCount: function () {
  82762. return this.cacheFields.length;
  82763. },
  82764. /**
  82765. * @function GeoFeatureThemeLayer.prototype.setMaxCacheCount
  82766. * @description 设置最大缓存数量。
  82767. * @param {number} cacheCount - 最大缓存量。
  82768. */
  82769. setMaxCacheCount: function (cacheCount) {
  82770. if (isNaN(cacheCount)) {
  82771. return;
  82772. }
  82773. this.maxCacheCount = cacheCount;
  82774. this.isCustomSetMaxCacheCount = true;
  82775. },
  82776. /**
  82777. * @function GeoFeatureThemeLayer.prototype.getShapesByFeatureID
  82778. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  82779. * @param {number} featureID - 要素 ID。
  82780. * @returns {Array} 返回图形数组。
  82781. */
  82782. getShapesByFeatureID: function (featureID) {
  82783. var me = this,
  82784. list = [],
  82785. shapeList = me.renderer.getAllShapes();
  82786. if (!featureID) {
  82787. return shapeList
  82788. }
  82789. for (var i = 0, len = shapeList.length; i < len; i++) {
  82790. var si = shapeList[i];
  82791. if (si.refDataID && featureID === si.refDataID) {
  82792. list.push(si);
  82793. }
  82794. }
  82795. return list;
  82796. }
  82797. });
  82798. ;// CONCATENATED MODULE: ./src/leaflet/overlay/UniqueThemeLayer.js
  82799. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82800. * This program are made available under the terms of the Apache License, Version 2.0
  82801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82802. /**
  82803. * @class UniqueThemeLayer
  82804. * @deprecatedclassinstance L.supermap.uniqueThemeLayer
  82805. * @category Visualization Theme
  82806. * @classdesc 客户端单值专题图类。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。
  82807. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。
  82808. * @modulecategory Overlay
  82809. * @extends GeoFeatureThemeLayer
  82810. * @param {string} name - 专题图层名。
  82811. * @param {Object} options - 参数。
  82812. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  82813. * @param {number} [options.opacity=1] - 图层透明度。
  82814. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  82815. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  82816. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  82817. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  82818. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  82819. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  82820. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  82821. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。
  82822. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature)对应专题要素赋予独立 style。
  82823. * @usage
  82824. */
  82825. var UniqueThemeLayer = GeoFeatureThemeLayer.extend({
  82826. /**
  82827. * @member {Object} UniqueThemeLayer.prototype.style
  82828. * @description 专题图样式。
  82829. */
  82830. /**
  82831. * @member {Object} UniqueThemeLayer.prototype.styleGroups
  82832. * @description 各专题类型样式组。
  82833. */
  82834. /**
  82835. * @member {Object} UniqueThemeLayer.prototype.highlightStyle
  82836. * @description 开启 hover 事件后,触发的样式风格。
  82837. */
  82838. initialize: function (name, options) {
  82839. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  82840. //{Array.<ThemeStyle>} 图层中专题要素的样式
  82841. this.style = [];
  82842. //{string} 用于指定专题要素样式的属性字段名称。
  82843. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  82844. this.themeField = null;
  82845. //使用此属性需要设置 themeField 属性。
  82846. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  82847. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  82848. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  82849. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  82850. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  82851. this.styleGroups = [];
  82852. },
  82853. /**
  82854. * @private
  82855. * @function UniqueThemeLayer.prototype.getStyleByData
  82856. * @description 根据用户数据(feature)设置专题要素的 Style。
  82857. * @param {FeatureVector} feat - 用户要素数据。
  82858. * @returns {Array.<ThemeStyle>} 返回包含专题要素 style 的对象。
  82859. */
  82860. getStyleByData: function (feat) {
  82861. var me = this,
  82862. feature = feat,
  82863. style = Util_Util.copyAttributesWithClip({}, me.style);
  82864. var groups = me.styleGroups,
  82865. isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
  82866. attribute = null; //属性值
  82867. var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
  82868. if (me.themeField && isValidStyleGroup && feature.attributes) {
  82869. var tf = me.themeField,
  82870. attributes = feature.attributes;
  82871. for (var property in attributes) {
  82872. if (tf !== property) {
  82873. continue;
  82874. }
  82875. isSfInAttributes = true;
  82876. attribute = attributes[property];
  82877. break;
  82878. }
  82879. }
  82880. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  82881. if (isSfInAttributes) {
  82882. for (var i = 0, len = groups.length; i < len; i++) {
  82883. if ((attribute).toString() === ( groups[i].value).toString()) {
  82884. var sty1 = groups[i].style;
  82885. style = Util_Util.copyAttributesWithClip(style, sty1);
  82886. }
  82887. }
  82888. }
  82889. return style;
  82890. }
  82891. });
  82892. var uniqueThemeLayer = function (name, options) {
  82893. return new UniqueThemeLayer(name, options);
  82894. };
  82895. ;// CONCATENATED MODULE: ./src/leaflet/overlay/RangeThemeLayer.js
  82896. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82897. * This program are made available under the terms of the Apache License, Version 2.0
  82898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82899. /**
  82900. * @class RangeThemeLayer
  82901. * @deprecatedclassinstance L.supermap.rangeThemeLayer
  82902. * @category Visualization Theme
  82903. * @classdesc 范围分段专题图类。范围分段专题图对数据({@link FeatureVector})属性字段(attributes)的属性值进行分段,使用不同的颜色或符号(线型、填充)渲染不同范围段的属性值。
  82904. * 分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  82905. * @modulecategory Overlay
  82906. * @extends GeoFeatureThemeLayer
  82907. * @param {string} name - 图层名。
  82908. * @param {Object} options - 参数。
  82909. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  82910. * @param {number} [options.opacity=1] - 图层透明度。
  82911. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  82912. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  82913. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  82914. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  82915. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  82916. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  82917. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  82918. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature)对应专题要素赋予独立 style。
  82919. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  82920. * @usage
  82921. */
  82922. var RangeThemeLayer = GeoFeatureThemeLayer.extend({
  82923. /**
  82924. * @member {Object} RangeThemeLayer.prototype.style
  82925. * @description 专题图样式。
  82926. */
  82927. /**
  82928. * @member {Object} RangeThemeLayer.prototype.styleGroups
  82929. * @description 各专题类型样式组。
  82930. */
  82931. /**
  82932. * @member {Object} RangeThemeLayer.prototype.highlightStyle
  82933. * @description hover 的样式风格。
  82934. */
  82935. initialize: function (name, options) {
  82936. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  82937. //{Array.<ThemeStyle>} 图层中专题要素的样式
  82938. this.style = [];
  82939. //{string} 用于指定专题要素样式的属性字段名称。
  82940. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  82941. this.themeField = null;
  82942. //使用此属性需要设置 themeField 属性。
  82943. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  82944. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  82945. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  82946. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  82947. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  82948. this.styleGroups = [];
  82949. },
  82950. /**
  82951. * @function RangeThemeLayer.prototype.getStyleByData
  82952. * @description 根据用户数据( feature )设置专题要素的 Style。
  82953. * @param {FeatureVector} feat - 矢量要素对象。
  82954. * @returns {Array.<ThemeStyle>} 专题要素的 Style。
  82955. */
  82956. getStyleByData: function (feat) {
  82957. var me = this,
  82958. feature = feat,
  82959. style = Util_Util.copyAttributesWithClip({}, me.style);
  82960. var groups = me.styleGroups,
  82961. isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
  82962. attribute = null; //属性值
  82963. var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
  82964. if (me.themeField && isValidStyleGroup && feature.attributes) {
  82965. var Sf = me.themeField,
  82966. attributes = feature.attributes;
  82967. for (var property in attributes) {
  82968. if (Sf !== property) {
  82969. continue;
  82970. }
  82971. isSfInAttributes = true;
  82972. attribute = attributes[property];
  82973. break;
  82974. }
  82975. }
  82976. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  82977. if (isSfInAttributes) {
  82978. for (var i = 0, len = groups.length; i < len; i++) {
  82979. var isContianed = i === len-1 ? ((attribute >= groups[i].start) && (attribute <= groups[i].end)) : ((attribute >= groups[i].start) && (attribute < groups[i].end));
  82980. if (isContianed) {
  82981. var sty1 = groups[i].style;
  82982. style = Util_Util.copyAttributesWithClip(style, sty1);
  82983. }
  82984. }
  82985. }
  82986. return style;
  82987. }
  82988. });
  82989. var rangeThemeLayer = function (name, options) {
  82990. return new RangeThemeLayer(name, options);
  82991. };
  82992. ;// CONCATENATED MODULE: ./src/leaflet/overlay/LabelThemeLayer.js
  82993. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82994. * This program are made available under the terms of the Apache License, Version 2.0
  82995. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82996. /**
  82997. * @class LabelThemeLayer
  82998. * @deprecatedclassinstance L.supermap.labelThemeLayer
  82999. * @classdesc 标签专题图类。
  83000. * @category Visualization Theme
  83001. * @modulecategory Overlay
  83002. * @extends GeoFeatureThemeLayer
  83003. * @param {string} name - 图层名。
  83004. * @param {Object} options - 参数。
  83005. * @param {string} options.themeFields - 指定创建专题图字段。
  83006. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  83007. * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
  83008. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  83009. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  83010. * @param {number} [options.opacity=1] - 图层透明度。
  83011. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  83012. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  83013. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  83014. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  83015. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  83016. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature)对应专题要素赋予独立 style。
  83017. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  83018. * @usage
  83019. */
  83020. var LabelThemeLayer = GeoFeatureThemeLayer.extend({
  83021. /**
  83022. * @member {Object} LabelThemeLayer.prototype.style
  83023. * @description 专题图样式。
  83024. */
  83025. /**
  83026. * @member {Object} LabelThemeLayer.prototype.styleGroups
  83027. * @description 各专题类型样式组。
  83028. */
  83029. /**
  83030. * @member {Object} LabelThemeLayer.prototype.highlightStyle
  83031. * @description 开启 hover 事件后,触发的样式风格。
  83032. */
  83033. options: {
  83034. //是否进行压盖处理,如果设为true,将隐藏被压盖的标签,默认为true。
  83035. isOverLay: true,
  83036. //是否进行地图边缘的避让处理,如果设为true,将把与地图边缘相交的标签移到地图范围内,默认为 true,在地图边缘处做避让处理。
  83037. isAvoid: true
  83038. },
  83039. initialize: function (name, options) {
  83040. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  83041. external_L_default().Util.setOptions(this, options);
  83042. //图层中专题要素的样式
  83043. this.style = [];
  83044. //用于指定专题要素样式的属性字段名称。
  83045. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  83046. this.themeField = null;
  83047. //使用此属性需要设置 themeField 属性。
  83048. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  83049. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  83050. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  83051. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  83052. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  83053. this.styleGroups = [];
  83054. this.defaultStyle = {
  83055. //默认文本样式
  83056. fontColor: "#000000",
  83057. fontOpacity: 1,
  83058. fontSize: "12px",
  83059. fontStyle: "normal",
  83060. fontWeight: "normal",
  83061. labelAlign: "cm",
  83062. labelXOffset: 0,
  83063. labelYOffset: 0,
  83064. labelRotation: 0,
  83065. //默认样式
  83066. fill: false,
  83067. fillColor: "#ee9900",
  83068. fillOpacity: 0.4,
  83069. stroke: false,
  83070. strokeColor: "#ee9900",
  83071. strokeOpacity: 1,
  83072. strokeWidth: 1,
  83073. strokeLinecap: "round",
  83074. strokeDashstyle: "solid",
  83075. //默认显示背景框
  83076. labelRect: true,
  83077. //对用户隐藏但必须保持此值的属性
  83078. //cursor: "pointer",
  83079. labelSelect: true,
  83080. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  83081. _isGeoTextStrategyStyle: true
  83082. };
  83083. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  83084. this.getPxBoundsMode = 0;
  83085. this.labelFeatures = [];
  83086. },
  83087. /**
  83088. * @function LabelThemeLayer.prototype.onAdd
  83089. * @description 添加专题图。
  83090. * @param {L.Map} map - Leaflet Map 对象。
  83091. * @private
  83092. */
  83093. onAdd: function (map) {
  83094. GeoFeatureThemeLayer.prototype.onAdd.call(this, map);
  83095. this.container.style.zIndex = 200;
  83096. },
  83097. /**
  83098. * @function LabelThemeLayer.prototype.redrawThematicFeatures
  83099. * @description 重绘所有专题要素。
  83100. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  83101. * 地图漫游时调用此方法进行图层刷新。
  83102. * @param {L.Bounds} bounds - 重绘范围。
  83103. */
  83104. redrawThematicFeatures: function (bounds) {
  83105. if (this.features.length > 0 && this.labelFeatures.length == 0) {
  83106. var feats = this.setLabelsStyle(this.features);
  83107. for (var i = 0, len = feats.length; i < len; i++) {
  83108. this.labelFeatures.push(feats[i]);
  83109. }
  83110. }
  83111. this.features = this.getDrawnLabels(this.labelFeatures);
  83112. GeoFeatureThemeLayer.prototype.redrawThematicFeatures.call(this, bounds);
  83113. },
  83114. /**
  83115. * @function LabelThemeLayer.prototype.removeFeatures
  83116. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  83117. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除的要素或用于条件删除的回调函数。
  83118. */
  83119. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  83120. this.labelFeatures = [];
  83121. GeoFeatureThemeLayer.prototype.removeFeatures.call(this, features);
  83122. },
  83123. /**
  83124. * @function LabelThemeLayer.prototype.removeAllFeatures
  83125. * @description 清除当前图层所有的矢量要素。
  83126. */
  83127. removeAllFeatures: function () {
  83128. this.labelFeatures = [];
  83129. GeoFeatureThemeLayer.prototype.removeAllFeatures.call(this, arguments);
  83130. },
  83131. /**
  83132. * @function LabelThemeLayer.prototype.getDrawnLabels
  83133. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  83134. * @param {Array.<FeatureVector>} labelFeatures - 所有标签要素的数组。
  83135. * @returns {Array.<FeatureVector>} 最终要绘制的标签要素数组。
  83136. */
  83137. getDrawnLabels: function (labelFeatures) {
  83138. var feas = [], //最终要绘制的标签要素集
  83139. fea, //最终要绘制的标签要素
  83140. fi, //临时标签要素,用户的第i个标签
  83141. labelsB = [], //不产生压盖的标签要素范围集
  83142. styTmp, //用于临时存储要素style的变量
  83143. feaSty, //标签要素最终的style
  83144. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  83145. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  83146. styleTemp = {
  83147. labelAlign: "cm",
  83148. labelXOffset: 0,
  83149. labelYOffset: 0
  83150. };
  83151. var map = this._map;
  83152. var mapSize = map.getSize();
  83153. var zoom = map.getZoom();
  83154. //对用户的每个标签要素进行处理与判断
  83155. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  83156. fi = labelFeatures[i];
  83157. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  83158. if (fi.isStyleChange || fi.isStyleChange === undefined) {
  83159. fi = this.setStyle(fi);
  83160. }
  83161. //标签最终的中心点像素位置 (偏移后)
  83162. var loc = this.getLabelPxLocation(fi);
  83163. //过滤掉地图范围外的标签 (偏移后)
  83164. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  83165. //根据当前地图缩放级别过滤标签
  83166. if (fi.style.minZoomLevel > -1) {
  83167. if (zoom <= fi.style.minZoomLevel) {
  83168. continue;
  83169. }
  83170. }
  83171. if (fi.style.maxZoomLevel > -1) {
  83172. if (zoom > fi.style.maxZoomLevel) {
  83173. continue;
  83174. }
  83175. }
  83176. //计算标签bounds
  83177. var boundsQuad = null;
  83178. if (fi.isStyleChange) {
  83179. fi.isStyleChange = null;
  83180. boundsQuad = this.calculateLabelBounds(fi, loc);
  83181. } else {
  83182. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  83183. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  83184. boundsQuad = this.calculateLabelBounds2(fi, loc);
  83185. } else {
  83186. boundsQuad = this.calculateLabelBounds(fi, loc);
  83187. }
  83188. }
  83189. //避让处理 -start
  83190. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  83191. quadlen = boundsQuad.length;
  83192. if (this.options.isAvoid) {
  83193. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  83194. if (avoidInfo) {
  83195. //横向(x方向)上的避让
  83196. if (avoidInfo.aspectW === "left") {
  83197. fi.style.labelXOffset += avoidInfo.offsetX;
  83198. for (let j = 0; j < quadlen; j++) {
  83199. boundsQuad[j].x += avoidInfo.offsetX;
  83200. }
  83201. } else if (avoidInfo.aspectW === "right") {
  83202. fi.style.labelXOffset += (-avoidInfo.offsetX);
  83203. for (let j = 0; j < quadlen; j++) {
  83204. boundsQuad[j].x += (-avoidInfo.offsetX);
  83205. }
  83206. }
  83207. //纵向(y方向)上的避让
  83208. if (avoidInfo.aspectH === "top") {
  83209. fi.style.labelYOffset += avoidInfo.offsetY;
  83210. for (let j = 0; j < quadlen; j++) {
  83211. boundsQuad[j].y += avoidInfo.offsetY;
  83212. }
  83213. } else if (avoidInfo.aspectH === "bottom") {
  83214. fi.style.labelYOffset += (-avoidInfo.offsetY);
  83215. for (let j = 0; j < quadlen; j++) {
  83216. boundsQuad[j].y += (-avoidInfo.offsetY);
  83217. }
  83218. }
  83219. //如果style发生变化,记录下来
  83220. fi.isStyleChange = true;
  83221. }
  83222. }
  83223. //避让处理 -end
  83224. //压盖处理 -start
  83225. if (this.options.isOverLay) {
  83226. //是否压盖
  83227. var isOL = false;
  83228. if (i != 0) {
  83229. for (let j = 0; j < labelsB.length; j++) {
  83230. //压盖判断
  83231. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  83232. isOL = true;
  83233. break;
  83234. }
  83235. }
  83236. }
  83237. if (isOL) {
  83238. continue;
  83239. } else {
  83240. labelsB.push(boundsQuad);
  83241. }
  83242. }
  83243. //压盖处理 -end
  83244. //背景(事件)-start
  83245. //将标签像素范围转为地理范围
  83246. var geoBs = [];
  83247. for (let j = 0; j < quadlen - 1; j++) {
  83248. geoBs.push(map.containerPointToLatLng(boundsQuad[j]));
  83249. }
  83250. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  83251. var leftBottom = geoBs[3];
  83252. var rightTop = geoBs[1];
  83253. var bounds = new Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
  83254. var center = bounds.getCenterLonLat();
  83255. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  83256. label.calculateBounds();
  83257. styTmp = Util_Util.cloneObject(fi.style);
  83258. feaSty = Util_Util.cloneObject(Util_Util.copyAttributes(styTmp, styleTemp));
  83259. fea = new Vector(label, fi.attributes, feaSty);
  83260. //赋予id
  83261. fea.id = fi.id;
  83262. fea.fid = fi.fid;
  83263. feas.push(fea);
  83264. }
  83265. }
  83266. //返回最终要绘制的标签要素
  83267. return feas;
  83268. },
  83269. /**
  83270. * @function LabelThemeLayer.prototype.getStyleByData
  83271. * @description 根据用户数据(feature)设置专题要素的 Style。
  83272. * @param {FeatureVector} feat - 矢量要素对象。
  83273. * @returns {Array.<ThemeStyle>} 专题要素的 Style。
  83274. */
  83275. getStyleByData: function (feat) {
  83276. var feature = feat;
  83277. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  83278. //将style赋给标签
  83279. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  83280. this.style.fontSize = "12px";
  83281. }
  83282. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  83283. if (this.themeField && this.styleGroups && feature.attributes) {
  83284. var Sf = this.themeField;
  83285. var attributes = feature.attributes;
  83286. var groups = this.styleGroups;
  83287. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  83288. var attr = null; //属性值
  83289. for (var property in attributes) {
  83290. if (Sf === property) {
  83291. isSfInAttrs = true;
  83292. attr = attributes[property];
  83293. break;
  83294. }
  83295. }
  83296. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  83297. if (isSfInAttrs) {
  83298. for (var i = 0, len = groups.length; i < len; i++) {
  83299. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  83300. var sty1 = groups[i].style;
  83301. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  83302. sty1.fontSize = "12px";
  83303. }
  83304. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  83305. }
  83306. }
  83307. }
  83308. feature.style.label = feature.attributes[this.themeField]
  83309. }
  83310. return feature.style;
  83311. },
  83312. /**
  83313. * @function LabelThemeLayer.prototype.setLabelsStyle
  83314. * @description 设置标签要素的 Style。
  83315. * @param {Array.<FeatureVector>} labelFeatures - 需要设置 Style 的标签要素数组。
  83316. * @returns {Array.<FeatureVector>} 赋予 Style 后的标签要素数组。
  83317. */
  83318. setLabelsStyle: function (labelFeatures) {
  83319. var fea, labelFeas = [];
  83320. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  83321. var feature = labelFeatures[i];
  83322. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  83323. //设置标签的Style
  83324. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  83325. feature.geometry.bsInfo.w = null;
  83326. feature.geometry.bsInfo.h = null;
  83327. feature.geometry.labelWTmp = null;
  83328. }
  83329. fea = this.setStyle(feature);
  83330. //为标签要素指定图层
  83331. fea.layer = this.layer;
  83332. labelFeas.push(fea);
  83333. } else {
  83334. return labelFeatures;
  83335. }
  83336. }
  83337. return labelFeas;
  83338. },
  83339. /**
  83340. * @function LabelThemeLayer.prototype.setStyle
  83341. * @description 设置标签要素的 Style。
  83342. * @param {FeatureVector} feat - 需要赋予 style 的要素。
  83343. */
  83344. setStyle: function (feat) {
  83345. var feature = feat;
  83346. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  83347. //将style赋给标签
  83348. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  83349. this.style.fontSize = "12px";
  83350. }
  83351. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  83352. if (this.groupField && this.styleGroups && feature.attributes) {
  83353. var Sf = this.groupField;
  83354. var Attrs = feature.attributes;
  83355. var Gro = this.styleGroups;
  83356. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  83357. var attr = null; //属性值
  83358. for (var property in Attrs) {
  83359. if (Sf === property) {
  83360. isSfInAttrs = true;
  83361. attr = Attrs[property];
  83362. break;
  83363. }
  83364. }
  83365. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  83366. if (isSfInAttrs) {
  83367. for (var i = 0, len = Gro.length; i < len; i++) {
  83368. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  83369. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  83370. var sty1 = Gro[i].style;
  83371. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  83372. sty1.fontSize = "12px";
  83373. }
  83374. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  83375. }
  83376. }
  83377. }
  83378. }
  83379. //将文本内容赋到标签要素的style上
  83380. feature.style.label = feature.geometry.text;
  83381. return feature;
  83382. },
  83383. /**
  83384. * @function LabelThemeLayer.prototype.getLabelPxLocation
  83385. * @description 获取标签要素的像素坐标。
  83386. * @param {FeatureVector} feature - 标签要素。
  83387. * @returns {L.Point} 标签位置。
  83388. */
  83389. getLabelPxLocation: function (feature) {
  83390. var geoText = feature.geometry;
  83391. var styleTmp = feature.style;
  83392. //将标签的地理位置转为像素位置
  83393. var locationTmp = geoText.getCentroid();
  83394. var locTmp = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(locationTmp.y, locationTmp.x) : this._map.options.crs.unproject(external_L_default().point(locationTmp.x, locationTmp.y)));
  83395. var loc = external_L_default().point(locTmp.x, locTmp.y);
  83396. //偏移处理
  83397. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  83398. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  83399. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  83400. var point = loc.add(external_L_default().point(xOffset, -yOffset));
  83401. return external_L_default().point(point.x, point.y);
  83402. } else {
  83403. return external_L_default().point(loc.x, loc.y);
  83404. }
  83405. },
  83406. /**
  83407. * @function LabelThemeLayer.prototype.calculateLabelBounds
  83408. * @description 获得标签要素的最终范围。
  83409. *
  83410. * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
  83411. * @param {L.Point} loc - 标签位置。
  83412. *
  83413. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83414. */
  83415. calculateLabelBounds: function (feature, loc) {
  83416. var geoText = feature.geometry;
  83417. //标签范围(未旋转前)
  83418. var labB = null;
  83419. var labelInfo = null;
  83420. //获取bounds的方式
  83421. if (this.getPxBoundsMode == 0) {
  83422. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  83423. } else if (this.getPxBoundsMode === 1) {
  83424. //canvas
  83425. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  83426. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  83427. } else {
  83428. return null;
  83429. }
  83430. //旋转Bounds
  83431. var boundsQuad = [];
  83432. if ((feature.style.labelRotation % 180) == 0) {
  83433. boundsQuad = [{
  83434. "x": labB.left,
  83435. "y": labB.top
  83436. },
  83437. {
  83438. "x": labB.right,
  83439. "y": labB.top
  83440. },
  83441. {
  83442. "x": labB.right,
  83443. "y": labB.bottom
  83444. },
  83445. {
  83446. "x": labB.left,
  83447. "y": labB.bottom
  83448. },
  83449. {
  83450. "x": labB.left,
  83451. "y": labB.top
  83452. }
  83453. ];
  83454. } else {
  83455. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  83456. }
  83457. //重置GeoText的bounds
  83458. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  83459. return boundsQuad;
  83460. },
  83461. /**
  83462. * @function LabelThemeLayer.prototype.calculateLabelBounds2
  83463. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  83464. *
  83465. * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
  83466. * @param {L.Point} loc - 标签位置。
  83467. *
  83468. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83469. */
  83470. calculateLabelBounds2: function (feature, loc) {
  83471. var labB, left, bottom, top, right;
  83472. var labelSize = feature.geometry.bsInfo;
  83473. var style = feature.style;
  83474. var locationPx = Util_Util.cloneObject(loc);
  83475. //处理文字对齐
  83476. if (style.labelAlign && style.labelAlign !== "cm") {
  83477. switch (style.labelAlign) {
  83478. case "lt":
  83479. locationPx.x += labelSize.w / 2;
  83480. locationPx.y += labelSize.h / 2;
  83481. break;
  83482. case "lm":
  83483. locationPx.x += labelSize.w / 2;
  83484. break;
  83485. case "lb":
  83486. locationPx.x += labelSize.w / 2;
  83487. locationPx.y -= labelSize.h / 2;
  83488. break;
  83489. case "ct":
  83490. locationPx.y += labelSize.h / 2;
  83491. break;
  83492. case "cb":
  83493. locationPx.y -= labelSize.h / 2;
  83494. break;
  83495. case "rt":
  83496. locationPx.x -= labelSize.w / 2;
  83497. locationPx.y += labelSize.h / 2;
  83498. break;
  83499. case "rm":
  83500. locationPx.x -= labelSize.w / 2;
  83501. break;
  83502. case "rb":
  83503. locationPx.x -= labelSize.w / 2;
  83504. locationPx.y -= labelSize.h / 2;
  83505. break;
  83506. default:
  83507. break;
  83508. }
  83509. }
  83510. left = locationPx.x - labelSize.w / 2;
  83511. bottom = locationPx.y + labelSize.h / 2;
  83512. //处理斜体字
  83513. if (style.fontStyle && style.fontStyle === "italic") {
  83514. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  83515. } else {
  83516. right = locationPx.x + labelSize.w / 2;
  83517. }
  83518. top = locationPx.y - labelSize.h / 2;
  83519. labB = new Bounds(left, bottom, right, top);
  83520. //旋转Bounds
  83521. var boundsQuad = [];
  83522. if ((style.labelRotation % 180) == 0) {
  83523. boundsQuad = [{
  83524. "x": labB.left,
  83525. "y": labB.top
  83526. },
  83527. {
  83528. "x": labB.right,
  83529. "y": labB.top
  83530. },
  83531. {
  83532. "x": labB.right,
  83533. "y": labB.bottom
  83534. },
  83535. {
  83536. "x": labB.left,
  83537. "y": labB.bottom
  83538. },
  83539. {
  83540. "x": labB.left,
  83541. "y": labB.top
  83542. }
  83543. ];
  83544. } else {
  83545. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  83546. }
  83547. //重置GeoText的bounds
  83548. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  83549. return boundsQuad;
  83550. },
  83551. /**
  83552. * @function LabelThemeLayer.prototype.getLabelInfo
  83553. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  83554. * @returns {Object} 绘制后的标签信息。
  83555. */
  83556. getLabelInfo: function (location, style) {
  83557. var LABEL_ALIGN = {
  83558. "l": "left",
  83559. "r": "right",
  83560. "t": "top",
  83561. "b": "bottom"
  83562. },
  83563. LABEL_FACTOR = {
  83564. "l": 0,
  83565. "r": -1,
  83566. "t": 0,
  83567. "b": -1
  83568. };
  83569. style = Util_Util.extend({
  83570. fontColor: "#000000",
  83571. labelAlign: "cm"
  83572. }, style);
  83573. var pt = this.getLocalXY(location);
  83574. var labelWidth = 0;
  83575. if (style.labelXOffset || style.labelYOffset) {
  83576. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  83577. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  83578. pt[0] += xOffset;
  83579. pt[1] -= yOffset;
  83580. }
  83581. var canvas = document.createElement('canvas');
  83582. canvas.globalAlpha = 0;
  83583. canvas.lineWidth = 1;
  83584. var ctx = canvas.getContext("2d");
  83585. ctx.fillStyle = style.fontColor;
  83586. ctx.globalAlpha = style.fontOpacity || 1.0;
  83587. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  83588. "normal",
  83589. style.fontWeight ? style.fontWeight : "normal",
  83590. style.fontSize ? style.fontSize : "1em",
  83591. style.fontFamily ? style.fontFamily : "sans-serif"
  83592. ].join(" ");
  83593. var labelRows = style.label.split('\n');
  83594. var numRows = labelRows.length;
  83595. var vfactor, lineHeight, labelWidthTmp;
  83596. if (ctx.fillText) {
  83597. // HTML5
  83598. ctx.font = fontStyle;
  83599. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  83600. "center";
  83601. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  83602. "middle";
  83603. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  83604. if (vfactor == null) {
  83605. vfactor = -.5;
  83606. }
  83607. lineHeight = ctx.measureText('Mg').height ||
  83608. ctx.measureText('xx').width;
  83609. pt[1] += lineHeight * vfactor * (numRows - 1);
  83610. for (let i = 0; i < numRows; i++) {
  83611. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  83612. if (labelWidth < labelWidthTmp) {
  83613. labelWidth = labelWidthTmp;
  83614. }
  83615. }
  83616. } else if (ctx.mozDrawText) {
  83617. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  83618. ctx.mozTextStyle = fontStyle;
  83619. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  83620. if (vfactor == null) {
  83621. vfactor = -.5;
  83622. }
  83623. lineHeight = ctx.mozMeasureText('xx');
  83624. pt[1] += lineHeight * (1 + (vfactor * numRows));
  83625. for (let i = 0; i < numRows; i++) {
  83626. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  83627. if (labelWidth < labelWidthTmp) {
  83628. labelWidth = labelWidthTmp;
  83629. }
  83630. }
  83631. }
  83632. var labelInfo = {}; //标签信息
  83633. if (labelWidth) {
  83634. labelInfo.w = labelWidth; //标签的宽
  83635. } else {
  83636. return null;
  83637. }
  83638. labelInfo.h = style.fontSize; //一行标签的高
  83639. labelInfo.rows = labelRows.length; //标签的行数
  83640. return labelInfo;
  83641. },
  83642. /**
  83643. * @function LabelThemeLayer.prototype.rotationBounds
  83644. * @description 旋转 bounds。
  83645. *
  83646. * @param {Bounds} bounds - 要旋转的 bounds。
  83647. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性x(横坐标),属性y(纵坐标)。
  83648. * @param {number} angle - 旋转角度(顺时针)。
  83649. *
  83650. * @returns {Array.<Object>} bounds旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83651. */
  83652. rotationBounds: function (bounds, rotationCenterPoi, angle) {
  83653. var ltPoi = external_L_default().point(bounds.left, bounds.top);
  83654. var rtPoi = external_L_default().point(bounds.right, bounds.top);
  83655. var rbPoi = external_L_default().point(bounds.right, bounds.bottom);
  83656. var lbPoi = external_L_default().point(bounds.left, bounds.bottom);
  83657. var ver = [];
  83658. ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  83659. ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  83660. ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  83661. ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  83662. //bounds旋转后形成的多边形节点数组
  83663. var quad = [];
  83664. for (var i = 0; i < ver.length; i++) {
  83665. quad.push({
  83666. "x": ver[i].x,
  83667. "y": ver[i].y
  83668. });
  83669. }
  83670. quad.push({
  83671. "x": ver[0].x,
  83672. "y": ver[0].y
  83673. });
  83674. return quad;
  83675. },
  83676. /**
  83677. * @function LabelThemeLayer.prototype.getRotatedLocation
  83678. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)。
  83679. *
  83680. * @param {number} x - 旋转点横坐标。
  83681. * @param {number} y - 旋转点纵坐标。
  83682. * @param {number} rx - 旋转中心点横坐标。
  83683. * @param {number} ry - 旋转中心点纵坐标。
  83684. * @param {number} angle - 旋转角度。
  83685. *
  83686. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  83687. */
  83688. getRotatedLocation: function (x, y, rx, ry, angle) {
  83689. var loc = {},
  83690. x0, y0;
  83691. y = -y;
  83692. ry = -ry;
  83693. angle = -angle; //顺时针旋转
  83694. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  83695. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  83696. loc.x = x0;
  83697. loc.y = -y0;
  83698. return loc;
  83699. },
  83700. /**
  83701. * @function LabelThemeLayer.prototype.getAvoidInfo
  83702. * @description 获取避让的信息。
  83703. *
  83704. * @param {Bounds} bounds - 地图像素范围。
  83705. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83706. *
  83707. * @returns {Object} 避让的信息。
  83708. */
  83709. getAvoidInfo: function (bounds, quadrilateral) {
  83710. if (quadrilateral.length !== 5) {
  83711. return null;
  83712. } //不是四边形
  83713. //将bound序列化为点数组形式
  83714. var bounddQuad = [{
  83715. "x": bounds.left,
  83716. "y": bounds.top
  83717. },
  83718. {
  83719. "x": bounds.right,
  83720. "y": bounds.top
  83721. },
  83722. {
  83723. "x": bounds.right,
  83724. "y": bounds.bottom
  83725. },
  83726. {
  83727. "x": bounds.left,
  83728. "y": bounds.bottom
  83729. },
  83730. {
  83731. "x": bounds.left,
  83732. "y": bounds.top
  83733. }
  83734. ];
  83735. var isIntersection = false,
  83736. bqLen = bounddQuad.length,
  83737. quadLen = quadrilateral.length;
  83738. var offsetX = 0,
  83739. offsetY = 0,
  83740. aspectH = "",
  83741. aspectW = "";
  83742. for (var i = 0; i < bqLen - 1; i++) {
  83743. for (var j = 0; j < quadLen - 1; j++) {
  83744. var isLineIn = Util_Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  83745. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  83746. //设置避让信息
  83747. setInfo(quadrilateral[j]);
  83748. setInfo(quadrilateral[j + 1]);
  83749. isIntersection = true;
  83750. }
  83751. }
  83752. }
  83753. if (isIntersection) {
  83754. //组织避让操作所需的信息
  83755. return {
  83756. "aspectW": aspectW,
  83757. "aspectH": aspectH,
  83758. "offsetX": offsetX,
  83759. "offsetY": offsetY
  83760. };
  83761. } else {
  83762. return null;
  83763. }
  83764. //内部函数:设置避让信息
  83765. //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  83766. function setInfo(vec) {
  83767. //四边形不在bounds内的节点
  83768. if (!bounds.contains(vec.x, vec.y)) {
  83769. //bounds的Top边
  83770. if (vec.y < bounds.top) {
  83771. let oY = Math.abs(bounds.top - vec.y);
  83772. if (oY > offsetY) {
  83773. offsetY = oY;
  83774. aspectH = "top";
  83775. }
  83776. }
  83777. //bounds的Bottom边
  83778. if (vec.y > bounds.bottom) {
  83779. let oY = Math.abs(vec.y - bounds.bottom);
  83780. if (oY > offsetY) {
  83781. offsetY = oY;
  83782. aspectH = "bottom";
  83783. }
  83784. }
  83785. //bounds的left边
  83786. if (vec.x < bounds.left) {
  83787. let oX = Math.abs(bounds.left - vec.x);
  83788. if (oX > offsetX) {
  83789. offsetX = oX;
  83790. aspectW = "left";
  83791. }
  83792. }
  83793. //bounds的right边
  83794. if (vec.x > bounds.right) {
  83795. let oX = Math.abs(vec.x - bounds.right);
  83796. if (oX > offsetX) {
  83797. offsetX = oX;
  83798. aspectW = "right";
  83799. }
  83800. }
  83801. }
  83802. }
  83803. },
  83804. /**
  83805. * @function LabelThemeLayer.prototype.isQuadrilateralOverLap
  83806. * @description 判断两个四边形是否有压盖。
  83807. *
  83808. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83809. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  83810. *
  83811. * @returns {boolean} 是否压盖,true表示压盖。
  83812. */
  83813. isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
  83814. var quadLen = quadrilateral.length,
  83815. quad2Len = quadrilateral2.length;
  83816. if (quadLen !== 5 || quad2Len !== 5) {
  83817. return null;
  83818. } //不是四边形
  83819. var OverLap = false;
  83820. //如果两四边形互不包含对方的节点,则两个四边形不相交
  83821. for (let i = 0; i < quadLen; i++) {
  83822. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  83823. OverLap = true;
  83824. break;
  83825. }
  83826. }
  83827. for (let i = 0; i < quad2Len; i++) {
  83828. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  83829. OverLap = true;
  83830. break;
  83831. }
  83832. }
  83833. //加上两矩形十字相交的情况
  83834. for (let i = 0; i < quadLen - 1; i++) {
  83835. if (OverLap) {
  83836. break;
  83837. }
  83838. for (var j = 0; j < quad2Len - 1; j++) {
  83839. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  83840. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  83841. OverLap = true;
  83842. break;
  83843. }
  83844. }
  83845. }
  83846. return OverLap;
  83847. },
  83848. /**
  83849. * @function LabelThemeLayer.prototype.isPointInPoly
  83850. * @description 判断一个点是否在多边形里面(射线法)。
  83851. *
  83852. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  83853. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  83854. * @returns {boolean} 点是否在多边形内。
  83855. */
  83856. isPointInPoly: function (pt, poly) {
  83857. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  83858. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  83859. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  83860. (isIn = !isIn);
  83861. }
  83862. return isIn;
  83863. }
  83864. });
  83865. var labelThemeLayer = function (name, options) {
  83866. return new LabelThemeLayer(name, options);
  83867. };
  83868. ;// CONCATENATED MODULE: ./src/common/iServer/FeatureService.js
  83869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83870. * This program are made available under the terms of the Apache License, Version 2.0
  83871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83872. /**
  83873. * @class FeatureService
  83874. * @constructs FeatureService
  83875. * @category iServer Data Feature
  83876. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  83877. * @example
  83878. * new FeatureService(url).getFeaturesByIDs(param,function(result){
  83879. * //doSomething
  83880. * })
  83881. * @param {string} url - 服务地址。
  83882. * @param {Object} options - 参数。
  83883. * @param {string} [options.proxy] - 服务代理地址。
  83884. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  83885. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  83886. * @param {Object} [options.headers] - 请求头。
  83887. * @extends {ServiceBase}
  83888. * @usage
  83889. */
  83890. class FeatureService {
  83891. constructor(url, options) {
  83892. this.url = url;
  83893. this.options = options || {};
  83894. }
  83895. /**
  83896. * @function FeatureService.prototype.getFeaturesByIDs
  83897. * @description 数据集 ID 查询服务。
  83898. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  83899. * @param {RequestCallback} callback - 回调函数。
  83900. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83901. */
  83902. getFeaturesByIDs(params, callback, resultFormat) {
  83903. var me = this;
  83904. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  83905. proxy: me.options.proxy,
  83906. withCredentials: me.options.withCredentials,
  83907. crossOrigin: me.options.crossOrigin,
  83908. headers: me.options.headers,
  83909. eventListeners: {
  83910. processCompleted: callback,
  83911. processFailed: callback
  83912. },
  83913. format: resultFormat
  83914. });
  83915. getFeaturesByIDsService.processAsync(params);
  83916. }
  83917. /**
  83918. * @function FeatureService.prototype.getFeaturesByBounds
  83919. * @description 数据集 Bounds 查询服务。
  83920. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  83921. * @param {RequestCallback} callback - 回调函数。
  83922. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83923. */
  83924. getFeaturesByBounds(params, callback, resultFormat) {
  83925. var me = this;
  83926. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  83927. proxy: me.options.proxy,
  83928. withCredentials: me.options.withCredentials,
  83929. crossOrigin: me.options.crossOrigin,
  83930. headers: me.options.headers,
  83931. eventListeners: {
  83932. processCompleted: callback,
  83933. processFailed: callback
  83934. },
  83935. format: me._processFormat(resultFormat)
  83936. });
  83937. getFeaturesByBoundsService.processAsync(params);
  83938. }
  83939. /**
  83940. * @function FeatureService.prototype.getFeaturesByBuffer
  83941. * @description 数据集 Buffer 查询服务。
  83942. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  83943. * @param {RequestCallback} callback - 回调函数。
  83944. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83945. */
  83946. getFeaturesByBuffer(params, callback, resultFormat) {
  83947. var me = this;
  83948. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  83949. proxy: me.options.proxy,
  83950. withCredentials: me.options.withCredentials,
  83951. crossOrigin: me.options.crossOrigin,
  83952. headers: me.options.headers,
  83953. eventListeners: {
  83954. processCompleted: callback,
  83955. processFailed: callback
  83956. },
  83957. format: me._processFormat(resultFormat)
  83958. });
  83959. getFeatureService.processAsync(params);
  83960. }
  83961. /**
  83962. * @function FeatureService.prototype.getFeaturesBySQL
  83963. * @description 数据集 SQL 查询服务。
  83964. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  83965. * @param {RequestCallback} callback - 回调函数。
  83966. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83967. */
  83968. getFeaturesBySQL(params, callback, resultFormat) {
  83969. var me = this;
  83970. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  83971. proxy: me.options.proxy,
  83972. withCredentials: me.options.withCredentials,
  83973. crossOrigin: me.options.crossOrigin,
  83974. headers: me.options.headers,
  83975. eventListeners: {
  83976. processCompleted: callback,
  83977. processFailed: callback
  83978. },
  83979. format: me._processFormat(resultFormat)
  83980. });
  83981. getFeatureBySQLService.processAsync(params);
  83982. }
  83983. /**
  83984. * @function FeatureService.prototype.getFeaturesByGeometry
  83985. * @description 数据集几何查询服务类。
  83986. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  83987. * @param {RequestCallback} callback - 回调函数。
  83988. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83989. */
  83990. getFeaturesByGeometry(params, callback, resultFormat) {
  83991. var me = this;
  83992. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  83993. proxy: me.options.proxy,
  83994. withCredentials: me.options.withCredentials,
  83995. crossOrigin: me.options.crossOrigin,
  83996. headers: me.options.headers,
  83997. eventListeners: {
  83998. processCompleted: callback,
  83999. processFailed: callback
  84000. },
  84001. format: me._processFormat(resultFormat)
  84002. });
  84003. getFeaturesByGeometryService.processAsync(params);
  84004. }
  84005. /**
  84006. * @function FeatureService.prototype.editFeatures
  84007. * @description 地物编辑服务。
  84008. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  84009. * @param {RequestCallback} callback - 回调函数。
  84010. */
  84011. editFeatures(params, callback) {
  84012. if (!params || !params.dataSourceName || !params.dataSetName) {
  84013. return;
  84014. }
  84015. var me = this,
  84016. url = me.url,
  84017. dataSourceName = params.dataSourceName,
  84018. dataSetName = params.dataSetName;
  84019. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  84020. var editFeatureService = new EditFeaturesService(url, {
  84021. proxy: me.options.proxy,
  84022. withCredentials: me.options.withCredentials,
  84023. crossOrigin: me.options.crossOrigin,
  84024. headers: me.options.headers,
  84025. eventListeners: {
  84026. processCompleted: callback,
  84027. processFailed: callback
  84028. }
  84029. });
  84030. editFeatureService.processAsync(params);
  84031. }
  84032. _processFormat(resultFormat) {
  84033. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  84034. }
  84035. }
  84036. ;// CONCATENATED MODULE: ./src/leaflet/services/FeatureService.js
  84037. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84038. * This program are made available under the terms of the Apache License, Version 2.0
  84039. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84040. /**
  84041. * @class FeatureService
  84042. * @deprecatedclassinstance L.supermap.featureService
  84043. * @classdesc 要素数据集类。提供:ID 查询,范围查询,SQL 查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  84044. * @category iServer Data Feature
  84045. * @modulecategory Services
  84046. * @example
  84047. * new FeatureService(url)
  84048. * .getFeaturesByIDs(param,function(result){
  84049. * //doSomething
  84050. * })
  84051. * @extends {ServiceBase}
  84052. * @param {string} url - 服务地址。
  84053. * @param {Object} options - 参数。
  84054. * @param {string} [options.proxy] - 服务代理地址。
  84055. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  84056. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  84057. * @param {Object} [options.headers] - 请求头。
  84058. * @usage
  84059. */
  84060. var FeatureService_FeatureService = ServiceBase.extend({
  84061. initialize: function (url, options) {
  84062. ServiceBase.prototype.initialize.call(this, url, options);
  84063. this._featureService = new FeatureService(url, options);
  84064. },
  84065. /**
  84066. * @function FeatureService.prototype.getFeaturesByIDs
  84067. * @description 数据集 ID 查询服务。
  84068. * @param {GetFeaturesByIDsParameters} params - ID 查询参数类。
  84069. * @param {RequestCallback} callback - 回调函数。
  84070. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  84071. */
  84072. getFeaturesByIDs: function (params, callback, resultFormat) {
  84073. params = this._processParams(params);
  84074. this._featureService.getFeaturesByIDs(params, callback, resultFormat);
  84075. },
  84076. /**
  84077. * @function FeatureService.prototype.getFeaturesByBounds
  84078. * @description 数据集 bounds 查询服务。
  84079. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  84080. * @param {RequestCallback} callback - 回调函数。
  84081. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  84082. */
  84083. getFeaturesByBounds: function (params, callback, resultFormat) {
  84084. params = this._processParams(params);
  84085. this._featureService.getFeaturesByBounds(params, callback, resultFormat);
  84086. },
  84087. /**
  84088. * @function FeatureService.prototype.getFeaturesByBuffer
  84089. * @description 数据集 buffer 查询服务。
  84090. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  84091. * @param {RequestCallback} callback - 回调函数。
  84092. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  84093. */
  84094. getFeaturesByBuffer: function (params, callback, resultFormat) {
  84095. params = this._processParams(params);
  84096. this._featureService.getFeaturesByBuffer(params, callback, resultFormat);
  84097. },
  84098. /**
  84099. * @function FeatureService.prototype.getFeaturesBySQL
  84100. * @description 数据集 SQL 查询服务。
  84101. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  84102. * @param {RequestCallback} callback - 回调函数。
  84103. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  84104. */
  84105. getFeaturesBySQL: function (params, callback, resultFormat) {
  84106. params = this._processParams(params);
  84107. this._featureService.getFeaturesBySQL(params, callback, resultFormat);
  84108. },
  84109. /**
  84110. * @function FeatureService.prototype.getFeaturesByGeometry
  84111. * @description 数据集几何查询服务类。
  84112. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  84113. * @param {RequestCallback} callback - 回调函数。
  84114. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  84115. */
  84116. getFeaturesByGeometry: function (params, callback, resultFormat) {
  84117. params = this._processParams(params);
  84118. this._featureService.getFeaturesByGeometry(params, callback, resultFormat);
  84119. },
  84120. /**
  84121. * @function FeatureService.prototype.editFeatures
  84122. * @description 地物编辑服务。
  84123. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  84124. * @param {RequestCallback} callback - 回调函数。
  84125. */
  84126. editFeatures: function (params, callback) {
  84127. if (!params || !params.dataSourceName || !params.dataSetName) {
  84128. return;
  84129. }
  84130. var me = this,
  84131. url = me.url,
  84132. dataSourceName = params.dataSourceName,
  84133. dataSetName = params.dataSetName;
  84134. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  84135. var editFeatureService = new EditFeaturesService(url, {
  84136. proxy: me.options.proxy,
  84137. withCredentials: me.options.withCredentials,
  84138. crossOrigin:me.options.crossOrigin,
  84139. headers:me.options.headers,
  84140. eventListeners: {
  84141. processCompleted: callback,
  84142. processFailed: callback
  84143. }
  84144. });
  84145. editFeatureService.processAsync(me._processParams(params));
  84146. },
  84147. _processParams: function (params) {
  84148. if (!params) {
  84149. return {};
  84150. }
  84151. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  84152. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  84153. params.toIndex = params.toIndex ? params.toIndex : -1;
  84154. params.isUseBatch = (params.isUseBatch == null) ? false : params.isUseBatch;
  84155. if (params.bounds) {
  84156. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  84157. }
  84158. if (params.geometry) {
  84159. params.geometry = Util_toSuperMapGeometry(params.geometry);
  84160. }
  84161. if (params.editType) {
  84162. params.editType = params.editType.toLowerCase();
  84163. }
  84164. var me = this;
  84165. if (params.features) {
  84166. var features = [];
  84167. if (external_L_default().Util.isArray(params.features)) {
  84168. params.features.map(function (feature) {
  84169. features.push(me._createServerFeature(feature));
  84170. return feature;
  84171. });
  84172. } else {
  84173. features.push(me._createServerFeature(params.features));
  84174. }
  84175. params.features = features;
  84176. }
  84177. return params;
  84178. },
  84179. _createServerFeature: function (geoFeature) {
  84180. var geoJSONFeature, feature = {}, fieldNames = [], fieldValues = [];
  84181. geoJSONFeature = geoFeature || {};
  84182. for (var key in geoJSONFeature.properties) {
  84183. fieldNames.push(key);
  84184. fieldValues.push(geoJSONFeature.properties[key]);
  84185. }
  84186. feature.fieldNames = fieldNames;
  84187. feature.fieldValues = fieldValues;
  84188. if (geoJSONFeature.id) {
  84189. feature.id = geoJSONFeature.id;
  84190. }
  84191. feature.geometry = Util_toSuperMapGeometry(geoJSONFeature);
  84192. return feature;
  84193. },
  84194. _processFormat: function (resultFormat) {
  84195. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  84196. }
  84197. });
  84198. var FeatureService_featureService = function (url, options) {
  84199. return new FeatureService_FeatureService(url, options);
  84200. };
  84201. ;// CONCATENATED MODULE: ./src/leaflet/overlay/UnicodeMarker.js
  84202. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84203. * This program are made available under the terms of the Apache License, Version 2.0
  84204. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84205. /**
  84206. * @class UnicodeMarker
  84207. * @deprecatedclassinstance L.supermap.unicodeMarker
  84208. * @classdesc Unicode 字符图标类。
  84209. * @category Visualization Marker
  84210. * @modulecategory Overlay
  84211. * @extends {L.Path}
  84212. * @param {L.LatLngBounds} latlng - 经纬度坐标。
  84213. * @param {Object} options - 参数。
  84214. * @param {string} options.label - 符号 Unicode 值。
  84215. * @param {string} [options.labelRotation='0'] - 符号旋转角度。
  84216. * @param {string} [options.globalAlpha='1'] - 符号的透明值。
  84217. * @param {string} [options.fontStyle='normal'] - 符号的风格。
  84218. * @param {string} [options.fontWeight='normal'] - 符号的粗细。
  84219. * @param {string} [options.fontSize='1em'] - 符号的尺寸。
  84220. * @param {string} [options.fontFamily='sans-serif'] - 符号的字体。
  84221. * @param {string} [options.textAlign='center'] - 符号内容的对齐方式。
  84222. * @param {string} [options.textBaseline='middle'] - 绘制符号时使用的基线。
  84223. * @fires UnicodeMarker#move
  84224. * @usage
  84225. */
  84226. var UnicodeMarker = external_L_default().Path.extend({
  84227. // @section
  84228. // @aka CircleMarker options
  84229. options: {
  84230. fontStyle: "normal",
  84231. fontWeight: "normal",
  84232. fontSize: "1em",
  84233. fontFamily: "sans-serif",
  84234. textAlign: "center",
  84235. textBaseline: "middle",
  84236. vfactor: -.5,
  84237. labelRotation: 0,
  84238. globalAlpha: 1,
  84239. label: ""
  84240. },
  84241. initialize: function (latlng, options) {
  84242. external_L_default().Util.setOptions(this, options);
  84243. this._latlng = latlng;
  84244. },
  84245. /**
  84246. * @function UnicodeMarker.prototype.setLatLng
  84247. * @description 设置 marker 新坐标。
  84248. * @param {L.LatLng} setLatLng - 需要设置的新坐标。
  84249. */
  84250. setLatLng: function (latlng) {
  84251. this._latlng = latlng;
  84252. this.redraw();
  84253. /**
  84254. * @event UnicodeMarker#move
  84255. * @description circle marker 重设坐标之后触发。
  84256. * @property {L.LatLng} latlng - 当前 marker 坐标。
  84257. */
  84258. return this.fire('move', {latlng: this._latlng});
  84259. },
  84260. /**
  84261. * @function UnicodeMarker.prototype.getLatLng
  84262. * @description 获取 marker 坐标。
  84263. * @returns {L.LatLng} 返回当前 marker 坐标。
  84264. */
  84265. getLatLng: function () {
  84266. return this._latlng;
  84267. },
  84268. _project: function () {
  84269. this._point = this._map.latLngToLayerPoint(this._latlng);
  84270. this._updateBounds();
  84271. },
  84272. _updateBounds: function () {
  84273. var w = this._clickTolerance(),
  84274. p = [w, w];
  84275. this._pxBounds = new (external_L_default()).Bounds(this._point.subtract(p), this._point.add(p));
  84276. },
  84277. _update: function () {
  84278. if (this._map) {
  84279. this._updatePath();
  84280. }
  84281. },
  84282. _updatePath: function () {
  84283. this._renderer._updateUnicode(this);
  84284. },
  84285. // Needed by the `Canvas` renderer for interactivity
  84286. _containsPoint: function (p) {
  84287. return p.distanceTo(this._point) <= this._clickTolerance();
  84288. }
  84289. })
  84290. var unicodeMarker = function (latlng, options) {
  84291. return new UnicodeMarker(latlng, options);
  84292. };
  84293. external_L_default().Canvas.include({
  84294. _updateUnicode: function (layer) {
  84295. if (!this._drawing) {
  84296. return;
  84297. }
  84298. let pt = {x: layer._point.x, y: layer._point.y},
  84299. ctx = this._ctx,
  84300. fontStyle = [layer.options.fontStyle,
  84301. "normal", layer.options.fontWeight,
  84302. layer.options.fontSize,
  84303. layer.options.fontFamily].join(" ");
  84304. let label = layer.options.label.replace(/^&#x/, '');
  84305. label = String.fromCharCode(parseInt(label, 16));
  84306. let labelRows = label.split('\n');
  84307. let numRows = labelRows.length;
  84308. // if (layer.options.labelXOffset || layer.options.labelYOffset) {
  84309. // let xOffset = isNaN(layer.options.labelXOffset) ? 0 : layer.options.labelXOffset;
  84310. // let yOffset = isNaN(layer.options.labelYOffset) ? 0 : layer.options.labelYOffset;
  84311. // pt.x += xOffset;
  84312. // pt.y -= yOffset;
  84313. // }
  84314. ctx.fillStyle = layer.options.fontColor;
  84315. ctx.globalAlpha = 1.0;
  84316. if (layer.options.fontOpacity >= 0 && layer.options.fontOpacity < 1) {
  84317. ctx.globalAlpha = layer.options.fontOpacity;
  84318. }
  84319. if (ctx.fillText) {
  84320. // HTML5
  84321. ctx.font = fontStyle;
  84322. ctx.textAlign = layer.options.textAlign;
  84323. ctx.textBaseline = layer.options.textBaseline;
  84324. let vfactor = layer.options.vfactor;
  84325. let lineHeight =
  84326. ctx.measureText('Mg').height ||
  84327. ctx.measureText('xx').width;
  84328. pt.y += lineHeight * vfactor * (numRows - 1);
  84329. for (let i = 0; i < numRows; i++) {
  84330. if (layer.options.labelRotation != 0) {
  84331. ctx.save();
  84332. ctx.translate(pt.x, pt.y);
  84333. ctx.rotate(layer.options.labelRotation * Math.PI / 180);
  84334. ctx.fillText(labelRows[i], 0, (lineHeight * i));
  84335. ctx.restore();
  84336. } else {
  84337. ctx.fillText(labelRows[i], pt.x, pt.y);
  84338. }
  84339. }
  84340. } else if (ctx.mozDrawText) {
  84341. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  84342. ctx.mozTextStyle = fontStyle;
  84343. // No built-in text alignment, so we measure and adjust the position
  84344. let hfactor = layer.options.textAlign;
  84345. let vfactor = layer.options.vfactor;
  84346. let lineHeight = ctx.mozMeasureText('xx');
  84347. pt.y += lineHeight * (1 + (vfactor * numRows));
  84348. for (let i = 0; i < numRows; i++) {
  84349. let x = pt.x + (hfactor * ctx.mozMeasureText(labelRows[i]));
  84350. let y = pt.y + (i * lineHeight);
  84351. ctx.translate(x, y);
  84352. ctx.mozDrawText(labelRows[i]);
  84353. ctx.translate(-x, -y);
  84354. }
  84355. }
  84356. }
  84357. });
  84358. ;// CONCATENATED MODULE: ./src/leaflet/mapping/WebMap.js
  84359. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84360. * This program are made available under the terms of the Apache License, Version 2.0
  84361. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84362. /**
  84363. * @class WebMap
  84364. * @deprecatedclassinstance L.supermap.webMap
  84365. * @classdesc 对接 iPortal/Online 地图类。
  84366. * @category iPortal/Online Resources Map
  84367. * @modulecategory Mapping
  84368. * @extends {L.LayerGroup}
  84369. * @param {number} id - iPortal/Online 地图 id。
  84370. * @param {Object} options - 参数。
  84371. * @param {string} [options.map='map'] - 地图容器 id。
  84372. * @param {string} [options.server] - iPortal/Online 服务地址。
  84373. * @param {boolean} [options.featureLayerPopupEnable=true] - 是否启动要素图层提示框。
  84374. * @param {string} [options.featureLayerPopup] - 提示框提示信息。
  84375. * @param {string} [options.credentialValue] - 证书值。
  84376. * @param {string} [options.credentialKey='key'] - 证书密钥。
  84377. * @param {string} [options.attribution='Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>'] - 版权信息。
  84378. * @fires WebMap#maploaded
  84379. * @fires WebMap#coordconvertsuccess
  84380. * @fires WebMap#coordconvertfailed
  84381. * @fires WebMap#featureunselected
  84382. * @fires WebMap#featureselected
  84383. * @fires WebMap#featuremousemove
  84384. * @usage
  84385. */
  84386. var WebMap = external_L_default().LayerGroup.extend({
  84387. options: {
  84388. map: 'map',
  84389. server: '',
  84390. featureLayerPopupEnable: true,
  84391. featureLayerPopup: null,
  84392. credentialValue: null,
  84393. credentialKey: 'key',
  84394. attribution: core_Attributions.Online.attribution
  84395. },
  84396. /**
  84397. * @private
  84398. * @function WebMap.prototype.defaultFeatureLayerPopup
  84399. * @description 默认图层弹出框。
  84400. * @param {L.Layer} layer - Leaflet Layer 对象。
  84401. * @returns {string} 图层弹出框内容。
  84402. */
  84403. defaultFeatureLayerPopup: function (layer) {
  84404. return layer.feature.properties.attributes.title + ":" + layer.feature.properties.attributes.description;
  84405. },
  84406. initialize: function (id, options) {
  84407. if (!id && !options) {
  84408. return;
  84409. }
  84410. this._layers = {};
  84411. external_L_default().setOptions(this, options);
  84412. this.id = id;
  84413. this.load();
  84414. this.cartoCSSToLeaflet = new CartoCSSToLeaflet();
  84415. },
  84416. /**
  84417. * @private
  84418. * @function WebMap.prototype.load
  84419. * @description 登陆后添加地图图层。
  84420. */
  84421. load: function () {
  84422. if (this.options.server.indexOf('http://') < 0 && this.options.server.indexOf('https://') < 0) {
  84423. this.options.server = "http://" + this.options.server;
  84424. }
  84425. var mapUrl = this.options.server + '/web/maps/' + this.id + '.json';
  84426. if (this.options.credentialValue) {
  84427. mapUrl += ('?' + this.options.credentialKey + '=' + this.options.credentialValue);
  84428. }
  84429. var me = this;
  84430. FetchRequest.get(mapUrl).then(function (response) {
  84431. return response.json()
  84432. }).then(function (jsonObj) {
  84433. if (!jsonObj) {
  84434. return;
  84435. }
  84436. var layers = jsonObj.layers;
  84437. me.mapInfo = jsonObj;
  84438. me.createLayersByJson(layers);
  84439. });
  84440. },
  84441. /**
  84442. * @private
  84443. * @function WebMap.prototype.addLayerWrapper
  84444. * @description 添加图层容器。
  84445. * @param {L.Layer} layer - Leaflet Layer 对象。
  84446. * @param {boolean} [isBaseLayer] - 是否为底图层。
  84447. * @param {Object} options - 参数。
  84448. * @returns {WebMap} WebMap的实例对象。
  84449. */
  84450. addLayerWrapper: function (layer, isBaseLayer, options) {
  84451. if (isBaseLayer) {
  84452. this.createMap(options);
  84453. }
  84454. this.addLayer(layer);
  84455. if (layer.labelLayer) {
  84456. this.addLayer(layer.labelLayer);
  84457. }
  84458. return this;
  84459. },
  84460. /**
  84461. * @private
  84462. * @function WebMap.prototype.createLayersByJson
  84463. * @description 通过 JSON 创建图层。
  84464. * @param {JSONObject} layersJson - 图层的 JSON 信息。
  84465. */
  84466. createLayersByJson: function (layersJson) {
  84467. if (!external_L_default().Util.isArray(layersJson)) {
  84468. return;
  84469. }
  84470. if (layersJson.length === 0) {
  84471. return;
  84472. }
  84473. this.layers = [];
  84474. var layerQueue = [];
  84475. for (var i = 0; i < layersJson.length; i++) {
  84476. var layerJson = layersJson[i];
  84477. layerJson["_originIndex"] = i;
  84478. var layerJsonType = layerJson.layerType = layerJson.layerType || "BASE_LAYER";
  84479. if (layerJsonType !== "BASE_LAYER") {
  84480. //如果图层不是底图,则先加到图层队列里面等待底图完成后再处理
  84481. layerQueue.unshift(layerJson);
  84482. continue;
  84483. } else {
  84484. layerJson.isBaseLayer = true;
  84485. this.createLayer(layerJson.type, layerJson);
  84486. }
  84487. }
  84488. //底图加载完成后开始处理图层队列里的图层
  84489. while (layerQueue.length > 0) {
  84490. var layerInfo = layerQueue.pop();
  84491. var type = layerInfo.type;
  84492. var layerType = layerInfo.layerType = layerInfo.layerType || "BASE_LAYER";
  84493. if (layerType !== "OVERLAY_LAYER") {
  84494. type = layerType;
  84495. }
  84496. this.createLayer(type, layerInfo);
  84497. }
  84498. /**
  84499. * @event WebMap#maploaded
  84500. * @description 底图加载完成后触发。
  84501. * @property {L.Map} map - Leaflet Map 对象。
  84502. */
  84503. this.fire('maploaded', {
  84504. map: this._map
  84505. });
  84506. },
  84507. /**
  84508. * @private
  84509. * @function WebMap.prototype.createCRS
  84510. * @description 创建坐标对象。
  84511. * @param {number} epsgCode - epsg 编码。
  84512. * @param {string} type - 坐标类型。
  84513. * @param {number} resolutions - 分辨率。
  84514. * @param {L.Point} origin - 切片原点。
  84515. * @param {L.Bounds} bounds - 地图范围。
  84516. */
  84517. createCRS: function (epsgCode, type, resolutions, origin, bounds) {
  84518. if (epsgCode < 0) {
  84519. return new NonEarthCRS({
  84520. bounds: bounds,
  84521. origin: origin,
  84522. resolutions: resolutions
  84523. })
  84524. }
  84525. if (epsgCode === 910112 || epsgCode === 910102) {
  84526. return BaiduCRS;
  84527. }
  84528. if (epsgCode === 910111) {
  84529. epsgCode = 3857
  84530. //todo 火星mercator
  84531. }
  84532. if (epsgCode === 910101) {
  84533. epsgCode = 4326
  84534. //todo 火星
  84535. }
  84536. return crs("EPSG:" + epsgCode, {
  84537. origin: origin,
  84538. resolutions: resolutions,
  84539. bounds: bounds
  84540. })
  84541. },
  84542. /**
  84543. * @private
  84544. * @function WebMap.prototype.createMap
  84545. * @description 创建地图。
  84546. * @param {Object} options - 参数。
  84547. */
  84548. createMap: function (options) {
  84549. var crs = options.crs || (external_L_default()).CRS.EPSG3857;
  84550. var bounds = external_L_default().latLngBounds(crs.unproject(options.bounds.min), crs.unproject(options.bounds.max));
  84551. this._map = external_L_default().map(this.options.map, {
  84552. center: bounds.getCenter(),
  84553. maxZoom: options.maxZoom || 22,
  84554. minZoom: options.minZoom || 0,
  84555. zoom: options.zoom || 0,
  84556. crs: crs,
  84557. renderer: external_L_default().canvas()
  84558. });
  84559. if (crs instanceof NonEarthCRS) {
  84560. this._map.setZoom(options.zoom ? options.zoom + 2 : 2, {
  84561. maxZoom: options.maxZoom || 22
  84562. });
  84563. } else {
  84564. this._map.fitBounds(bounds, {
  84565. maxZoom: options.maxZoom || 22
  84566. });
  84567. }
  84568. },
  84569. /**
  84570. * @private
  84571. * @function WebMap.prototype.getResolutionsFromScales
  84572. * @description 通过比例尺获取分辨率。
  84573. * @param {Array.<number>} scales - 排序比例尺数组。
  84574. * @param {number} dpi - 屏幕分辨率。
  84575. * @param {string} units - 地图的单位。
  84576. * @param {Datum} datum - 大地参照系类。
  84577. * @returns {Array.<number>} 返回给定比例尺所对应的分辨率。
  84578. */
  84579. getResolutionsFromScales: function (scales, dpi, units, datum) {
  84580. var resolutions = [];
  84581. for (var i = 0; i < scales.length; i++) {
  84582. resolutions.push(getResolutionFromScaleDpi(scales[i], dpi, units, datum))
  84583. }
  84584. return resolutions;
  84585. },
  84586. /**
  84587. * @private
  84588. * @function WebMap.prototype.createLayer
  84589. * @description 创建图层。
  84590. * @param {string} type - 图层类型。
  84591. * @param {Object} layerInfo - 图层信息。
  84592. */
  84593. createLayer: function (type, layerInfo) {
  84594. var prjCoordSys = layerInfo.prjCoordSys,
  84595. epsgCode = prjCoordSys && prjCoordSys.epsgCode || this.mapInfo.epsgCode,
  84596. center = this.mapInfo.center || layerInfo.center,
  84597. level = this.mapInfo.level || layerInfo.level,
  84598. bounds = this.mapInfo.extent || layerInfo.bounds,
  84599. scales = layerInfo.scales,
  84600. isBaseLayer = layerInfo.isBaseLayer,
  84601. opacity = layerInfo.opacity;
  84602. var mapBounds = external_L_default().bounds([bounds.leftBottom.x, bounds.leftBottom.y], [bounds.rightTop.x, bounds.rightTop.y]);
  84603. var layerBounds = layerInfo.bounds ? external_L_default().bounds([layerInfo.bounds.leftBottom.x, layerInfo.bounds.leftBottom.y], [layerInfo.bounds.rightTop.x, layerInfo.bounds.rightTop.y]) : mapBounds;
  84604. if (!center) {
  84605. center = layerBounds.getCenter();
  84606. }
  84607. var origin = external_L_default().point(layerBounds.min.x, layerBounds.max.y);
  84608. var resolutions = !scales ? null : this.getResolutionsFromScales(scales, 96, layerInfo.units);
  84609. var crs = this.createCRS(epsgCode, prjCoordSys ? prjCoordSys.type : '', resolutions, origin, layerBounds);
  84610. var mapOptions = {
  84611. bounds: mapBounds,
  84612. center: external_L_default().point(center.x, center.y),
  84613. crs: crs,
  84614. zoom: level
  84615. };
  84616. var layer;
  84617. switch (type) {
  84618. case "SUPERMAP_REST":
  84619. layer = tiledMapLayer(layerInfo.url, {
  84620. transparent: true,
  84621. opacity: opacity
  84622. });
  84623. break;
  84624. case "SUPERMAP_REST_VECTOR":
  84625. //ToDO
  84626. break;
  84627. case "TIANDITU_VEC":
  84628. case "TIANDITU_IMG":
  84629. case "TIANDITU_TER":
  84630. mapOptions.crs = epsgCode === 4326 ? TianDiTu_WGS84CRS : TianDiTu_MercatorCRS;
  84631. mapOptions.minZoom = 1;
  84632. mapOptions.zoom = 1 + mapOptions.zoom;
  84633. layer = this.createTiandituLayer(layerInfo);
  84634. break;
  84635. case "BAIDU":
  84636. mapOptions.crs = BaiduCRS;
  84637. mapOptions.zoom = 3 + mapOptions.zoom;
  84638. mapOptions.minZoom = 3;
  84639. layer = baiduTileLayer();
  84640. break;
  84641. case 'BING':
  84642. //todo
  84643. break;
  84644. case "WMS":
  84645. layer = this.createWmsLayer(layerInfo);
  84646. break;
  84647. case "WMTS":
  84648. mapOptions.resolutions = this.getResolutionsFromScales(scales, 90.71446714322, layerInfo.units);
  84649. var identifier = layerInfo.identifier;
  84650. var layerName = identifier.substring(identifier.indexOf("_") + 1);
  84651. layer = wmtsLayer(layerInfo.url, {
  84652. layer: layerName,
  84653. style: "default",
  84654. tilematrixSet: identifier,
  84655. format: "image/png"
  84656. });
  84657. break;
  84658. case "CLOUD":
  84659. mapOptions.crs = (external_L_default()).CRS.EPSG3857;
  84660. mapOptions.zoom = 3 + mapOptions.zoom;
  84661. mapOptions.minZoom = 3;
  84662. layer = cloudTileLayer(layerInfo.url, {
  84663. opacity: opacity
  84664. });
  84665. break;
  84666. case "MARKER_LAYER":
  84667. layer = this.createMarkersLayer(layerInfo, crs);
  84668. break;
  84669. case "FEATURE_LAYER":
  84670. if (layerInfo.identifier == "ANIMATORVECTOR") {
  84671. //todo
  84672. } else if (layerInfo.identifier == "THEME") {
  84673. layer = this.createThemeLayer(layerInfo);
  84674. } else {
  84675. layer = this.createVectorLayer(layerInfo, crs);
  84676. }
  84677. break;
  84678. default:
  84679. throw new Error('unSupported Layer Type');
  84680. }
  84681. if (layer && layerInfo.isVisible) {
  84682. this.addLayerWrapper(layer, isBaseLayer, mapOptions);
  84683. }
  84684. },
  84685. /**
  84686. * @private
  84687. * @function WebMap.prototype.createTiandituLayer
  84688. * @description 创建天地图图层。
  84689. * @param {Object} layerInfo - 图层信息。
  84690. * @returns {tiandituTileLayer} 返回天地图图层对象。
  84691. */
  84692. createTiandituLayer: function (layerInfo) {
  84693. var type = layerInfo.type.split('_')[1].toLowerCase();
  84694. var isLabel = layerInfo.layerType === 'OVERLAY_LAYER';
  84695. var layer = new TiandituTileLayer({
  84696. layerType: type,
  84697. isLabel: isLabel
  84698. });
  84699. return layer;
  84700. },
  84701. /**
  84702. * @private
  84703. * @function WebMap.prototype.createMarkersLayer
  84704. * @description 创建图标图层。
  84705. * @param {Object} layerInfo - 图层信息。
  84706. * @param {Object} crs - 坐标对象。
  84707. * @returns {L.Layer} 返回 marker 图层。
  84708. */
  84709. createMarkersLayer: function (layerInfo, crs) {
  84710. var that = this;
  84711. var markers = layerInfo.markers || [];
  84712. //style = layerInfo.style,
  84713. //opacity = layerInfo.opacity,
  84714. //marker, point, size, offset, icon, that = this;
  84715. //todo offset
  84716. var coordsToLatLng = function (coords) {
  84717. var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
  84718. return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
  84719. };
  84720. var layer = external_L_default().geoJSON(toGeoJSON(markers), {
  84721. pointToLayer: function (geojson, latlng) {
  84722. var m = new (external_L_default()).Marker(latlng);
  84723. m.setStyle = function (style) {
  84724. if (style) {
  84725. m.setIcon(style);
  84726. }
  84727. };
  84728. return m;
  84729. },
  84730. coordsToLatLng: coordsToLatLng,
  84731. style: function (geoJsonFeature) {
  84732. return that.cartoCSSToLeaflet.getStyleFromiPortalMarker(geoJsonFeature.properties.icon);
  84733. }
  84734. });
  84735. if (this.options.featureLayerPopupEnable) {
  84736. layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
  84737. }
  84738. return layer;
  84739. },
  84740. /**
  84741. * @private
  84742. * @function WebMap.prototype.createWmsLayer
  84743. * @description 创建 Wms 图层。
  84744. * @param {Object} layerInfo - 图层信息。
  84745. * @returns {L.Layer} 返回 Wms 图层对象。
  84746. */
  84747. createWmsLayer: function (layerInfo) {
  84748. var url = layerInfo.url,
  84749. opacity = layerInfo.opacity,
  84750. subLayers = layerInfo.subLayers;
  84751. if (!subLayers || subLayers === "undefined" || subLayers === "null") {
  84752. subLayers = "0";
  84753. }
  84754. return external_L_default().tileLayer.wms(url, {
  84755. layers: subLayers,
  84756. format: 'image/png',
  84757. transparent: true,
  84758. noWrap: true,
  84759. opacity: opacity
  84760. })
  84761. },
  84762. /**
  84763. * @private
  84764. * @function WebMap.prototype.createVectorLayer
  84765. * @description 创建矢量要素图层。
  84766. * @param {Object} layerInfo - 图层信息。
  84767. * @param {Object} crs - 坐标对象。
  84768. * @returns {L.Layer} 返回矢量要素图层对象。
  84769. */
  84770. createVectorLayer: function (layerInfo, crs) {
  84771. var style = layerInfo.style,
  84772. opacity = layerInfo.opacity,
  84773. me = this;
  84774. //todo readonly = layerInfo.readonly;
  84775. var coordsToLatLng = function (coords) {
  84776. var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
  84777. return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
  84778. };
  84779. if (!layerInfo.url) {
  84780. var layer = external_L_default().geoJSON(toGeoJSON(layerInfo.features), {
  84781. pointToLayer: function (geojson, latlng) {
  84782. var m = new (external_L_default()).Marker(latlng);
  84783. m.setStyle = function (style) {
  84784. if (style) {
  84785. m.setIcon(style);
  84786. }
  84787. }
  84788. return m;
  84789. },
  84790. coordsToLatLng: coordsToLatLng,
  84791. style: function (geoJsonFeature) {
  84792. let lStyle = me.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
  84793. if (lStyle && lStyle.dashArray && lStyle.dashArray.length == 0) {
  84794. lStyle.dashArray = null;
  84795. }
  84796. return lStyle;
  84797. },
  84798. opacity: opacity
  84799. });
  84800. if (this.options.featureLayerPopupEnable) {
  84801. layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
  84802. }
  84803. return layer;
  84804. } else {
  84805. var url = layerInfo.url,
  84806. datasourceName = layerInfo.name,
  84807. datasets = layerInfo.features;
  84808. for (var setNameIndex = 0; setNameIndex < datasets.length; setNameIndex++) {
  84809. var dataset = datasets[setNameIndex];
  84810. if (dataset.visible) {
  84811. this.getFeaturesBySQL(url, datasourceName, dataset.name, "", DataFormat.GEOJSON, (serviceResult) => {
  84812. var layer = external_L_default().geoJSON(serviceResult.result, {
  84813. pointToLayer: function (geojson, latlng) {
  84814. var m = new (external_L_default()).Marker(latlng);
  84815. m.setStyle = function (style) {
  84816. if (style) {
  84817. m.setIcon(style);
  84818. }
  84819. };
  84820. return m;
  84821. },
  84822. coordsToLatLng: coordsToLatLng,
  84823. style: function (geoJsonFeature) {
  84824. return this.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
  84825. },
  84826. opacity: opacity
  84827. });
  84828. if (this.options.featureLayerPopupEnable) {
  84829. layer.bindPopup(me.options.featureLayerPopup || me.defaultFeatureLayerPopup)
  84830. }
  84831. this.addLayer(layer);
  84832. })
  84833. }
  84834. }
  84835. }
  84836. },
  84837. getFeaturesBySQL: function (url, datasourceName, datasetName, filter, format, callback) {
  84838. filter = filter || "SMID > 0";
  84839. var sqlParam = new GetFeaturesBySQLParameters({
  84840. queryParameter: {
  84841. name: datasetName + "@" + datasourceName,
  84842. attributeFilter: filter
  84843. },
  84844. datasetNames: [datasourceName + ":" + datasetName],
  84845. fromIndex: 0,
  84846. toIndex: 100000
  84847. });
  84848. FeatureService_featureService(url).getFeaturesBySQL(sqlParam, callback, format);
  84849. },
  84850. /**
  84851. * @private
  84852. * @function WebMap.prototype.createThemeLayer
  84853. * @description 创建专题图图层。
  84854. * @param {Object} layerInfo - 图层信息。
  84855. * @returns {L.Layer} 返回专题图图层对象。
  84856. */
  84857. createThemeLayer: function (layerInfo) {
  84858. var themeSettings = layerInfo.themeSettings && JSON.parse(layerInfo.themeSettings);
  84859. var layer;
  84860. var type = themeSettings.type;
  84861. layerInfo.themeSettings = themeSettings;
  84862. if (type === "HEAT") {
  84863. layer = this.createHeatLayer(layerInfo, themeSettings);
  84864. } else if (type === "UNIQUE") {
  84865. layer = this.createUniqueLayer(layerInfo, themeSettings);
  84866. } else if (type === "RANGE") {
  84867. layer = this.createRangeLayer(layerInfo, themeSettings);
  84868. } else {
  84869. layer = this.createBaseThemeLayer(layerInfo, themeSettings);
  84870. }
  84871. if (layer) {
  84872. this.addFeature2ThemeLayer(layerInfo, layer);
  84873. layer.on('add', (e) => {
  84874. this.registerThemeEvent(e.target);
  84875. })
  84876. }
  84877. if (themeSettings && themeSettings.labelField) {
  84878. var labelLayer = this.createLabelLayer(layerInfo, themeSettings);
  84879. labelLayer.on('add', (e) => {
  84880. this.registerThemeEvent(e.target);
  84881. });
  84882. layer.labelLayer = labelLayer;
  84883. }
  84884. return layer;
  84885. },
  84886. createBaseThemeLayer: function (layerInfo, themeSettings) {
  84887. let style = layerInfo.style,
  84888. opacity = layerInfo.opacity,
  84889. vectorType = themeSettings.vectorType,
  84890. featureStyle = style.pointStyle;
  84891. if (vectorType === "LINE") {
  84892. featureStyle.fill = false;
  84893. } else {
  84894. featureStyle.fill = true;
  84895. }
  84896. var pointStyle = {};
  84897. pointStyle.radius = featureStyle.pointRadius;
  84898. pointStyle.color = featureStyle.strokeColor;
  84899. pointStyle.opacity = featureStyle.strokeOpacity;
  84900. pointStyle.lineCap = featureStyle.strokeLineCap;
  84901. pointStyle.weight = featureStyle.strokeWidth;
  84902. pointStyle.fillColor = featureStyle.fillColor;
  84903. pointStyle.fillOpacity = featureStyle.fillOpacity;
  84904. var pointToLayer = (geojson, latlng) => {
  84905. return external_L_default().circleMarker(latlng, pointStyle);
  84906. };
  84907. if (featureStyle.unicode) {
  84908. pointToLayer = (geojson, latlng) => {
  84909. return new UnicodeMarker(latlng, featureStyle)
  84910. }
  84911. }
  84912. return external_L_default().geoJSON({
  84913. type: "GeometryCollection",
  84914. geometries: []
  84915. }, {
  84916. pointToLayer: pointToLayer,
  84917. opacity: opacity
  84918. });
  84919. //this.registerVectorEvent(vector);
  84920. },
  84921. createUniqueLayer: function (layerInfo, themeSettings) {
  84922. var title = layerInfo.title;
  84923. var themeField = themeSettings.field,
  84924. styleGroups = [],
  84925. settings = themeSettings.settings,
  84926. isVisible = layerInfo.isVisible,
  84927. opacity = layerInfo.opacity,
  84928. vectorType = themeSettings.vectorType;
  84929. //组成styleGroup
  84930. for (var i = 0; i < settings.length; i++) {
  84931. var object = {};
  84932. object.value = settings[i].value;
  84933. object.style = settings[i].style;
  84934. styleGroups.push(object);
  84935. }
  84936. var unique = new UniqueThemeLayer(title, {
  84937. opacity: opacity,
  84938. visibility: isVisible
  84939. });
  84940. this.registerThemeEvent(unique);
  84941. unique.style = layerInfo.style.pointStyle;
  84942. if (vectorType === "LINE") {
  84943. unique.style.fill = false;
  84944. } else {
  84945. unique.style.fill = true;
  84946. }
  84947. unique.style.stroke = true;
  84948. unique.themeField = themeField;
  84949. unique.styleGroups = styleGroups;
  84950. var that = this;
  84951. unique.on('click', function (event) {
  84952. if (event.target && event.target.refDataID) {
  84953. var currenFeature = unique.getFeatureById(event.target.refDataID);
  84954. that.events.triggerEvent("uniquefeatureclicked", currenFeature, unique);
  84955. }
  84956. });
  84957. return unique;
  84958. },
  84959. createRangeLayer: function (layerInfo, themeSettings) {
  84960. var title = layerInfo.title;
  84961. var themeField = themeSettings.field,
  84962. styleGroups = [],
  84963. settings = themeSettings.settings,
  84964. isVisible = layerInfo.isVisible,
  84965. opacity = layerInfo.opacity,
  84966. vectorType = themeSettings.vectorType,
  84967. featureStyle = layerInfo.style.pointStyle;
  84968. if (vectorType === "LINE") {
  84969. featureStyle.fill = false;
  84970. } else {
  84971. featureStyle.fill = true;
  84972. }
  84973. //组成styleGroup
  84974. for (var i = 0; i < settings.length; i++) {
  84975. var object = {};
  84976. object.start = settings[i].start;
  84977. object.end = settings[i].end;
  84978. object.style = settings[i].style;
  84979. styleGroups.push(object);
  84980. }
  84981. var range = new RangeThemeLayer(title, {
  84982. visibility: isVisible,
  84983. opacity: opacity
  84984. });
  84985. this.registerThemeEvent(range);
  84986. range.style = layerInfo.style.pointStyle;
  84987. range.style.stroke = true;
  84988. range.themeField = themeField;
  84989. range.styleGroups = styleGroups;
  84990. return range;
  84991. },
  84992. createLabelLayer: function (layerInfo, themeSettings) {
  84993. var title = layerInfo.title;
  84994. var labelField = themeSettings.labelField,
  84995. settings = themeSettings.settings,
  84996. isVisible = layerInfo.isVisible;
  84997. //目前只是同一样式
  84998. var style;
  84999. if (!settings || settings.length > 0) {
  85000. style = {
  85001. "fillColor": "#ffffff"
  85002. };
  85003. } else {
  85004. style = settings[0].style;
  85005. }
  85006. var layerStyle = external_L_default().Util.extend(new ThemeStyle(), style);
  85007. layerStyle.fontWeight = "bold";
  85008. layerStyle.fontSize = "14px";
  85009. //默认显示标签边框背景
  85010. layerStyle.labelRect = true;
  85011. layerStyle.strokeColor = layerStyle.fillColor;
  85012. layerStyle.fontColor = themeSettings.labelColor;
  85013. if (themeSettings.labelFont) {
  85014. layerStyle.fontFamily = themeSettings.labelFont;
  85015. }
  85016. var label = new LabelThemeLayer(title, {
  85017. visibility: isVisible,
  85018. opacity: 0.7
  85019. });
  85020. this.registerThemeEvent(label);
  85021. label.style = layerStyle;
  85022. label.themeField = labelField;
  85023. //styleGroup, 目前只是同一样式
  85024. label.styleGroups = [];
  85025. return label;
  85026. },
  85027. createHeatLayer: function (layerInfo, themeSettings) {
  85028. let colors = themeSettings.colors || ['blue', 'cyan', 'lime', 'yellow', 'red'];
  85029. let gradient = {},
  85030. featureWeight;
  85031. for (let i = 0, len = colors.length, index = 1; i < len; i++) {
  85032. gradient[index / len] = colors[i];
  85033. index++;
  85034. }
  85035. let radius = themeSettings.settings[0].radius;
  85036. //判断单位
  85037. if (themeSettings.heatUnit === "千米" || themeSettings.heatUnit === "km") {
  85038. radius = themeSettings.heatRadius * 1000
  85039. }
  85040. //权重
  85041. if (themeSettings.settings[0] && themeSettings.settings[0].featureWeight) {
  85042. featureWeight = themeSettings.settings[0].featureWeight;
  85043. }
  85044. return external_L_default().heatLayer([], {
  85045. radius: radius / 2,
  85046. minOpacity: layerInfo.opacity,
  85047. gradient: gradient,
  85048. blur: radius / 2,
  85049. featureWeight: featureWeight
  85050. })
  85051. },
  85052. addFeature2ThemeLayer: function (layerInfo, layer) {
  85053. if (layerInfo.layerType !== "FEATURE_LAYER" || layerInfo.identifier !== "THEME") {
  85054. return;
  85055. }
  85056. var me = this;
  85057. var isRestData = !!layerInfo.datasourceName;
  85058. var cartoCSS = layerInfo.cartoCSS;
  85059. if (cartoCSS) {
  85060. var needTransform = this.getCartoCSS2Obj(cartoCSS).needTransform;
  85061. var isAddFile = this.getCartoCSS2Obj(cartoCSS).isAddFile;
  85062. }
  85063. var url = layerInfo.url,
  85064. subLayers, subLayer, layerName, credential = layerInfo.credential,
  85065. themeSettings = layerInfo.themeSettings,
  85066. filter = themeSettings.filter;
  85067. if (isAddFile) {
  85068. var position = JSON.parse(layerInfo.datasourceName);
  85069. var sql = this.getSQLFromFilter(filter);
  85070. if (url) {
  85071. this.getFeatureFromFileAdded(layerInfo, function (data) {
  85072. var sFeaturesArr = [],
  85073. features, result;
  85074. if (data.type === 'EXCEL' || data.type === 'CSV') {
  85075. features = me.parseFeatureFromEXCEL.apply(me, [data.content.rows, data.content.colTitles, false, position]);
  85076. for (var x = 0, len = features.length; x < len; x++) {
  85077. result = jsonsql_default()({
  85078. attr: features[x].attributes
  85079. }, sql);
  85080. if (result.length > 0) {
  85081. sFeaturesArr.push(features[x])
  85082. }
  85083. }
  85084. } else {
  85085. features = me.parseFeatureFromJson(data.content);
  85086. for (var i = 0, length = features.length; i < length; i++) {
  85087. result = jsonsql_default()({
  85088. attr: features[i].attributes
  85089. }, sql);
  85090. if (result.length > 0) {
  85091. sFeaturesArr.push(features[i]);
  85092. }
  85093. }
  85094. }
  85095. var newEpsgCode = '4326',
  85096. oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  85097. if (needTransform) {
  85098. me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, sFeaturesArr, function (features) {
  85099. addFeatures(features);
  85100. });
  85101. } else {
  85102. addFeatures(sFeaturesArr);
  85103. }
  85104. }, function () {});
  85105. } else {
  85106. var newFeautures = [],
  85107. features = layerInfo.features;
  85108. for (var i = 0, len = features.length; i < len; i++) {
  85109. var feature = features[i];
  85110. var sqlResult = jsonsql_default()({
  85111. attr: feature.attributes
  85112. }, sql);
  85113. if (sqlResult.length > 0) {
  85114. var lon = feature.geometry.points[0].x,
  85115. lat = feature.geometry.points[0].y;
  85116. var point = new Point(lon, lat);
  85117. var vector = new Vector(point, feature.attributes, feature.style);
  85118. newFeautures.push(vector);
  85119. }
  85120. }
  85121. addFeatures(newFeautures);
  85122. }
  85123. } else if (isRestData) {
  85124. var dataSourceName = layerInfo.datasourceName;
  85125. subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
  85126. if (subLayers.length && subLayers.length > 0) {
  85127. subLayer = subLayers[0];
  85128. } else {
  85129. subLayer = subLayers;
  85130. }
  85131. layerName = subLayer && subLayer.name;
  85132. this.getFeaturesBySQL(layerInfo.url, dataSourceName, layerName, themeSettings.filter, DataFormat.ISERVER, (getFeaturesEventArgs) => {
  85133. var features, feature, result = getFeaturesEventArgs.result,
  85134. addedFeatures = [];
  85135. if (result && result.features) {
  85136. features = result.features;
  85137. for (var fi = 0, felen = features.length; fi < felen; fi++) {
  85138. feature = ServerFeature.fromJson(features[fi]).toFeature();
  85139. addedFeatures.push(feature);
  85140. }
  85141. var newEpsgCode = '4326',
  85142. oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  85143. if (needTransform) {
  85144. this.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, addedFeatures, function (features) {
  85145. addFeatures(features);
  85146. });
  85147. } else {
  85148. addFeatures(features);
  85149. }
  85150. }
  85151. })
  85152. } else {
  85153. subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
  85154. if (subLayers.length && subLayers.length > 0) {
  85155. subLayer = subLayers[0];
  85156. } else {
  85157. subLayer = subLayers;
  85158. }
  85159. layerName = subLayer && subLayer.name;
  85160. var oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  85161. this.getFeaturesBySQL(url, credential, layerName, filter, DataFormat.ISERVER, function (features) {
  85162. var newEpsgCode = '4326';
  85163. if (needTransform) {
  85164. me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, features, function (features) {
  85165. addFeatures(features);
  85166. });
  85167. } else {
  85168. addFeatures(features);
  85169. }
  85170. });
  85171. }
  85172. function addFeatures(features) {
  85173. if (layer && layer.labelLayer instanceof LabelThemeLayer) {
  85174. me.addFeature2LabelLayer(layer.labelLayer, features, layerInfo);
  85175. }
  85176. if ((external_L_default()).HeatLayer && layer instanceof (external_L_default()).HeatLayer) {
  85177. var heatPoints = [];
  85178. for (let i = 0, len = features.length; i < len; i++) {
  85179. let geometry = features[i].geometry;
  85180. heatPoints[i] = external_L_default().latLng(geometry.y, geometry.x);
  85181. if (layer.options.featureWeight) {
  85182. heatPoints[i] = [heatPoints[i].lat, heatPoints[i].lng, parseFloat(features[i].attributes[layer.options.featureWeight])];
  85183. }
  85184. }
  85185. layer.setLatLngs(heatPoints);
  85186. } else if (layer instanceof (external_L_default()).GeoJSON) {
  85187. layer.addData(new GeoJSON().toGeoJSON(features));
  85188. } else {
  85189. layer.addFeatures(features);
  85190. }
  85191. }
  85192. },
  85193. addFeature2LabelLayer: function (layer, features, layerInfo) {
  85194. if (!features) {
  85195. return;
  85196. }
  85197. var feature, geoTextFeature;
  85198. var themeSettings = layerInfo.themeSettings;
  85199. themeSettings = typeof themeSettings === "string" ? JSON.parse(layerInfo.themeSettings) : layerInfo.themeSettings;
  85200. var themeField = themeSettings.labelField;
  85201. var style = layer.style;
  85202. var labelFeatures = [],
  85203. lngLat;
  85204. var styleInfo = layerInfo.styleString && JSON.parse(layerInfo.styleString);
  85205. for (var i = 0; i < features.length; i++) {
  85206. lngLat = this.getLabelLngLat(themeSettings.vectorType, features[i]);
  85207. //设置标签的偏移量
  85208. this.setLabelOffset(themeSettings.vectorType, styleInfo, features[i], style);
  85209. feature = features[i];
  85210. var attributes = feature.attributes;
  85211. geoTextFeature = new ThemeFeature([lngLat.lat, lngLat.lng, attributes[themeField]], attributes);
  85212. labelFeatures.push(geoTextFeature);
  85213. }
  85214. layer.style = style;
  85215. layer.addFeatures(labelFeatures);
  85216. },
  85217. setLabelOffset: function (vectorType, styleInfo, feature, layerStyle) {
  85218. if (vectorType === 'POINT') {
  85219. var pointRadius = styleInfo.pointStyle.pointRadius || 0;
  85220. var strokeWidth = styleInfo.pointStyle.strokeWidth || 0;
  85221. var fontSize = parseInt(styleInfo.pointStyle.fontSize) || 0;
  85222. layerStyle.labelXOffset = 0;
  85223. layerStyle.labelYOffset = styleInfo.pointStyle.unicode ? 20 + fontSize : 25 + (pointRadius + strokeWidth);
  85224. } else {
  85225. return;
  85226. }
  85227. },
  85228. getLabelLngLat: function (vectorType, feature) {
  85229. var lngLat = {};
  85230. if (vectorType === 'POINT') {
  85231. var geometry = feature.geometry;
  85232. lngLat.lng = geometry.x;
  85233. lngLat.lat = geometry.y;
  85234. } else if (vectorType === 'LINE') {
  85235. //一条线所有顶点的数量
  85236. var length, index;
  85237. var components = feature.geometry.components;
  85238. if (components[0].x) {
  85239. //说明是lineString类型
  85240. length = components.length;
  85241. //线取中间点下一个显示标签
  85242. index = parseInt(length / 2);
  85243. lngLat.lng = components[index].x;
  85244. lngLat.lat = components[index].y;
  85245. } else {
  85246. //说明是MultiLineString类型,取第一条线
  85247. var lineOne = components[0].components;
  85248. length = lineOne.length;
  85249. index = parseInt(length / 2);
  85250. lngLat.lng = lineOne[index].x;
  85251. lngLat.lat = lineOne[index].y;
  85252. }
  85253. } else {
  85254. var centroid = feature.geometry.getCentroid();
  85255. lngLat.lng = centroid.x;
  85256. lngLat.lat = centroid.y;
  85257. }
  85258. return lngLat;
  85259. },
  85260. changeFeatureLayerEpsgCode: function (oldEpsgCode, newEpsgCode, layer, features, success) {
  85261. var me = this,
  85262. i, len;
  85263. var points = [];
  85264. if (!oldEpsgCode || !newEpsgCode) {
  85265. return;
  85266. }
  85267. if (features && features.length > 0) {
  85268. for (i = 0, len = features.length; i < len; i++) {
  85269. var feature = features[i];
  85270. var geometry = feature.geometry;
  85271. var vertices = geometry.getVertices();
  85272. points = points.concat(vertices);
  85273. }
  85274. oldEpsgCode = 'EPSG:' + oldEpsgCode;
  85275. newEpsgCode = 'EPSG:' + newEpsgCode;
  85276. me.coordsTransform(oldEpsgCode, newEpsgCode, points, function (layer, features) {
  85277. return function (newCoors) {
  85278. var start = 0,
  85279. len = newCoors.length;
  85280. for (i = start; i < len; i++) {
  85281. var point = points[i],
  85282. coor = newCoors[i];
  85283. point.x = coor.x;
  85284. point.y = coor.y;
  85285. point.calculateBounds();
  85286. }
  85287. for (i = 0, len = features.length; i < len; i++) {
  85288. var feature = features[i];
  85289. var geometry = feature.geometry;
  85290. if (geometry.components) {
  85291. me.calculateComponents(geometry.components);
  85292. }
  85293. geometry.calculateBounds();
  85294. }
  85295. success && success.call(me, features);
  85296. }
  85297. }(layer, features));
  85298. }
  85299. return true;
  85300. },
  85301. calculateComponents: function (components) {
  85302. if (components) {
  85303. if (components.components) {
  85304. this.calculateComponents(components.components);
  85305. } else {
  85306. for (var i = 0, len = components.length; i < len; i++) {
  85307. var component = components[i];
  85308. if (component.components) {
  85309. this.calculateComponents(component.components)
  85310. }
  85311. component.calculateBounds();
  85312. }
  85313. }
  85314. }
  85315. },
  85316. coordsTransform: function (fromEpsg, toEpsg, point, success) {
  85317. var newCoord;
  85318. var from = this.SERVER_TYPE_MAP[fromEpsg],
  85319. to = this.SERVER_TYPE_MAP[toEpsg];
  85320. if (fromEpsg === toEpsg || !from || !to) {
  85321. if (point && point.length !== undefined) {
  85322. newCoord = [];
  85323. for (var i = 0, len = point.length; i < len; i++) {
  85324. var coor = {
  85325. x: point[i].x,
  85326. y: point[i].y
  85327. };
  85328. newCoord.push(coor);
  85329. }
  85330. } else {
  85331. newCoord = {
  85332. x: point.x,
  85333. y: point.y
  85334. };
  85335. }
  85336. if (success) {
  85337. success.call(this, newCoord);
  85338. }
  85339. } else {
  85340. var mercator = this.SERVER_TYPE_MAP['EPSG:3857'],
  85341. wgs84 = this.SERVER_TYPE_MAP['EPSG:4326'];
  85342. if ((from === mercator || from === wgs84) && (to === mercator || to === wgs84)) {
  85343. this.projTransform(fromEpsg, toEpsg, point, success);
  85344. } else {
  85345. var convertType = from + '_' + to;
  85346. this.postTransform(convertType, point, success);
  85347. }
  85348. }
  85349. },
  85350. projTransform: function (fromEpsg, toEpsg, point, success) {
  85351. var newCoor, me = this;
  85352. if (!(proj4_src_default())) {
  85353. return;
  85354. }
  85355. if (point && point.length !== undefined) {
  85356. newCoor = [];
  85357. for (var i = 0, len = point.length; i < len; i++) {
  85358. var coor = proj4_src_default()(fromEpsg, toEpsg, [point[i].x, point[i].y]);
  85359. newCoor.push({
  85360. x: coor[0],
  85361. y: coor[1]
  85362. });
  85363. }
  85364. } else {
  85365. newCoor = proj4_src_default()(fromEpsg, toEpsg, [point.x, point.y]);
  85366. newCoor = {
  85367. x: newCoor[0],
  85368. y: newCoor[1]
  85369. };
  85370. }
  85371. if (success) {
  85372. /**
  85373. * @event WebMap#coordconvertsuccess
  85374. * @description 坐标转换成功后触发。
  85375. * @property {L.LatLng} newCoor - 转换成功后的坐标。
  85376. */
  85377. me.fire('coordconvertsuccess', {
  85378. newCoor: newCoor
  85379. });
  85380. success.call(me, newCoor);
  85381. }
  85382. },
  85383. postTransform: function (convertType, point, success) {
  85384. var me = this,
  85385. epsgArray = [];
  85386. if (!convertType) {
  85387. return success.call(me, null);
  85388. }
  85389. if (point && point.length !== undefined) {
  85390. for (var i = 0, len = point.length; i < len; i++) {
  85391. epsgArray.push({
  85392. x: point[i].x,
  85393. y: point[i].y
  85394. });
  85395. }
  85396. } else {
  85397. epsgArray = [{
  85398. x: point.x,
  85399. y: point.y
  85400. }];
  85401. }
  85402. if (epsgArray.length === 0) {
  85403. return success.call(me, null);
  85404. }
  85405. var postData = {
  85406. "convertType": convertType,
  85407. "points": epsgArray
  85408. };
  85409. var url = this.server + "/apps/viewer/coordconvert.json";
  85410. postData = JSON.stringify(postData);
  85411. var options = {};
  85412. if (!Util_Util.isInTheSameDomain(url) && this.proxy) {
  85413. options.proxy = this.proxy;
  85414. }
  85415. FetchRequest.post(url, postData, options).then((response) => {
  85416. return response.json()
  85417. }).then((jsonObj) => {
  85418. var newCoors = jsonObj;
  85419. if (!point && point.length !== undefined) {
  85420. newCoors = newCoors[0];
  85421. }
  85422. this.fire('coordconvertsuccess', {
  85423. newCoors: newCoors
  85424. });
  85425. success.call(this, newCoors);
  85426. }).catch((err) => {
  85427. if (!this.actived) {
  85428. return;
  85429. }
  85430. /**
  85431. * @event WebMap#coordconvertfailed
  85432. * @description 坐标转换失败后触发。
  85433. * @property {Object} err - error 对象。
  85434. */
  85435. this.fire('coordconvertfailed', {
  85436. err: err
  85437. });
  85438. })
  85439. },
  85440. getSQLFromFilter: function (filter) {
  85441. if (!filter) {
  85442. return ' * where (1==1||1>=0)'
  85443. } else {
  85444. filter = filter.replace(/=/g, '==').replace(/and|AND/g, '&&').replace(/or|OR/g, '||').replace(/>==/g, '>=').replace(/<==/g, '<=');
  85445. return ' * where (' + filter + ')';
  85446. }
  85447. },
  85448. getAttributesObjFromTable: function (cols, colTitles) {
  85449. if (cols.length === 0 || colTitles.length === 0) {
  85450. return;
  85451. }
  85452. var attrArr = [];
  85453. for (var i = 0; i < cols.length; i++) {
  85454. var obj = {};
  85455. for (var j = 0; j < colTitles.length; j++) {
  85456. obj[colTitles[j]] = cols[i][j]
  85457. }
  85458. attrArr.push(obj);
  85459. }
  85460. return attrArr;
  85461. },
  85462. parseFeatureFromEXCEL: function (rows, colTitles, isGraphic, position) {
  85463. var attrArr = this.getAttributesObjFromTable(rows, colTitles);
  85464. var features = [];
  85465. for (var i = 0, len = attrArr.length; i < len; i++) {
  85466. var lon = attrArr[i][position["lon"]];
  85467. var lat = attrArr[i][position["lat"]];
  85468. if (!lon || !lat) {
  85469. continue;
  85470. }
  85471. lon = parseFloat(lon);
  85472. lat = parseFloat(lat);
  85473. var geometry = new Point(lon, lat);
  85474. var pointGraphic;
  85475. if (isGraphic) {
  85476. pointGraphic = new Graphic(geometry, attrArr[i], null);
  85477. } else {
  85478. pointGraphic = new Vector(geometry, attrArr[i], null);
  85479. }
  85480. features.push(pointGraphic);
  85481. }
  85482. return features;
  85483. },
  85484. parseFeatureFromJson: function (feature) {
  85485. var format = new GeoJSON();
  85486. var features = format.read(feature);
  85487. //兼容insights数据格式
  85488. if (features == null) {
  85489. var content = JSON.parse(feature.replace(/'/, '"'));
  85490. if (content.isAnalyseResult || content.type === 'MapEditor' || content.type === 'DataInsights' || content.type === 'ISERVER') {
  85491. content = content.data.recordsets[0].features;
  85492. }
  85493. format = new GeoJSON();
  85494. features = format.read(content);
  85495. }
  85496. for (var i = 0, len = features.length; i < len; i++) {
  85497. features[i].attributes = features[i].attributes.properties || features[i].attributes;
  85498. }
  85499. return features;
  85500. },
  85501. getFeatureFromFileAdded: function (layerInfo, success, failed, isGraphic) {
  85502. var url = isGraphic ? layerInfo.url + '?currentPage=1&&pageSize=9999999' : layerInfo.url;
  85503. FetchRequest.get(url).then(response => response.json()).then(data => {
  85504. success && success(data);
  85505. }).catch(err => failed && failed(err));
  85506. },
  85507. getCartoCSS2Obj: function (cartoCSS) {
  85508. var isAddFile, needTransform = false;
  85509. if (cartoCSS.indexOf('}') > -1) {
  85510. cartoCSS = JSON.parse(cartoCSS);
  85511. needTransform = cartoCSS.needTransform;
  85512. isAddFile = cartoCSS.isAddFile;
  85513. } else {
  85514. if (cartoCSS === 'needTransform') {
  85515. needTransform = true;
  85516. //layerInfo.needTransform = true;
  85517. isAddFile = false;
  85518. } else {
  85519. isAddFile = cartoCSS === 'true';
  85520. }
  85521. }
  85522. return {
  85523. isAddFile: isAddFile,
  85524. needTransform: needTransform
  85525. }
  85526. },
  85527. registerThemeEvent: function (themeLayer) {
  85528. themeLayer.on('click', evt => {
  85529. if (!themeLayer.map) {
  85530. return;
  85531. }
  85532. if (this.selectedFeature) {
  85533. /**
  85534. * @event WebMap#featureunselected
  85535. * @description 重置选中的要素为空。
  85536. * @property {FeatureVector} feature - 在重置之前选中的要素。
  85537. */
  85538. this.fire('featureunselected', {
  85539. feature: this.selectedFeature
  85540. });
  85541. this.selectedFeature = null;
  85542. }
  85543. let feature;
  85544. if (evt.target && evt.target.refDataID) {
  85545. feature = themeLayer.getFeatureById(evt.target.refDataID);
  85546. }
  85547. if (feature) {
  85548. this.selectedFeature = feature;
  85549. /**
  85550. * @event WebMap#featureselected
  85551. * @description 点击要素,要素存在之后触发。设置选中的要素。
  85552. * @property {FeatureVector} feature - 点击的要素。
  85553. */
  85554. this.fire('featureselected', {
  85555. feature: feature
  85556. });
  85557. }
  85558. });
  85559. themeLayer.on('mousemove', evt => {
  85560. if (!themeLayer.map) {
  85561. return;
  85562. }
  85563. if (evt.target && evt.target.refDataID) {
  85564. let feature;
  85565. if (evt.target && evt.target.refDataID) {
  85566. feature = themeLayer.getFeatureById(evt.target.refDataID);
  85567. }
  85568. if (feature) {
  85569. /**
  85570. * @event WebMap#featuremousemove
  85571. * @description 鼠标移动到要素上之后触发。
  85572. * @property {FeatureVector} feature - 当前被移动到的要素。
  85573. */
  85574. this.fire('featuremousemove', {
  85575. feature: feature
  85576. });
  85577. }
  85578. }
  85579. });
  85580. },
  85581. SERVER_TYPE_MAP: {
  85582. "EPSG:4326": "WGS84",
  85583. "EPSG:3857": "MERCATOR",
  85584. "EPSG:900913": "MERCATOR",
  85585. "EPSG:102113": "MERCATOR",
  85586. "EPSG:910101": "GCJ02",
  85587. "EPSG:910111": "GCJ02MERCATOR",
  85588. "EPSG:910102": "BD",
  85589. "EPSG:910112": "BDMERCATOR"
  85590. }
  85591. });
  85592. var webMap = function (id, options) {
  85593. return new WebMap(id, options);
  85594. };
  85595. ;// CONCATENATED MODULE: ./src/leaflet/mapping/ImageTileLayer.js
  85596. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85597. * This program are made available under the terms of the Apache License, Version 2.0
  85598. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85599. /**
  85600. * @class ImageTileLayer
  85601. * @deprecatedclassinstance L.supermap.imageTileLayer
  85602. * @version 10.2.0
  85603. * @classdesc iServer 影像服务图层源。根据请求参数,返回指定的影像数据栅格瓦片并渲染。
  85604. * @category iServer Image
  85605. * @extends {L.TileLayer}
  85606. * @example
  85607. * new ImageTileLayer(url,{collectionId:'xxx'}).addTo(map);
  85608. * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  85609. * @param {Object} options - 参数。
  85610. * @param {string} options.collectionId - 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  85611. * @param {string} [options.sqlFilter] 对所显示影像的过滤条件。相当于SQL查询中的where子句。支持st_geometry空间函数过滤。11.0版本暂不支持通过ECQL进行过滤。
  85612. * @param {ImageRenderingRule} [options.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
  85613. * @param {Array.<number>} [options.ids] 返回影像集合中指定ID的影像,该ID为系统维护的一个自增ID,为SuperMap SDX引擎的SmID字段内容。
  85614. * @param {Array.<string>} [options.names] 返回影像集合中指定名称影像的瓦片资源。影像名称包含文件后缀,如S-60-45.tif。
  85615. * @param {string} [options.format='png'] - 瓦片表述类型,瓦片格式目前支持png、jpg和webp三种格式。
  85616. * @param {boolean} [options.transparent=true] - 瓦片是否透明。默认透明。
  85617. * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
  85618. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  85619. * @param {Array.<number>} [options.subdomains] - 子域名数组。
  85620. * @param {string} [options.tileProxy] - 服务代理地址。
  85621. * @usage
  85622. */
  85623. var ImageTileLayer = external_L_default().TileLayer.extend({
  85624. options: {
  85625. collectionId: null,
  85626. sqlFilter: null,
  85627. ids: null,
  85628. names: null,
  85629. renderingRule: null,
  85630. format: 'png',
  85631. zoomOffset: 1,
  85632. transparent: true,
  85633. cacheEnabled: true,
  85634. tileProxy: null, //启用托管地址。
  85635. attribution: core_Attributions.Common.attribution,
  85636. subdomains: null
  85637. },
  85638. initialize: function (url, options) {
  85639. this._url = url;
  85640. external_L_default().TileLayer.prototype.initialize.apply(this, arguments);
  85641. external_L_default().setOptions(this, options);
  85642. external_L_default().stamp(this);
  85643. },
  85644. /**
  85645. * @private
  85646. * @function ImageTileLayer.prototype.onAdd
  85647. * @description 添加地图。
  85648. * @param {L.Map} map - Leaflet Map 对象。
  85649. */
  85650. onAdd: function (map) {
  85651. external_L_default().TileLayer.prototype.onAdd.call(this, map);
  85652. },
  85653. /**
  85654. * @function ImageTileLayer.prototype.getTileUrl
  85655. * @description 根据行列号获取瓦片地址。
  85656. * @param {Object} coords - 行列号。
  85657. * @returns {string} 瓦片地址。
  85658. */
  85659. getTileUrl: function (coords) {
  85660. var layerUrl = this._getLayerUrl();
  85661. var tileUrl = layerUrl + '&z=' + this._getZoomForUrl() + '&x=' + coords.x + '&y=' + coords.y;
  85662. //支持代理
  85663. if (this.options.tileProxy) {
  85664. tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
  85665. }
  85666. if (!this.options.cacheEnabled) {
  85667. tileUrl += '&_t=' + new Date().getTime();
  85668. }
  85669. if (this.options.subdomains) {
  85670. tileUrl = external_L_default().Util.template(tileUrl, { s: this._getSubdomain(coords) });
  85671. }
  85672. return tileUrl;
  85673. },
  85674. _getLayerUrl: function () {
  85675. return this._layerUrl || this._createLayerUrl();
  85676. },
  85677. _createLayerUrl: function () {
  85678. let layerUrl = Util_Util.urlPathAppend(
  85679. this._url,
  85680. `/collections/${this.options.collectionId}/tile.${this.options.format}`
  85681. );
  85682. this.requestParams = this.requestParams || this._getAllRequestParams();
  85683. layerUrl = Util_Util.urlAppend(layerUrl, external_L_namespaceObject.Util.getParamString(this.requestParams));
  85684. layerUrl = SecurityManager.appendCredential(layerUrl);
  85685. this._layerUrl = layerUrl;
  85686. return layerUrl;
  85687. },
  85688. _getAllRequestParams: function () {
  85689. var me = this,
  85690. options = me.options || {},
  85691. params = {};
  85692. params['transparent'] = options.transparent === true;
  85693. params['cacheEnabled'] = !(options.cacheEnabled === false);
  85694. if (options.sqlFilter) {
  85695. params['sqlFilter'] = options.sqlFilter;
  85696. }
  85697. if (options.renderingRule) {
  85698. params['renderingRule'] = JSON.stringify(options.renderingRule);
  85699. }
  85700. if (options.ids) {
  85701. params['ids'] = options.ids.join(',');
  85702. }
  85703. if (options.names) {
  85704. params['names'] = options.names.join(',');
  85705. }
  85706. return params;
  85707. }
  85708. });
  85709. var imageTileLayer = function (url, options) {
  85710. return new ImageTileLayer(url, options);
  85711. };
  85712. ;// CONCATENATED MODULE: ./src/leaflet/mapping/initMap.js
  85713. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85714. * This program are made available under the terms of the Apache License, Version 2.0
  85715. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85716. /**
  85717. * @function initMap
  85718. * @description 根据 SuperMap iServer 服务参数,创建地图与图层。目前仅支持SuperMap iServer 地图服务,创建的图层为 TiledMapLayer。
  85719. * @category BaseTypes Util
  85720. * @version 11.0.1
  85721. * @example
  85722. * initMap(url, {mapOptions, layerOptions});
  85723. * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  85724. * @param {Object} [options] - 参数。
  85725. * @param {L.MapOptions} [options.mapOptions] - 地图参数,未设置的情况下,默认使用 SuperMap iServer 服务参数进行设置。
  85726. * @param {Object} [options.layerOptions] - 图层参数,参考<a href="TiledMapLayer.html">TiledMapLayer</a>的参数。
  85727. * @returns {Promise} Promise 对象,返回{ map, layer }。
  85728. * @usage
  85729. * ```
  85730. * // 浏览器
  85731. * <script type="text/javascript" src="{cdn}"></script>
  85732. * <script>
  85733. * const initMap = {namespace}.initMap;
  85734. * initMap(url, {mapOptions, layerOptions});
  85735. *
  85736. * </script>
  85737. * // ES6 Import
  85738. * import { initMap } from "{npm}";
  85739. *
  85740. * initMap(url, {mapOptions, layerOptions});
  85741. *
  85742. * ```
  85743. */
  85744. function initMap(url, options) {
  85745. options = options || {};
  85746. const mapOptions = options.mapOptions || {};
  85747. const layerOptions = options.layerOptions || {};
  85748. return new Promise((resolve, reject) => {
  85749. new MapService_MapService(url).getMapInfo(async (res) => {
  85750. if (res.type === 'processCompleted') {
  85751. const { prjCoordSys } = res.result;
  85752. const epsgCodeStr = getEpsgCodeStr(prjCoordSys);
  85753. if (!isPlaneProjection(prjCoordSys)) {
  85754. await setProj(url, epsgCodeStr);
  85755. }
  85756. const mapInfoOptions = getMapOptions(res.result, mapOptions);
  85757. const map = external_L_default().map('map', { ...mapInfoOptions, ...mapOptions });
  85758. const layer = new TiledMapLayer(url, { ...{ noWrap: true }, ...layerOptions });
  85759. layer.addTo(map);
  85760. resolve({ map, layer });
  85761. return;
  85762. }
  85763. reject();
  85764. });
  85765. });
  85766. }
  85767. /**
  85768. * @function crsFromMapJSON
  85769. * @description 通过iServer REST地图的配置信息,构建地图的CRS(非平面投影、EPSG:3857、EPSG:4326需要先注册投影)。
  85770. * @category BaseTypes Util
  85771. * @version 11.0.1
  85772. * @param {Object} mapJSONObj - 地图参数。
  85773. * @param {Object} mapJSONObj.prjCoordSys - 投影配置。
  85774. * @param {Object} mapJSONObj.bounds - 范围。
  85775. * @param {number} mapJSONObj.dpi - DPI。
  85776. * @param {Array} mapJSONObj.visibleScales - 自定义比例尺。
  85777. * @param {Array} mapJSONObj.coordUnit - 地图单位。
  85778. * @param {Object} [mapOptions] - 地图参数。
  85779. * @param {Object} [mapOptions.maxZoom=22] - 地图最大缩放级别。没有设置固定比例尺时生效。
  85780. * @returns {CRS} 返回CRS。
  85781. */
  85782. function crsFromMapJSON(mapJSONObj, mapOptions) {
  85783. const { maxZoom = 22 } = mapOptions || {};
  85784. const { bounds, prjCoordSys, dpi, visibleScales, coordUnit } = mapJSONObj;
  85785. const resolutions = scalesToResolutions(visibleScales, bounds, dpi, coordUnit, maxZoom);
  85786. if (isPlaneProjection(prjCoordSys)) {
  85787. return getNonEarthCRS(bounds);
  85788. }
  85789. const epsgCodeStr = getEpsgCodeStr(prjCoordSys);
  85790. if (!hasRegisterProj(epsgCodeStr)) {
  85791. return;
  85792. }
  85793. return getCRS(epsgCodeStr, { bounds, dpi, resolutions });
  85794. }
  85795. /**
  85796. * @private
  85797. * @function isPlaneProjection
  85798. * @description 是否是平面坐标系。
  85799. * @param {Object} prjCoordSys - prjCoordSys
  85800. * @returns {boolean}
  85801. */
  85802. function isPlaneProjection(prjCoordSys) {
  85803. return prjCoordSys.type === 'PCS_NON_EARTH';
  85804. }
  85805. /**
  85806. * @private
  85807. * @function setProj
  85808. * @description 注册4214 4610 4490等投影。
  85809. * @param {string} url
  85810. * @param {string} epsgCodeStr - epsgCode。
  85811. */
  85812. async function setProj(url, epsgCodeStr) {
  85813. if (!hasRegisterProj(epsgCodeStr, false)) {
  85814. const def = await getWKT(url);
  85815. def && proj4_src_default().defs(epsgCodeStr, def);
  85816. }
  85817. }
  85818. /**
  85819. * @private
  85820. * @function hasRegisterProj
  85821. * @description 判断是否注册了投影。
  85822. * @param {string} epsgCodeStr - epsgCode。
  85823. * @param {boolean} isConsole - 是否在控制台打印。
  85824. * @returns {boolean}
  85825. */
  85826. function hasRegisterProj(epsgCodeStr, isConsole = true) {
  85827. try {
  85828. proj4_src_default()(epsgCodeStr);
  85829. } catch (e) {
  85830. if (isConsole) {
  85831. console.error(
  85832. `The projection of ${epsgCodeStr} is missing, please register the projection of ${epsgCodeStr} first, refer to the documentation: https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection`
  85833. );
  85834. }
  85835. return false;
  85836. }
  85837. return true;
  85838. }
  85839. /**
  85840. * @private
  85841. * @function getMapOptions
  85842. * @description 获取地图参数。
  85843. * @param {Object} mapJSONObj - 地图 JSON 对象。
  85844. * @param {Object} [mapOptions] - 地图参数。
  85845. * @param {Object} [mapOptions.maxZoom=22] - 地图最大缩放级别(没有设置固定比例尺时生效)。
  85846. * @returns {Object} mapParams。
  85847. */
  85848. function getMapOptions(mapJSONObj, mapOptions) {
  85849. const { bounds, center, scale, visibleScales, prjCoordSys, dpi, coordUnit } = mapJSONObj;
  85850. const { maxZoom = 22 } = mapOptions;
  85851. const resolutions = scalesToResolutions(visibleScales, bounds, dpi, coordUnit, maxZoom);
  85852. const crs = crsFromMapJSON({ prjCoordSys, bounds, dpi, visibleScales, coordUnit }, { maxZoom });
  85853. const visableResolutions = crs.resolutions || resolutions;
  85854. const mapParams = {
  85855. crs,
  85856. center: getCenter(crs, { center, bounds }),
  85857. zoom: getZoomByScale({ scale, dpi, coordUnit }, visableResolutions),
  85858. maxZoom: getMaxZoom(resolutions)
  85859. };
  85860. return mapParams;
  85861. }
  85862. /**
  85863. * @private
  85864. * @function getZoomByScale
  85865. * @description 获取Zoom。
  85866. * @param {Object} options
  85867. * @param {string} options.scale - scale。
  85868. * @param {number} options.dpi - dpi
  85869. * @param {string} options.coordUnit - coordUnit
  85870. * @param {Object} visableResolutions - visableResolutions
  85871. * @returns {number} zoom。
  85872. */
  85873. function getZoomByScale({ scale, dpi, coordUnit }, visableResolutions) {
  85874. const resolution = Util_scaleToResolution(scale, dpi, coordUnit);
  85875. return getZoomByResolution(resolution, visableResolutions);
  85876. }
  85877. /**
  85878. * @private
  85879. * @function getMaxZoom
  85880. * @description 获取maxZoom。
  85881. * @param {Array} visibleResolutions - visibleResolutions
  85882. * @returns {number} maxZoom。
  85883. */
  85884. function getMaxZoom(visibleResolutions) {
  85885. if (visibleResolutions.length > 0) {
  85886. return visibleResolutions.length - 1;
  85887. }
  85888. return 22;
  85889. }
  85890. /**
  85891. * @private
  85892. * @function getCenter
  85893. * @description 获取center。
  85894. * @param {CRS} crs - crs。
  85895. * @param {Object} mapJSONObj - 地图 JSON 对象。
  85896. * @param {Object} mapJSONObj.center - 地图参数。
  85897. * @param {Object} mapJSONObj.bounds - 地图最大缩放级别。
  85898. * @returns {Object} center。
  85899. */
  85900. function getCenter(crs, { center, bounds }) {
  85901. const code = typeof crs === 'string' ? crs : crs.code;
  85902. if (typeof center.x !== 'number' && typeof center.y !== 'number') {
  85903. center = { lat: (bounds.bottom + bounds.top) / 2, lng: (bounds.left + bounds.right) / 2 };
  85904. }
  85905. if (code === 'EPSG:4326') {
  85906. return { lat: center.y, lng: center.x };
  85907. }
  85908. return crs.unproject(external_L_default().point(center.x, center.y));
  85909. }
  85910. /**
  85911. * @private
  85912. * @function getCenter
  85913. * @description 获取center。
  85914. * @param {Object} prjCoordSys
  85915. * @returns {string} center。
  85916. */
  85917. function getEpsgCodeStr(prjCoordSys) {
  85918. const { type, epsgCode } = prjCoordSys;
  85919. if (type == 'PCS_NON_EARTH') {
  85920. // 平面投影
  85921. return '';
  85922. }
  85923. return 'EPSG:' + epsgCode;
  85924. }
  85925. async function getWKT(url) {
  85926. return new Promise((resolve, reject) => {
  85927. new MapService_MapService(url, { withoutFormatSuffix: true }).getWkt((res) => {
  85928. if (res.type === 'processCompleted') {
  85929. const proj4def = res.result.data;
  85930. resolve(proj4def);
  85931. return;
  85932. }
  85933. reject();
  85934. });
  85935. });
  85936. }
  85937. function getNonEarthCRS(bounds) {
  85938. let options = {
  85939. bounds: external_L_default().bounds([bounds.left, bounds.bottom], [bounds.right, bounds.top]),
  85940. origin: external_L_default().point(bounds.left, bounds.top)
  85941. };
  85942. return new NonEarthCRS(options);
  85943. }
  85944. function getCRS(epsgCodeStr, { bounds, dpi, resolutions }) {
  85945. const wrapLngLeft = proj4_src_default()(epsgCodeStr, 'EPSG:4326').forward([bounds.left, 0], true);
  85946. const wrapLngRight = proj4_src_default()(epsgCodeStr, 'EPSG:4326').forward([bounds.right, 0], true);
  85947. const wrapLng = [parseInt(wrapLngLeft[0]), parseInt(wrapLngRight[0])];
  85948. let options = {
  85949. wrapLng,
  85950. bounds: external_L_default().bounds([bounds.left, bounds.bottom], [bounds.right, bounds.top]),
  85951. origin: [bounds.left, bounds.top],
  85952. dpi: dpi
  85953. };
  85954. if (resolutions && resolutions.length > 0) {
  85955. options.resolutions = resolutions;
  85956. }
  85957. return new CRS(epsgCodeStr, options);
  85958. }
  85959. ;// CONCATENATED MODULE: ./src/leaflet/mapping/index.js
  85960. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85961. * This program are made available under the terms of the Apache License, Version 2.0
  85962. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85963. ;// CONCATENATED MODULE: ./src/leaflet/services/DataFlowService.js
  85964. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85965. * This program are made available under the terms of the Apache License, Version 2.0
  85966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85967. /**
  85968. * @class DataFlowService
  85969. * @deprecatedclassinstance L.supermap.dataFlowService
  85970. * @classdesc 数据流服务类。
  85971. * @category iServer DataFlow
  85972. * @modulecategory Services
  85973. * @extends {ServiceBase}
  85974. * @param {string} url - 服务地址。
  85975. * @param {Object} options - 参数。
  85976. * @param {function} [options.style] - 设置数据加载样式。
  85977. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  85978. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  85979. * @param {Object} [options.excludeField] - 排除字段。
  85980. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  85981. * @param {Object} [options.headers] - 请求头。
  85982. * @fires DataFlowService#broadcastSocketConnected
  85983. * @fires DataFlowService#broadcastSocketError
  85984. * @fires DataFlowService#broadcastFailed
  85985. * @fires DataFlowService#broadcastSucceeded
  85986. * @fires DataFlowService#subscribeSocketError
  85987. * @fires DataFlowService#messageSucceeded
  85988. * @fires DataFlowService#setFilterParamSucceeded
  85989. * @usage
  85990. */
  85991. var DataFlowService_DataFlowService = ServiceBase.extend({
  85992. options: {
  85993. geometry: null,
  85994. prjCoordSys: null,
  85995. excludeField: null
  85996. },
  85997. initialize: function (url, options) {
  85998. options = options || {};
  85999. external_L_default().setOptions(this, options);
  86000. if (options.projection) {
  86001. this.options.prjCoordSys = options.projection;
  86002. }
  86003. ServiceBase.prototype.initialize.call(this, url, options);
  86004. this.dataFlow = new DataFlowService(url, options);
  86005. /**
  86006. * @event DataFlowService#broadcastSocketConnected
  86007. * @description broadcast Socket 连接成功。
  86008. */
  86009. /**
  86010. * @event DataFlowService#broadcastSocketError
  86011. * @description broadcast Socket 连接失败。
  86012. */
  86013. /**
  86014. * @event DataFlowService#broadcastFailed
  86015. * @description 广播失败。
  86016. */
  86017. /**
  86018. * @event DataFlowService#broadcastSucceeded
  86019. * @description 广播成功。
  86020. */
  86021. /**
  86022. * @event DataFlowService#subscribeSocketConnected
  86023. * @description 订阅数据连接成功。
  86024. */
  86025. /**
  86026. * @event DataFlowService#subscribeSocketError
  86027. * @description 订阅数据连接失败。
  86028. */
  86029. /**
  86030. * @event DataFlowService#messageSucceeded
  86031. * @description 获取信息成功。
  86032. */
  86033. /**
  86034. * @event DataFlowService#setFilterParamSucceeded
  86035. * @description 设置过滤参数成功。
  86036. */
  86037. this.dataFlow.events.on({
  86038. "broadcastSocketConnected": this._defaultEvent,
  86039. "broadcastSocketError": this._defaultEvent,
  86040. "broadcastFailed": this._defaultEvent,
  86041. "broadcastSucceeded": this._defaultEvent,
  86042. "subscribeSocketConnected": this._defaultEvent,
  86043. "subscribeSocketError": this._defaultEvent,
  86044. "messageSucceeded": this._defaultEvent,
  86045. "setFilterParamSucceeded": this._defaultEvent,
  86046. scope: this
  86047. })
  86048. },
  86049. /**
  86050. * @function DataFlowService.prototype.initBroadcast
  86051. * @description 初始化广播。
  86052. */
  86053. initBroadcast: function () {
  86054. this.dataFlow.initBroadcast();
  86055. return this;
  86056. },
  86057. /**
  86058. * @function DataFlowService.prototype.broadcast
  86059. * @description 加载广播数据。
  86060. * @param {JSONObject} obj - JSON 格式的要素数据。
  86061. */
  86062. broadcast: function (obj) {
  86063. this.dataFlow.broadcast(obj);
  86064. },
  86065. /**
  86066. * @function DataFlowService.prototype.initSubscribe
  86067. * @description 初始化订阅数据。
  86068. */
  86069. initSubscribe: function () {
  86070. this.dataFlow.initSubscribe();
  86071. return this;
  86072. },
  86073. /**
  86074. * @function DataFlowService.prototype.setExcludeField
  86075. * @description 设置排除字段。
  86076. * @param {Object} excludeField - 排除字段。
  86077. */
  86078. setExcludeField: function (excludeField) {
  86079. this.dataFlow.setExcludeField(excludeField);
  86080. this.options.excludeField = excludeField;
  86081. return this;
  86082. },
  86083. /**
  86084. * @function DataFlowService.prototype.setGeometry
  86085. * @description 设置添加的 GeoJSON 几何要素数据。
  86086. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  86087. */
  86088. setGeometry: function (geometry) {
  86089. this.dataFlow.setGeometry(geometry);
  86090. this.options.geometry = geometry;
  86091. return this;
  86092. },
  86093. /**
  86094. * @function DataFlowService.prototype.unSubscribe
  86095. * @description 结束订阅数据。
  86096. */
  86097. unSubscribe: function () {
  86098. this.dataFlow.unSubscribe();
  86099. },
  86100. /**
  86101. * @function DataFlowService.prototype.unBroadcast
  86102. * @description 结束加载广播。
  86103. */
  86104. unBroadcast: function () {
  86105. this.dataFlow.unBroadcast();
  86106. },
  86107. _defaultEvent: function (e) {
  86108. this.fire(e.eventType || e.type, e);
  86109. }
  86110. });
  86111. var dataFlowService = function (url, options) {
  86112. return new DataFlowService_DataFlowService(url, options);
  86113. };
  86114. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  86115. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  86116. ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/MapVRenderer.js
  86117. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86118. * This program are made available under the terms of the Apache License, Version 2.0
  86119. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86120. var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  86121. /**
  86122. * @class MapVRenderer
  86123. * @classdesc 地图渲染类。
  86124. * @category Visualization MapV
  86125. * @private
  86126. * @extends mapv.BaseLayer
  86127. * @param {L.Map} map - Leaflet Map 对象。
  86128. * @param {L.Layer} layer - Leaflet Layer 对象。
  86129. * @param {DataSet} dataSet - 待渲染的数据集。
  86130. * @param {Object} options - 参数。
  86131. * @usage
  86132. */
  86133. class MapVRenderer extends BaseLayer {
  86134. constructor(map, layer, dataSet, options) {
  86135. super(map, dataSet, options);
  86136. if (!BaseLayer) {
  86137. return;
  86138. }
  86139. var self = this;
  86140. options = options || {};
  86141. self.init(options);
  86142. self.argCheck(options);
  86143. this.canvasLayer = layer;
  86144. this.clickEvent = this.clickEvent.bind(this);
  86145. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  86146. this._moveStartEvent = this.moveStartEvent.bind(this);
  86147. this._moveEndEvent = this.moveEndEvent.bind(this);
  86148. this._zoomStartEvent = this.zoomStartEvent.bind(this);
  86149. this.bindEvent();
  86150. }
  86151. /**
  86152. * @function MapVRenderer.prototype.clickEvent
  86153. * @description 鼠标点击事件。
  86154. * @param {Object} e - 触发对象。
  86155. */
  86156. clickEvent(e) {
  86157. var offset = this.map.containerPointToLayerPoint([0, 0]);
  86158. var devicePixelRatio = this.devicePixelRatio = this.canvasLayer.devicePixelRatio = window.devicePixelRatio || 1 ;
  86159. var pixel = e.layerPoint;
  86160. super.clickEvent(external_L_default().point((pixel.x - offset.x) / devicePixelRatio, (pixel.y - offset.y) / devicePixelRatio), e);
  86161. }
  86162. /**
  86163. * @function MapVRenderer.prototype.mousemoveEvent
  86164. * @description 鼠标移动事件。
  86165. * @param {Object} e - 触发对象。
  86166. */
  86167. mousemoveEvent(e) {
  86168. var pixel = e.layerPoint;
  86169. super.mousemoveEvent(pixel, e);
  86170. }
  86171. /**
  86172. * @function MapVRenderer.prototype.bindEvent
  86173. * @description 监听鼠标移动和点击事件。
  86174. * @param {Object} e - 触发对象。
  86175. */
  86176. bindEvent() {
  86177. var map = this.map;
  86178. if (this.options.methods) {
  86179. if (this.options.methods.click) {
  86180. map.on('click', this.clickEvent);
  86181. }
  86182. if (this.options.methods.mousemove) {
  86183. map.on('mousemove', this.mousemoveEvent);
  86184. }
  86185. }
  86186. this.map.on('movestart', this._moveStartEvent);
  86187. this.map.on('moveend', this._moveEndEvent);
  86188. this.map.on('zoomstart', this._zoomStartEvent);
  86189. }
  86190. /**
  86191. * @function MapVRenderer.prototype.destroy
  86192. * @description 释放资源。
  86193. */
  86194. destroy() {
  86195. this.unbindEvent();
  86196. this.clearData();
  86197. this.animator && this.animator.stop();
  86198. this.animator = null;
  86199. this.canvasLayer = null;
  86200. }
  86201. /**
  86202. * @function MapVRenderer.prototype.unbindEvent
  86203. * @description 移除鼠标事件。
  86204. * @param {Object} e - 触发对象。
  86205. */
  86206. unbindEvent() {
  86207. var map = this.map;
  86208. if (this.options.methods) {
  86209. if (this.options.methods.click) {
  86210. map.off('click', this.clickEvent);
  86211. }
  86212. if (this.options.methods.mousemove) {
  86213. map.off('mousemove', this.mousemoveEvent);
  86214. }
  86215. }
  86216. this.map.off('movestart', this._moveStartEvent);
  86217. this.map.off('moveend', this._moveEndEvent);
  86218. this.map.off('zoomstart', this._zoomStartEvent);
  86219. }
  86220. /**
  86221. * @function MapVRenderer.prototype.getContext
  86222. * @description 获取信息。
  86223. */
  86224. getContext() {
  86225. return this.canvasLayer.getCanvas().getContext(this.context);
  86226. }
  86227. /**
  86228. * @function MapVRenderer.prototype.addData
  86229. * @description 添加数据。
  86230. * @param {Object} data - 待添加的数据。
  86231. * @param {Object} options - 参数。
  86232. */
  86233. addData(data, options) {
  86234. var _data = data;
  86235. if (data && data.get) {
  86236. _data = data.get();
  86237. }
  86238. this.dataSet.add(_data);
  86239. this.update({
  86240. options: options
  86241. });
  86242. }
  86243. /**
  86244. * @function MapVRenderer.prototype.update
  86245. * @description 更新图层。
  86246. * @param {Object} opt - 待更新的数据。
  86247. * @param {Object} opt.data - mapv 数据集。
  86248. * @param {Object} opt.options - mapv 绘制参数。
  86249. */
  86250. update(opt) {
  86251. var update = opt || {};
  86252. var _data = update.data;
  86253. if (_data && _data.get) {
  86254. _data = _data.get();
  86255. }
  86256. if (_data != undefined) {
  86257. this.dataSet.set(_data);
  86258. }
  86259. super.update({
  86260. options: update.options
  86261. });
  86262. }
  86263. /**
  86264. * @function MapVRenderer.prototype.getData
  86265. * @description 获取数据
  86266. */
  86267. getData() {
  86268. return this.dataSet;
  86269. }
  86270. /**
  86271. * @function MapVRenderer.prototype.removeData
  86272. * @description 删除符合过滤条件的数据。
  86273. * @param {function} filter - 过滤条件。参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  86274. */
  86275. removeData(filter) {
  86276. if (!this.dataSet) {
  86277. return;
  86278. }
  86279. var newData = this.dataSet.get({
  86280. filter: function (data) {
  86281. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  86282. }
  86283. });
  86284. this.dataSet.set(newData);
  86285. this.update({
  86286. options: null
  86287. });
  86288. }
  86289. /**
  86290. * @function MapVRenderer.prototype.clearData
  86291. * @description 清除数据。
  86292. */
  86293. clearData() {
  86294. this.dataSet && this.dataSet.clear();
  86295. this.update({
  86296. options: null
  86297. });
  86298. }
  86299. _canvasUpdate(time) {
  86300. if (!this.canvasLayer) {
  86301. return;
  86302. }
  86303. var self = this;
  86304. var animationOptions = self.options.animation;
  86305. var context = this.getContext();
  86306. var map = this.map;
  86307. if (self.isEnabledTime()) {
  86308. if (time === undefined) {
  86309. this.clear(context);
  86310. return;
  86311. }
  86312. if (this.context === '2d') {
  86313. context.save();
  86314. context.globalCompositeOperation = 'destination-out';
  86315. context.fillStyle = 'rgba(0, 0, 0, .1)';
  86316. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  86317. context.restore();
  86318. }
  86319. } else {
  86320. this.clear(context);
  86321. }
  86322. if (this.context === '2d') {
  86323. for (var key in self.options) {
  86324. context[key] = self.options[key];
  86325. }
  86326. } else {
  86327. context.clear(context.COLOR_BUFFER_BIT);
  86328. }
  86329. if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
  86330. return;
  86331. }
  86332. var bounds = map.getBounds();
  86333. //获取当前像素下的地理范围
  86334. var dw = bounds.getEast() - bounds.getWest();
  86335. var dh = bounds.getNorth() - bounds.getSouth();
  86336. var mapCanvas = map.getSize();
  86337. var resolutionX = dw / mapCanvas.x,
  86338. resolutionY = dh / mapCanvas.y;
  86339. // 一个像素是多少米
  86340. var zoomUnit = Util_getMeterPerMapUnit('DEGREE') * resolutionX;
  86341. //var centerPx = map.latLngToLayerPoint(map.getCenter());
  86342. //获取屏幕左上角的地理坐标坐标
  86343. //左上角屏幕坐标为0,0
  86344. var topLeft = this.canvasLayer.getTopLeft();
  86345. var topLeftPX = map.latLngToAccurateContainerPoint(topLeft);
  86346. // var lopLeft = map.containerPointToLatLng([0, 0]);
  86347. var dataGetOptions = {
  86348. transferCoordinate: function (coordinate) {
  86349. var offset;
  86350. if (self.context === '2d') {
  86351. offset = map.latLngToAccurateContainerPoint(external_L_default().latLng(coordinate[1], coordinate[0]));
  86352. } else {
  86353. offset = {
  86354. 'x': (coordinate[0] - topLeft.lng) / resolutionX,
  86355. 'y': (topLeft.lat - coordinate[1]) / resolutionY
  86356. };
  86357. }
  86358. var pixel = {
  86359. x: offset.x - topLeftPX.x,
  86360. y: offset.y - topLeftPX.y
  86361. };
  86362. return [pixel.x, pixel.y];
  86363. }
  86364. };
  86365. if (time !== undefined) {
  86366. dataGetOptions.filter = function (item) {
  86367. var trails = animationOptions.trails || 10;
  86368. return (time && item.time > (time - trails) && item.time < time);
  86369. }
  86370. }
  86371. var data = self.dataSet.get(dataGetOptions);
  86372. this.processData(data);
  86373. var worldPoint = map.latLngToContainerPoint(external_L_default().latLng(0, 0));
  86374. var pixel = {
  86375. x: worldPoint.x - topLeftPX.x,
  86376. y: worldPoint.y - topLeftPX.y
  86377. };
  86378. // 兼容unit为'm'的情况
  86379. if (self.options.unit === 'm') {
  86380. if (self.options.size) {
  86381. self.options._size = self.options.size / zoomUnit;
  86382. }
  86383. if (self.options.width) {
  86384. self.options._width = self.options.width / zoomUnit;
  86385. }
  86386. if (self.options.height) {
  86387. self.options._height = self.options.height / zoomUnit;
  86388. }
  86389. } else {
  86390. self.options._size = self.options.size;
  86391. self.options._height = self.options.height;
  86392. self.options._width = self.options.width;
  86393. }
  86394. this.drawContext(context, data, self.options, pixel);
  86395. self.options.updateCallback && self.options.updateCallback(time);
  86396. }
  86397. init(options) {
  86398. var self = this;
  86399. self.options = options;
  86400. this.initDataRange(options);
  86401. this.context = self.options.context || '2d';
  86402. if (self.options.zIndex) {
  86403. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  86404. }
  86405. this.initAnimator();
  86406. }
  86407. addAnimatorEvent() {}
  86408. /**
  86409. * @function MapVRenderer.prototype.moveStartEvent
  86410. * @description 开始移动事件。
  86411. */
  86412. moveStartEvent() {
  86413. var animationOptions = this.options.animation;
  86414. if (this.isEnabledTime() && this.animator) {
  86415. this.steps.step = animationOptions.stepsRange.start;
  86416. this._hide();
  86417. }
  86418. }
  86419. /**
  86420. * @function MapVRenderer.prototype.moveEndEvent
  86421. * @description 移除移动事件。
  86422. */
  86423. moveEndEvent() {
  86424. this.canvasLayer.draw();
  86425. this._show();
  86426. }
  86427. /**
  86428. * @function MapVRenderer.prototype.zoomStartEvent
  86429. * @description 隐藏渲染样式。
  86430. */
  86431. zoomStartEvent() {
  86432. this._hide();
  86433. }
  86434. /**
  86435. * @function MapVRenderer.prototype.clear
  86436. * @description 清除信息。
  86437. * @param {string} context - 指定要清除的信息。
  86438. */
  86439. clear(context) {
  86440. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  86441. }
  86442. _hide() {
  86443. this.canvasLayer.canvas.style.display = 'none';
  86444. }
  86445. _show() {
  86446. this.canvasLayer.canvas.style.display = 'block';
  86447. }
  86448. /**
  86449. * @function MapVRenderer.prototype.draw
  86450. * @description 绘制渲染。
  86451. */
  86452. draw() {
  86453. this.canvasLayer.draw();
  86454. }
  86455. }
  86456. ;// CONCATENATED MODULE: ./src/leaflet/overlay/MapVLayer.js
  86457. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86458. * This program are made available under the terms of the Apache License, Version 2.0
  86459. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86460. /**
  86461. * @class MapVLayer
  86462. * @deprecatedclassinstance L.supermap.mapVLayer
  86463. * @classdesc MapV 图层类。
  86464. * @category Visualization MapV
  86465. * @modulecategory Overlay
  86466. * @extends {L.Layer}
  86467. * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
  86468. * @param {Object} mapVOptions - MapV 图层参数。
  86469. * @param {Object} options - 参数。
  86470. * @param {string} [options.attributionPrefix] - 版权信息前缀。
  86471. * @param {string} [options.attribution='© 2018 百度 MapV'] - 版权信息。
  86472. * @fires MapVLayer#loaded
  86473. * @usage
  86474. */
  86475. var MapVLayer = external_L_default().Layer.extend({
  86476. options: {
  86477. attributionPrefix: null,
  86478. attribution: core_Attributions.MapV.attribution
  86479. },
  86480. initialize: function (dataSet, mapVOptions, options) {
  86481. options = options || {};
  86482. this.dataSet = dataSet || {};
  86483. this.mapVOptions = mapVOptions || {};
  86484. this.render = this.render.bind(this);
  86485. external_L_default().Util.setOptions(this, options);
  86486. if (this.options.attributionPrefix) {
  86487. this.options.attribution = this.options.attributionPrefix + this.options.attribution;
  86488. }
  86489. this.canvas = this._createCanvas();
  86490. external_L_default().stamp(this);
  86491. },
  86492. /**
  86493. * @private
  86494. * @function MapVLayer.prototype.onAdd
  86495. * @description 添加地图图层。
  86496. * @param {L.Map} map - Leaflet Map 对象。
  86497. */
  86498. onAdd: function (map) {
  86499. this._map = map;
  86500. var overlayPane = this.getPane();
  86501. var container = this.container = external_L_default().DomUtil.create("div", "leaflet-layer leaflet-zoom-animated", overlayPane);
  86502. container.appendChild(this.canvas);
  86503. var size = map.getSize();
  86504. container.style.width = size.x + "px";
  86505. container.style.height = size.y + "px";
  86506. this.renderer = new MapVRenderer(map, this, this.dataSet, this.mapVOptions);
  86507. this.draw();
  86508. /**
  86509. * @event MapVLayer#loaded
  86510. * @description 图层添加完成之后触发。
  86511. */
  86512. this.fire("loaded");
  86513. },
  86514. // _hide: function () {
  86515. // this.canvas.style.display = 'none';
  86516. // },
  86517. // _show: function () {
  86518. // this.canvas.style.display = 'block';
  86519. // },
  86520. /**
  86521. * @private
  86522. * @function MapVLayer.prototype.onRemove
  86523. * @description 删除地图图层。
  86524. */
  86525. onRemove: function () {
  86526. external_L_default().DomUtil.remove(this.container);
  86527. this.renderer.destroy();
  86528. },
  86529. /**
  86530. * @function MapVLayer.prototype.addData
  86531. * @description 添加数据。
  86532. * @param {Object} data - 需要添加的数据。
  86533. * @param {Object} options - 参数。
  86534. */
  86535. addData: function (data, options) {
  86536. this.renderer.addData(data, options);
  86537. },
  86538. /**
  86539. * @function MapVLayer.prototype.update
  86540. * @description 更新图层。
  86541. * @param {Object} opt - 待更新的数据。
  86542. * @param {Object} data - mapv 数据集。
  86543. * @param {Object} options - 参数。
  86544. */
  86545. update: function (opt) {
  86546. this.renderer.update(opt);
  86547. },
  86548. /**
  86549. * @function MapVLayer.prototype.getData
  86550. * @description 获取数据。
  86551. * @returns {Mapv.DataSet} mapv 数据集。
  86552. */
  86553. getData: function () {
  86554. if (this.renderer) {
  86555. this.dataSet = this.renderer.getData();
  86556. }
  86557. return this.dataSet;
  86558. },
  86559. /**
  86560. * @function MapVLayer.prototype.removeData
  86561. * @description 删除数据。
  86562. * @param {function} filter - 过滤条件。指定数据项后,返回值为 true,表示删除该元素;否则表示不删除。
  86563. * @example
  86564. * filter=function(data){
  86565. * if(data.id=="1"){
  86566. * return true
  86567. * }
  86568. * return false;
  86569. * }
  86570. */
  86571. removeData: function (filter) {
  86572. this.renderer && this.renderer.removeData(filter);
  86573. },
  86574. /**
  86575. * @function MapVLayer.prototype.clearData
  86576. * @description 清除数据。
  86577. */
  86578. clearData: function () {
  86579. this.renderer.clearData();
  86580. },
  86581. /**
  86582. * @function MapVLayer.prototype.draw
  86583. * @description 绘制图层。
  86584. */
  86585. draw: function () {
  86586. return this._reset();
  86587. },
  86588. /**
  86589. * @function MapVLayer.prototype.setZIndex
  86590. * @description 设置 canvas 层级。
  86591. * @param {number} zIndex - canvas 层级。
  86592. */
  86593. setZIndex: function (zIndex) {
  86594. this.canvas.style.zIndex = zIndex;
  86595. },
  86596. /**
  86597. * @function MapVLayer.prototype.render
  86598. * @description 渲染。
  86599. */
  86600. render: function () {
  86601. this.renderer._canvasUpdate();
  86602. },
  86603. /**
  86604. * @function MapVLayer.prototype.getCanvas
  86605. * @description 获取 canvas。
  86606. * @returns {HTMLElement} 返回 mapV 图层包含的 canvas 对象。
  86607. */
  86608. getCanvas: function () {
  86609. return this.canvas;
  86610. },
  86611. /**
  86612. * @function MapVLayer.prototype.getContainer
  86613. * @description 获取容器。
  86614. * @returns {HTMLElement} 返回包含 mapV 图层的 dom 对象。
  86615. */
  86616. getContainer: function () {
  86617. return this.container;
  86618. },
  86619. /**
  86620. * @function MapVLayer.prototype.getTopLeft
  86621. * @description 获取左上角坐标。
  86622. * @returns {L.Bounds} 返回左上角坐标。
  86623. */
  86624. getTopLeft: function () {
  86625. var map = this._map;
  86626. var topLeft;
  86627. if (map) {
  86628. var bounds = map.getBounds();
  86629. topLeft = bounds.getNorthWest();
  86630. }
  86631. return topLeft;
  86632. },
  86633. _createCanvas: function () {
  86634. var canvas = document.createElement('canvas');
  86635. canvas.style.position = 'absolute';
  86636. canvas.style.top = 0 + "px";
  86637. canvas.style.left = 0 + "px";
  86638. canvas.style.pointerEvents = "none";
  86639. canvas.style.zIndex = this.options.zIndex || 600;
  86640. var global$2 = typeof window === 'undefined' ? {} : window;
  86641. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  86642. if (!this.mapVOptions.context || this.mapVOptions.context === '2d') {
  86643. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  86644. }
  86645. return canvas;
  86646. },
  86647. _resize: function () {
  86648. var canvas = this.canvas;
  86649. if (!canvas) {
  86650. return;
  86651. }
  86652. var map = this._map;
  86653. var size = map.getSize();
  86654. if (this.mapVOptions.draw === 'heatmap') {
  86655. canvas.width = parseInt(size.x) * this.devicePixelRatio;
  86656. canvas.height = parseInt(size.y) * this.devicePixelRatio;
  86657. } else {
  86658. canvas.width = parseInt(size.x);
  86659. canvas.height = parseInt(size.y);
  86660. }
  86661. canvas.style.width = size.x + 'px';
  86662. canvas.style.height = size.y + 'px';
  86663. var bounds = map.getBounds();
  86664. var topLeft = map.latLngToLayerPoint(bounds.getNorthWest());
  86665. external_L_default().DomUtil.setPosition(canvas, topLeft);
  86666. },
  86667. _reset: function () {
  86668. this._resize();
  86669. this._render()
  86670. },
  86671. redraw: function () {
  86672. this._resize();
  86673. this._render()
  86674. },
  86675. _render: function () {
  86676. this.render();
  86677. }
  86678. });
  86679. var mapVLayer = function (dataSet, mapVOptions, options) {
  86680. return new MapVLayer(dataSet, mapVOptions, options);
  86681. };
  86682. ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/MapvRenderer.js
  86683. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86684. * This program are made available under the terms of the Apache License, Version 2.0
  86685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86686. /**
  86687. *
  86688. * @class MapvRenderer
  86689. * @classdesc 数据流图层 MapV 渲染器。
  86690. * @category iServer DataFlow
  86691. * @extends {MapVLayer}
  86692. * @param {string} url - 服务地址
  86693. * @param {Object} options - 参数。
  86694. * @param {Object} [options.geometry] - GeoJSON 几何对象。
  86695. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  86696. * @param {string} [options.excludeField] - 排除字段。
  86697. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  86698. * @usage
  86699. */
  86700. var MapvRenderer = MapVLayer.extend({
  86701. initialize: function (url, options) {
  86702. options = options || {};
  86703. external_L_default().Util.setOptions(this, options);
  86704. this.data = [];
  86705. this.mapVOptions = {
  86706. draw: 'simple'
  86707. };
  86708. MapVLayer.prototype.initialize.call(this, new window.mapv.DataSet([]), this.mapVOptions, options)
  86709. this.idCache = {};
  86710. this.url = url;
  86711. this._last = new Date();
  86712. this._imageCache = {};
  86713. },
  86714. onMessageSuccessed: function (msg) {
  86715. const geoID = msg.featureResult.properties['id'];
  86716. const geometry = msg.featureResult.geometry;
  86717. //设置每个点的经纬度和图片的样式
  86718. const item = {
  86719. geometry: msg.featureResult.geometry
  86720. }
  86721. if (geometry.type === 'Point' && this.options.pointToLayer) {
  86722. //const pointStyle = this.options.pointToLayer ? this.options.pointToLayer(msg.featureResult, L.latLng(geometry.coordinates[1],geometry.coordinates[0])) : new L.marker(L.latLng(geometry.coordinates[1],geometry.coordinates[0]));
  86723. const pointStyle = this.options.pointToLayer(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]));
  86724. if (pointStyle instanceof (external_L_default()).Marker) {
  86725. this.mapVOptions.draw = 'icon';
  86726. let icon = pointStyle.options.icon;
  86727. const imgUrl = icon._getIconUrl('icon');
  86728. const imgWidth = icon.options.iconSize ? icon.options.iconSize[0] : null;
  86729. const imgHeight = icon.options.iconSize ? icon.options.iconSize[1] : null;
  86730. const iconKey = `${imgUrl}_${imgWidth}_${imgHeight}`;
  86731. let img = this._imageCache[iconKey];
  86732. if (!img) {
  86733. img = icon.createIcon();
  86734. this._imageCache[iconKey] = img;
  86735. img.onload = () => {
  86736. this.update({
  86737. data: this.data,
  86738. options: this.mapVOptions
  86739. });
  86740. }
  86741. }
  86742. item.icon = img;
  86743. if (icon.options.iconSize || img.style.height) {
  86744. this.mapVOptions.offset = {
  86745. x: 0,
  86746. y: -(icon.options.iconSize[1] || img.style.height) / 2
  86747. };
  86748. }
  86749. if (this.options.deg) {
  86750. item.deg = this.options.deg
  86751. if (typeof item.deg === 'function') {
  86752. if(this.idCache[geoID]&&this.data[this.idCache[geoID]]){
  86753. item.deg = item.deg(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]),this.data[this.idCache[geoID]]);
  86754. }
  86755. }
  86756. }
  86757. }
  86758. if (pointStyle instanceof (external_L_default()).CircleMarker) {
  86759. this.mapVOptions.draw = 'simple';
  86760. const sty = this._toMapvStyle(pointStyle);
  86761. for (const key in sty) {
  86762. if (sty.hasOwnProperty(key)) {
  86763. item[key] = sty[key];
  86764. }
  86765. }
  86766. }
  86767. } else if (this.options.style) {
  86768. const sty = this._toMapvStyle(this.options.style(msg.featureResult));
  86769. for (const key in sty) {
  86770. if (sty.hasOwnProperty(key)) {
  86771. item[key] = sty[key];
  86772. }
  86773. }
  86774. }
  86775. if (this.idCache[geoID] == undefined) {
  86776. this.data.push(item);
  86777. this.idCache[geoID] = this.data.length - 1;
  86778. } else {
  86779. this.data[this.idCache[geoID]] = item;
  86780. }
  86781. //绘制图层
  86782. if (new Date() - this._last > 200) {
  86783. this._last = new Date();
  86784. this.update({
  86785. data: this.data,
  86786. options: this.mapVOptions
  86787. });
  86788. }
  86789. },
  86790. _toMapvStyle: function (options) {
  86791. const mapvOps = {
  86792. draw: 'simple'
  86793. };
  86794. mapvOps.strokeStyle = options.color;
  86795. mapvOps.lineWidth = options.width;
  86796. mapvOps.globalAlpha = options.fillOpacity || options.opacity;
  86797. mapvOps.lineCap = options.lineCap;
  86798. mapvOps.lineJoin = options.lineJoin;
  86799. mapvOps.fillStyle = options.fillColor;
  86800. mapvOps.size = options.radius;
  86801. return mapvOps;
  86802. }
  86803. });
  86804. ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/NormalRenderer.js
  86805. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86806. * This program are made available under the terms of the Apache License, Version 2.0
  86807. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86808. /**
  86809. * @class NormalRenderer
  86810. * @classdesc 数据流图层普通渲染器。
  86811. * @category iServer DataFlow
  86812. * @extends {L.GeoJSON}
  86813. * @param {string} url - 服务地址
  86814. * @param {Object} options - 参数。
  86815. * @param {GeoJSONObject} [options.geometry] - GeoJSON 几何对象。
  86816. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  86817. * @param {string} [options.excludeField] - 排除字段。
  86818. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  86819. * @usage
  86820. */
  86821. var NormalRenderer = external_L_default().GeoJSON.extend({
  86822. initialize: function (url, options) {
  86823. options = options || {};
  86824. if (options.style && !options.pointToLayer) {
  86825. options.pointToLayer = function (geojson, latlng) {
  86826. return external_L_default().circleMarker(latlng, options.style());
  86827. }
  86828. }
  86829. external_L_default().Util.setOptions(this, options);
  86830. this._layers = {};
  86831. external_L_default().stamp(this);
  86832. this.url = url;
  86833. this.idCache = {};
  86834. },
  86835. onMessageSuccessed: function (msg) {
  86836. const geojson = msg.featureResult;
  86837. const geoID = msg.featureResult.properties[this.options.idField];
  86838. let layer = null;
  86839. if (geoID !== undefined && this.idCache[geoID]) {
  86840. layer = this.getLayer(this.idCache[geoID]);
  86841. this._updateLayerData(layer, geojson);
  86842. } else {
  86843. layer = external_L_default().GeoJSON.geometryToLayer(geojson, this.options);
  86844. layer.feature = external_L_default().GeoJSON.asFeature(geojson);
  86845. this.addLayer(layer);
  86846. if (geoID !== undefined) {
  86847. this.idCache[geoID] = this.getLayerId(layer);
  86848. }
  86849. }
  86850. if (this.options.onEachFeature) {
  86851. this.options.onEachFeature(geojson, layer);
  86852. }
  86853. },
  86854. _updateLayerData: function (layer, geojson) {
  86855. if (geojson.properties) {
  86856. layer.feature.properties = geojson.properties;
  86857. }
  86858. var latlngs = [];
  86859. switch (geojson.geometry.type) {
  86860. case 'Point':
  86861. latlngs = external_L_default().GeoJSON.coordsToLatLng(geojson.geometry.coordinates);
  86862. layer.setLatLng(latlngs);
  86863. break;
  86864. case 'LineString':
  86865. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 0);
  86866. layer.setLatLngs(latlngs);
  86867. break;
  86868. case 'MultiLineString':
  86869. case 'Polygon':
  86870. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 1);
  86871. layer.setLatLngs(latlngs);
  86872. break;
  86873. case 'MultiPolygon':
  86874. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 2);
  86875. layer.setLatLngs(latlngs);
  86876. break;
  86877. }
  86878. }
  86879. });
  86880. ;// CONCATENATED MODULE: ./src/leaflet/overlay/DataFlowLayer.js
  86881. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86882. * This program are made available under the terms of the Apache License, Version 2.0
  86883. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86884. /**
  86885. * @class DataFlowLayer
  86886. * @deprecatedclassinstance L.supermap.dataFlowLayer
  86887. * @classdesc 数据流图层源。订阅SuperMap iServer 数据流服务并上图。订阅得到的数据会根据 `options.idField` 自动更新。
  86888. * @category iServer DataFlow
  86889. * @extends {L.LayerGroup}
  86890. * @param {string} url - 服务地址。
  86891. * @param {Object} options - 参数。
  86892. * @param {Object} [options.render='normal'] - 绘制方式。可选值为'normal','mapv'。
  86893. 'normal' 表示以 {( {@link L.LatLng}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Marker} )} 方式绘制数据流。'mapv' 表示以 {@link MapVLayer} 方式绘制实时数据。
  86894. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  86895. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  86896. * @param {string} [options.excludeField] - 排除字段。
  86897. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  86898. * @param {function} [options.pointToLayer] - 定义点要素如何绘制在地图上。
  86899. `function(geoJsonPoint, latlng) {
  86900. return L.marker(latlng);
  86901. }`
  86902. * @param {function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
  86903. `function (feature) {
  86904. return {
  86905. fillColor: "red",
  86906. fillOpacity: 1,
  86907. radius: 6,
  86908. weight: 0
  86909. };
  86910. }`
  86911. * @param {function|number} [options.deg] - 定义图标的旋转角度。`options.render` 为 `mapv` 时有效。</br>
  86912. `function (feature,latlng) {
  86913. return feature.properties['rotate'];
  86914. }`
  86915. * @fires DataFlowLayer#subscribesucceeded
  86916. * @fires DataFlowLayer#subscribefailed
  86917. * @fires DataFlowLayer#setfilterparamsucceeded
  86918. * @fires DataFlowLayer#dataupdated
  86919. * @usage
  86920. */
  86921. var DataFlowLayer = external_L_default().LayerGroup.extend({
  86922. options: {
  86923. geometry: null,
  86924. prjCoordSys: null,
  86925. excludeField: null,
  86926. idField: "id",
  86927. render: 'normal'
  86928. },
  86929. initialize: function (url, options) {
  86930. options = options || {};
  86931. external_L_default().Util.setOptions(this, options);
  86932. this.url = url;
  86933. this._layers = {};
  86934. this.dataService = new DataFlowService_DataFlowService(this.url, {
  86935. geometry: this.options.geometry,
  86936. prjCoordSys: this.options.prjCoordSys,
  86937. excludeField: this.options.excludeField
  86938. })
  86939. },
  86940. /**
  86941. * @private
  86942. * @function DataFlowLayer.prototype.onAdd
  86943. * @description 添加地图。
  86944. * @param {L.Map} map - Leaflet Map 对象。
  86945. */
  86946. onAdd: function (map) { // eslint-disable-line no-unused-vars
  86947. this.dataService.initSubscribe();
  86948. /**
  86949. * @event DataFlowLayer#subscribesucceeded
  86950. * @description 初始化成功后触发。
  86951. * @property {Object} e - 事件对象。
  86952. */
  86953. this.dataService.on('subscribeSocketConnected', (e) => this.fire("subscribesucceeded", e));
  86954. /**
  86955. * @event DataFlowLayer#subscribefailed
  86956. * @description 初始化失败后触发。
  86957. * @property {Object} e - 事件对象。
  86958. */
  86959. this.dataService.on('subscribeSocketError', (e) => this.fire("subscribefailed", e))
  86960. this.dataService.on('messageSucceeded', (msg) => this._onMessageSuccessed(msg));
  86961. /**
  86962. * @event DataFlowLayer#setfilterparamsucceeded
  86963. * @description 过滤参数设置成功后触发。
  86964. * @property {Object} e - 事件对象。
  86965. */
  86966. this.dataService.on('setFilterParamSucceeded', (msg) => this.fire("setfilterparamsucceeded", msg));
  86967. if (this.options.render === 'mapv') {
  86968. this.addLayer(new MapvRenderer(this.url, this.options));
  86969. } else {
  86970. this.addLayer(new NormalRenderer(this.url, this.options));
  86971. }
  86972. external_L_default().LayerGroup.prototype.onAdd.call(this, map);
  86973. },
  86974. /**
  86975. * @private
  86976. * @function DataFlowLayer.prototype.onRemove
  86977. * @description 删除指定地图。
  86978. * @param {L.Map} map - Leaflet Map 对象。
  86979. */
  86980. onRemove: function (map) { // eslint-disable-line no-unused-vars
  86981. external_L_default().LayerGroup.prototype.onRemove.call(this, map);
  86982. this.dataService && this.dataService.unSubscribe();
  86983. },
  86984. /**
  86985. * @function DataFlowLayer.prototype.setExcludeField
  86986. * @description 设置唯一字段。
  86987. * @param {string} excludeField - 唯一字段。
  86988. */
  86989. setExcludeField: function (excludeField) {
  86990. this.dataService.setExcludeField(excludeField);
  86991. this.options.excludeField = excludeField;
  86992. return this;
  86993. },
  86994. /**
  86995. * @function DataFlowLayer.prototype.setGeometry
  86996. * @description 设置几何要素。
  86997. * @param {GeoJSONObject} geometry - 待设置的 GeoJSON 几何要素对象。
  86998. */
  86999. setGeometry: function (geometry) {
  87000. this.dataService.setGeometry(geometry);
  87001. this.options.geometry = geometry;
  87002. return this;
  87003. },
  87004. _onMessageSuccessed: function (msg) {
  87005. this.getLayers().map((layer) => {
  87006. if (layer.onMessageSuccessed) {
  87007. layer.onMessageSuccessed(msg);
  87008. /**
  87009. * @description 图层数据更新成功后触发。
  87010. * @event DataFlowLayer#dataupdated
  87011. * @property {Object} layer - 更新数据成功的图层。
  87012. * @property {Object} data - 更新的要素。
  87013. */
  87014. this.fire("dataupdated", {
  87015. layer: layer,
  87016. data: msg.featureResult
  87017. });
  87018. }
  87019. return layer;
  87020. })
  87021. }
  87022. });
  87023. var dataFlowLayer = function (url, options) {
  87024. return new DataFlowLayer(url, options);
  87025. };
  87026. ;// CONCATENATED MODULE: ./src/leaflet/overlay/EChartsLayer.js
  87027. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87028. * This program are made available under the terms of the Apache License, Version 2.0
  87029. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87030. /**
  87031. * @class EchartsLayer
  87032. * @deprecatedclassinstance L.supermap.echartsLayer
  87033. * @classdesc 百度 ECharts 图层类。
  87034. * @category Visualization ECharts
  87035. * @modulecategory Overlay
  87036. * @extends {L.Layer}
  87037. * @param {Object} echartsOptions - 图表参数。
  87038. * @param {Object} options - 参数。
  87039. * @param {boolean} [options.loadWhileAnimating=false] - 是否在移动时实时绘制。
  87040. * @param {string} [options.attribution='© 2018 百度 ECharts'] - 版权信息。
  87041. * @usage
  87042. */
  87043. const EchartsLayer = external_L_default().Layer.extend({
  87044. includes: [],
  87045. _echartsContainer: null,
  87046. _map: null,
  87047. _ec: null,
  87048. _echartsOptions: null,
  87049. options: {
  87050. attribution: core_Attributions.ECharts.attribution,
  87051. loadWhileAnimating: false
  87052. },
  87053. initialize: function (echartsOptions, options) {
  87054. external_L_default().Util.setOptions(this, options);
  87055. this.setOption(echartsOptions);
  87056. },
  87057. /**
  87058. * @function EchartsLayer.prototype.setOption
  87059. * @description 设置图表地图参数。
  87060. * @param {Object} echartsOptions - 图表参数。
  87061. * @param {string} lazyUpdate - 后台自动更新。
  87062. * @param {boolean} [notMerge] - 是否合并参数。
  87063. */
  87064. setOption: function (echartsOptions, notMerge, lazyUpdate) {
  87065. const baseOption = echartsOptions.baseOption || echartsOptions;
  87066. baseOption.LeafletMap = baseOption.LeafletMap || {
  87067. roam: true
  87068. };
  87069. baseOption.animation = baseOption.animation === true;
  87070. this._echartsOptions = echartsOptions;
  87071. this._ec && this._ec.setOption(echartsOptions, notMerge, lazyUpdate);
  87072. },
  87073. getEcharts: function () {
  87074. return this._ec;
  87075. },
  87076. _disableEchartsContainer: function () {
  87077. this._echartsContainer.style.visibility = "hidden";
  87078. },
  87079. _enableEchartsContainer: function () {
  87080. this._echartsContainer.style.visibility = "visible";
  87081. },
  87082. /**
  87083. * @private
  87084. * @function EchartsLayer.prototype.onAdd
  87085. * @description 添加地图。
  87086. * @param {L.Map} map - Leaflet Map 对象。
  87087. */
  87088. onAdd: function (map) {
  87089. this._map = map;
  87090. this._initEchartsContainer();
  87091. this._ec = external_function_try_return_echarts_catch_e_return_namespaceObject.init(this._echartsContainer);
  87092. this._ec.leafletMap= map;
  87093. const me = this;
  87094. map.on("zoomstart", function () {
  87095. me._disableEchartsContainer();
  87096. });
  87097. !me.options.loadWhileAnimating && map.on("movestart", function () {
  87098. me._disableEchartsContainer();
  87099. });
  87100. external_function_try_return_echarts_catch_e_return_namespaceObject.registerAction({
  87101. type: 'LeafletMapLayout',
  87102. event: 'LeafletMapLayout',
  87103. update: 'updateLayout'
  87104. }, function (payload ) { // eslint-disable-line no-unused-vars
  87105. });
  87106. external_function_try_return_echarts_catch_e_return_namespaceObject.registerCoordinateSystem(
  87107. 'leaflet', LeafletMapCoordSys
  87108. );
  87109. external_function_try_return_echarts_catch_e_return_namespaceObject.extendComponentModel({
  87110. type: 'LeafletMap',
  87111. getBMap: function () {
  87112. return this.__LeafletMap;
  87113. },
  87114. defaultOption: {
  87115. roam: false
  87116. }
  87117. });
  87118. external_function_try_return_echarts_catch_e_return_namespaceObject.extendComponentView({
  87119. type: 'LeafletMap',
  87120. render: function (LeafletMapModel, ecModel, api) {
  87121. let rendering = true;
  87122. let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
  87123. const viewportRoot = api.getZr().painter.getViewportRoot();
  87124. const animated = leafletMap.options.zoomAnimation && (external_L_default()).Browser.any3d;
  87125. viewportRoot.className = ' leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide') + ' echarts-layer';
  87126. const originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  87127. viewportRoot.style[originProp] = '50% 50%';
  87128. const coordSys = LeafletMapModel.coordinateSystem;
  87129. const ecLayers = api.getZr().painter.getLayers();
  87130. _setCanvasPosition(me._map, viewportRoot);
  87131. const moveHandler = function () {
  87132. if (rendering) {
  87133. return;
  87134. }
  87135. const mapOffset = _setCanvasPosition(me._map, viewportRoot);
  87136. if (!me.options.loadWhileAnimating) {
  87137. for (let item in ecLayers) {
  87138. if (!ecLayers.hasOwnProperty(item)) {
  87139. continue;
  87140. }
  87141. ecLayers[item] && clearContext(ecLayers[item].ctx);
  87142. }
  87143. me._enableEchartsContainer();
  87144. }
  87145. coordSys.setMapOffset(mapOffset);
  87146. LeafletMapModel.__mapOffset = mapOffset;
  87147. api.dispatchAction({
  87148. type: 'LeafletMapLayout'
  87149. });
  87150. };
  87151. function clearContext(context) {
  87152. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  87153. }
  87154. function zoomEndHandler() {
  87155. if (rendering) {
  87156. return;
  87157. }
  87158. api.dispatchAction({
  87159. type: 'LeafletMapLayout'
  87160. });
  87161. me._enableEchartsContainer();
  87162. }
  87163. if (me._oldMoveHandler) {
  87164. leafletMap.off(me.options.loadWhileAnimating ? 'move' : 'moveend', me._oldMoveHandler);
  87165. }
  87166. if (me._oldZoomEndHandler) {
  87167. leafletMap.off('zoomend', me._oldZoomEndHandler);
  87168. }
  87169. leafletMap.on(me.options.loadWhileAnimating ? 'move' : 'moveend', moveHandler);
  87170. leafletMap.on('zoomend', zoomEndHandler);
  87171. me._oldMoveHandler = moveHandler;
  87172. me._oldZoomEndHandler = zoomEndHandler;
  87173. rendering = false;
  87174. }
  87175. });
  87176. this._ec.setOption(this._echartsOptions);
  87177. },
  87178. onRemove: function () {
  87179. // 销毁echarts实例
  87180. this._ec.clear();
  87181. this._ec.dispose();
  87182. delete this._ec;
  87183. external_L_default().DomUtil.remove(this._echartsContainer);
  87184. if (this._oldZoomEndHandler) {
  87185. this._map.off("zoomend", this._oldZoomEndHandler);
  87186. this._oldZoomEndHandler = null;
  87187. }
  87188. if (this._oldMoveHandler) {
  87189. this._map.off(this.options.loadWhileAnimating ? 'move' : 'moveend', this._oldMoveHandler);
  87190. this._oldMoveHandler = null;
  87191. }
  87192. if (this._resizeHandler) {
  87193. this._map.off('resize', this._resizeHandler);
  87194. this._resizeHandler = null;
  87195. }
  87196. delete this._map;
  87197. },
  87198. _initEchartsContainer: function () {
  87199. const size = this._map.getSize();
  87200. const _div = document.createElement('div');
  87201. _div.style.position = 'absolute';
  87202. _div.style.height = size.y + 'px';
  87203. _div.style.width = size.x + 'px';
  87204. _div.style.zIndex = 10;
  87205. this._echartsContainer = _div;
  87206. this.getPane().appendChild(this._echartsContainer);
  87207. const me = this;
  87208. function _resizeHandler(e) {
  87209. let size = e.newSize;
  87210. me._echartsContainer.style.width = size.x + 'px';
  87211. me._echartsContainer.style.height = size.y + 'px';
  87212. me._ec.resize()
  87213. }
  87214. this._map.on('resize', _resizeHandler);
  87215. this._resizeHandler = _resizeHandler
  87216. }
  87217. });
  87218. /**
  87219. * @class LeafletMapCoordSys
  87220. * @private
  87221. * @classdesc 地图坐标系统类。
  87222. * @param {L.Map} leafletMap - Leaflet Map 对象。
  87223. */
  87224. function LeafletMapCoordSys(leafletMap) {
  87225. this._LeafletMap = leafletMap;
  87226. this.dimensions = ['lng', 'lat'];
  87227. this._mapOffset = _getMapOffset(leafletMap);
  87228. }
  87229. LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat'];
  87230. LeafletMapCoordSys.prototype.setMapOffset = function (mapOffset) {
  87231. this._mapOffset = mapOffset
  87232. };
  87233. LeafletMapCoordSys.prototype.getBMap = function () {
  87234. return this._LeafletMap
  87235. };
  87236. LeafletMapCoordSys.prototype.prepareCustoms = function () {
  87237. const zrUtil = external_function_try_return_echarts_catch_e_return_namespaceObject.util;
  87238. const rect = this.getViewRect();
  87239. return {
  87240. coordSys: {
  87241. // The name exposed to user is always 'cartesian2d' but not 'grid'.
  87242. type: 'leaflet',
  87243. x: rect.x,
  87244. y: rect.y,
  87245. width: rect.width,
  87246. height: rect.height
  87247. },
  87248. api: {
  87249. coord: zrUtil.bind(this.dataToPoint, this),
  87250. size: zrUtil.bind(dataToCoordSize, this)
  87251. }
  87252. };
  87253. function dataToCoordSize(dataSize, dataItem) {
  87254. dataItem = dataItem || [0, 0];
  87255. return zrUtil.map([0, 1], function (dimIdx) {
  87256. const val = dataItem[dimIdx];
  87257. const halfSize = dataSize[dimIdx] / 2;
  87258. const p1 = [];
  87259. const p2 = [];
  87260. p1[dimIdx] = val - halfSize;
  87261. p2[dimIdx] = val + halfSize;
  87262. p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
  87263. return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
  87264. }, this);
  87265. }
  87266. };
  87267. LeafletMapCoordSys.prototype.dataToPoint = function (data) {
  87268. //处理数据中的null值
  87269. if (data[1] === null) {
  87270. data[1] = (external_L_default()).CRS.EPSG3857.projection.MAX_LATITUDE;
  87271. }
  87272. //平面坐标系不能这么处理
  87273. //data[1] = this.fixLat(data[1]);
  87274. const px = this._LeafletMap.latLngToLayerPoint([data[1], data[0]]);
  87275. const mapOffset = this._mapOffset;
  87276. return [px.x - mapOffset[0], px.y - mapOffset[1]];
  87277. };
  87278. LeafletMapCoordSys.prototype.fixLat = function (lat) {
  87279. if (lat >= 90) {
  87280. return 89.99999999999999;
  87281. }
  87282. if (lat <= -90) {
  87283. return -89.99999999999999;
  87284. }
  87285. return lat;
  87286. };
  87287. LeafletMapCoordSys.prototype.pointToData = function (pt) {
  87288. let mapOffset = this._mapOffset;
  87289. let point = this._LeafletMap.layerPointToLatLng([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
  87290. return [point.lng, point.lat];
  87291. };
  87292. LeafletMapCoordSys.prototype.getViewRect = function () {
  87293. const size = this._LeafletMap.getSize();
  87294. return new external_function_try_return_echarts_catch_e_return_namespaceObject.graphic.BoundingRect(0, 0, size.x, size.y);
  87295. };
  87296. LeafletMapCoordSys.prototype.getRoamTransform = function () {
  87297. return external_function_try_return_echarts_catch_e_return_namespaceObject.matrix.create();
  87298. };
  87299. LeafletMapCoordSys.dimensions = LeafletMapCoordSys.prototype.dimensions;
  87300. LeafletMapCoordSys.create = function (ecModel) {
  87301. let coordSys;
  87302. let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
  87303. ecModel.eachComponent('LeafletMap', function (leafletMapModel) {
  87304. if (!coordSys) {
  87305. coordSys = new LeafletMapCoordSys(leafletMap);
  87306. }
  87307. leafletMapModel.coordinateSystem = coordSys;
  87308. leafletMapModel.coordinateSystem.setMapOffset(leafletMapModel.__mapOffset || _getMapOffset(leafletMap));
  87309. });
  87310. ecModel.eachSeries(function (seriesModel) {
  87311. if (seriesModel.get('coordinateSystem') === 'leaflet') {
  87312. if (!coordSys) {
  87313. coordSys = new LeafletMapCoordSys(leafletMap);
  87314. }
  87315. seriesModel.coordinateSystem = coordSys;
  87316. seriesModel.animation = seriesModel.animation === true;
  87317. }
  87318. })
  87319. };
  87320. function _getMapOffset(map) {
  87321. const offset = map.containerPointToLayerPoint([0, 0]);
  87322. const mapOffset = [offset.x || 0, offset.y || 0];
  87323. return mapOffset;
  87324. }
  87325. function _setCanvasPosition(map, viewportRoot) {
  87326. const mapOffset = _getMapOffset(map);
  87327. viewportRoot.style.left = mapOffset[0] + 'px';
  87328. viewportRoot.style.top = mapOffset[1] + 'px';
  87329. return mapOffset;
  87330. }
  87331. const echartsLayer = function (echartsOptions, options) {
  87332. return new EchartsLayer(echartsOptions, options);
  87333. };
  87334. ;// CONCATENATED MODULE: ./src/leaflet/core/Detector.js
  87335. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87336. * This program are made available under the terms of the Apache License, Version 2.0
  87337. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87338. class Detector {
  87339. static supportWebGL() {
  87340. return getContext('webgl');
  87341. }
  87342. static supportWebGL2() {
  87343. return getContext('webgl2');
  87344. }
  87345. static supportCanvas() {
  87346. return getContext('2d');
  87347. }
  87348. }
  87349. function getContext(context) {
  87350. var canvas = document.createElement('canvas');
  87351. return canvas && canvas.getContext(context);
  87352. }
  87353. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CloverStyle.js
  87354. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87355. * This program are made available under the terms of the Apache License, Version 2.0
  87356. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87357. /**
  87358. * @class CloverStyle
  87359. * @deprecatedclassinstance L.supermap.cloverStyle
  87360. * @classdesc 三叶草要素风格类。
  87361. * @category Visualization Graphic
  87362. * @modulecategory Overlay
  87363. * @extends {L.Class}
  87364. * @param {Object} options - 参数。
  87365. * @param {number} [options.angle=60] - 三叶草每个扇叶的圆心角,单位弧度。
  87366. * @param {number} [options.spaceAngle=0] - 扇叶间隔角度,通过计算获取。
  87367. * @param {number} [options.count=3] - 扇叶数量。
  87368. * @param {boolean} [options.stroke=true] - 是否描边。
  87369. * @param {number} [options.strokeWidth=1] - 边框宽度。
  87370. * @param {string} [options.color='#3388ff'] - 颜色。
  87371. * @param {number} [options.weight=1] - 线宽。
  87372. * @param {number} [options.opacity=1] - 透明度。
  87373. * @param {string} [options.lineCap='round'] - 线帽形状。
  87374. * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
  87375. * @param {boolean} [options.fill=false] - 是否填充。
  87376. * @param {string} [options.fillColor='#66ccff'] - 填充色。
  87377. * @param {number} [options.fillOpacity=0.2] - 填充透明度。
  87378. * @param {string} [options.fillRule='evenodd'] - 填充形状。
  87379. * @param {number} [options.radius=10] - 半径。
  87380. * @usage
  87381. */
  87382. var CloverStyle = external_L_default().Class.extend({
  87383. options: {
  87384. radius: 10,
  87385. angele: 60,
  87386. spaceAngle: 0,
  87387. count: 3,
  87388. fill: false,
  87389. stroke: true,
  87390. color: '#3388ff',
  87391. weight: 1,
  87392. lineCap: 'round',
  87393. lineJoin: 'round',
  87394. fillColor: '#66ccff',
  87395. fillOpacity: 0.2,
  87396. fillRule: 'evenodd',
  87397. opacity: 1,
  87398. strokeWidth:1
  87399. },
  87400. initialize: function (options) {
  87401. options = options || {};
  87402. external_L_default().Util.setOptions(this, options);
  87403. this._canvas = document.createElement('canvas');
  87404. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  87405. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  87406. this._ctx = this._canvas.getContext('2d');
  87407. var strokeWidth = this.options.strokeWidth === undefined ? 1 : this.options.strokeWidth;
  87408. this.options.width = 2 * (this.options.radius + strokeWidth) + 1;
  87409. this._initStyle();
  87410. },
  87411. /**
  87412. * @function CloverStyle.prototype.getStyle
  87413. * @description 获取画布。
  87414. */
  87415. getStyle: function () {
  87416. return this._canvas;
  87417. },
  87418. /**
  87419. * @function CloverStyle.prototype.drawSector
  87420. * @description 绘制扇形。
  87421. * @param {CanvasRenderingContext2D} ctx - context 对象。
  87422. * @param {number} x - 中心点 x。
  87423. * @param {number} y - 中心点 y。
  87424. * @param {number} r - 中心点 r。
  87425. * @param {number} sAngle - 扇叶起始角度。
  87426. * @param {number} eAngle - 扇叶终止角度。
  87427. */
  87428. drawSector: function (ctx, x, y, r, sAngle, eAngle) {
  87429. //角度转换
  87430. sAngle = sAngle / 180 * Math.PI;
  87431. eAngle = eAngle / 180 * Math.PI;
  87432. ctx.moveTo(x, y);
  87433. ctx.lineTo(x + r * Math.cos(sAngle), y + r * Math.sin(sAngle));
  87434. ctx.arc(x, y, r, sAngle, eAngle);
  87435. ctx.lineTo(x, y);
  87436. },
  87437. _initStyle: function () {
  87438. //起始角度
  87439. var sAngle = 0;
  87440. var options = this.options;
  87441. var eAngle = options.angle;
  87442. options.spaceAngle = 360 / options.count - options.angle;
  87443. if (options.spaceAngle < 0) {
  87444. return;
  87445. }
  87446. this._ctx.beginPath();
  87447. this.anchor = [options.width / 2, options.width / 2];
  87448. for (var i = 0; i < options.count; i++) {
  87449. this.drawSector(this._ctx, this.anchor[0], this.anchor[1], options.radius, sAngle, eAngle);
  87450. sAngle = eAngle + options.spaceAngle;
  87451. eAngle = sAngle + options.angle;
  87452. }
  87453. this._fillStroke();
  87454. },
  87455. _fillStroke: function () {
  87456. var options = this.options;
  87457. if (options.fill) {
  87458. this._ctx.globalAlpha = options.fillOpacity;
  87459. this._ctx.fillStyle = options.fillColor || options.color;
  87460. this._ctx.fill(options.fillRule || 'evenodd');
  87461. }
  87462. if (options.stroke && options.weight !== 0) {
  87463. this._ctx.globalAlpha = options.opacity;
  87464. this._ctx.lineWidth = options.weight;
  87465. this._ctx.strokeStyle = options.color;
  87466. this._ctx.lineCap = options.lineCap;
  87467. this._ctx.lineJoin = options.lineJoin;
  87468. this._ctx.stroke();
  87469. }
  87470. }
  87471. });
  87472. var cloverStyle = function (options) {
  87473. return new CloverStyle(options);
  87474. };
  87475. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CircleStyle.js
  87476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87477. * This program are made available under the terms of the Apache License, Version 2.0
  87478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87479. /**
  87480. * @class CircleStyle
  87481. * @deprecatedclassinstance L.supermap.circleStyle
  87482. * @classdesc 圆形要素风格类。
  87483. * @category Visualization Graphic
  87484. * @modulecategory Overlay
  87485. * @extends {L.Class}
  87486. * @param {Object} options - 参数。
  87487. * @param {boolean} [options.stroke=true] - 是否描边。
  87488. * @param {string} [options.color='#3388ff'] - 颜色。
  87489. * @param {number} [options.weight=1] - 线宽。
  87490. * @param {number} [options.opacity=1] - 透明度。
  87491. * @param {string} [options.lineCap='round'] - 线帽形状。
  87492. * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
  87493. * @param {boolean} [options.fill=false] - 是否填充。
  87494. * @param {string} [options.fillColor] - 填充色。
  87495. * @param {number} [options.fillOpacity=0.2] - 填充透明度。
  87496. * @param {string} [options.fillRule='evenodd'] - 填充形状。
  87497. * @param {number} [options.radius=3] - 半径。
  87498. * @usage
  87499. */
  87500. var CircleStyle = external_L_default().Class.extend({
  87501. options: {
  87502. stroke: true,
  87503. color: '#3388ff',
  87504. weight: 1,
  87505. opacity: 1,
  87506. lineCap: 'round',
  87507. lineJoin: 'round',
  87508. fill: false,
  87509. fillColor: null,
  87510. fillOpacity: 0.2,
  87511. fillRule: 'evenodd',
  87512. radius: 3
  87513. },
  87514. initialize: function (options) {
  87515. options = options || {};
  87516. external_L_default().Util.setOptions(this, options);
  87517. this._canvas = document.createElement('canvas');
  87518. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  87519. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  87520. this._ctx = this._canvas.getContext('2d');
  87521. this._initStyle();
  87522. },
  87523. /**
  87524. * @deprecated
  87525. * @function CircleStyle.prototype.getCanvas
  87526. * @description 获取画布,已弃用该设置,请使用 getStyle 接口。
  87527. */
  87528. getCanvas: function () {
  87529. return this._canvas;
  87530. },
  87531. /**
  87532. * @function CircleStyle.prototype.getStyle
  87533. * @description 获取画布。
  87534. */
  87535. getStyle: function () {
  87536. return this._canvas;
  87537. },
  87538. _initStyle: function () {
  87539. this._ctx.beginPath();
  87540. this._ctx.arc(this._canvas.width / 2, this._canvas.height / 2, this.options.radius, 0, Math.PI * 2);
  87541. this._fillStroke();
  87542. },
  87543. _fillStroke: function () {
  87544. var options = this.options;
  87545. if (options.fill) {
  87546. this._ctx.globalAlpha = options.fillOpacity;
  87547. this._ctx.fillStyle = options.fillColor || options.color;
  87548. this._ctx.fill(options.fillRule || 'evenodd');
  87549. }
  87550. if (options.stroke && options.weight !== 0) {
  87551. this._ctx.globalAlpha = options.opacity;
  87552. this._ctx.lineWidth = options.weight;
  87553. this._ctx.strokeStyle = options.color;
  87554. this._ctx.lineCap = options.lineCap;
  87555. this._ctx.lineJoin = options.lineJoin;
  87556. this._ctx.stroke();
  87557. }
  87558. }
  87559. });
  87560. var circleStyle = function (options) {
  87561. return new CircleStyle(options);
  87562. };
  87563. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/ImageStyle.js
  87564. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87565. * This program are made available under the terms of the Apache License, Version 2.0
  87566. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87567. /**
  87568. * @class ImageStyle
  87569. * @deprecatedclassinstance L.supermap.imageStyle
  87570. * @classdesc 自定义图形要素风格类。
  87571. * @category Visualization Graphic
  87572. * @modulecategory Overlay
  87573. * @extends {L.Class}
  87574. * @param {Object} options - 参数。
  87575. * @param {HTMLImageElement} options.img - image 对象。
  87576. * @param {Array.<number>} [options.origin=[0.0]] - 中心点。
  87577. * @param {Array} [options.anchor] - 偏移量。
  87578. * @param {Array} [options.size] - 图形大小,即高度和宽度[width,height]。
  87579. * @param {Array} [options.radius] - 半径。
  87580. * @param {Array} [options.weight] - 宽度。
  87581. * @usage
  87582. */
  87583. var ImageStyle = external_L_default().Class.extend({
  87584. options: {
  87585. img: null,
  87586. origin: [0, 0],
  87587. anchor: null,
  87588. size: null
  87589. },
  87590. initialize: function (options) {
  87591. options = options || {};
  87592. external_L_default().Util.setOptions(this, options);
  87593. this._canvas = document.createElement('canvas');
  87594. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  87595. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  87596. this._ctx = this._canvas.getContext('2d');
  87597. },
  87598. /**
  87599. * @function ImageStyle.prototype.getStyle
  87600. * @description 获取样式。
  87601. */
  87602. getStyle: function () {
  87603. return this.options;
  87604. }
  87605. });
  87606. var imageStyle = function (options) {
  87607. return new ImageStyle(options);
  87608. };
  87609. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CanvasRenderer.js
  87610. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87611. * This program are made available under the terms of the Apache License, Version 2.0
  87612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87613. const emptyFunc = (external_L_default()).Util.falseFn;
  87614. var GraphicCanvasRenderer = external_L_default().Class.extend({
  87615. initialize: function (layer, options) {
  87616. this.layer = layer;
  87617. options = options || {};
  87618. external_L_default().Util.setOptions(this, options);
  87619. },
  87620. /**
  87621. * @private
  87622. * @function GraphicCanvasRenderer.prototype.getRenderer
  87623. * @description 返回渲染器,提供图层后续的数据增删改。
  87624. * @returns {L.Canvas}
  87625. */
  87626. getRenderer: function () {
  87627. return this.options.renderer;
  87628. },
  87629. /**
  87630. * @private
  87631. * @function GraphicCanvasRenderer.prototype.update
  87632. * @description 更新图层,数据或者样式改变后调用。
  87633. */
  87634. update: function () {
  87635. this.getRenderer()._clear();
  87636. this.getRenderer()._draw();
  87637. },
  87638. _getGraphicAtPoint: function (p) {
  87639. const layer = this.layer;
  87640. const map = layer._map;
  87641. let graphics = layer._getGraphicsInBounds();
  87642. for (let i = graphics.length - 1; i >= 0; i--) {
  87643. let p1, p2, bounds;
  87644. const center = map.latLngToLayerPoint(graphics[i].getLatLng());
  87645. let style = graphics[i].getStyle();
  87646. if (!style && this.defaultStyle) {
  87647. style = this.defaultStyle;
  87648. }
  87649. if (style.img) {
  87650. let imgWidth = style.img.width;
  87651. let imgHeight = style.img.height;
  87652. if (style.size && style.size[0] && style.size[1]) {
  87653. imgWidth = style.size[0];
  87654. imgHeight = style.size[1];
  87655. }
  87656. const anchor = style.anchor || [imgWidth / 2, imgHeight / 2];
  87657. p1 = external_L_default().point(center.x - anchor[0], center.y - anchor[1]);
  87658. p2 = external_L_default().point(p1.x + imgWidth, p1.y + imgHeight);
  87659. } else {
  87660. p1 = external_L_default().point(center.x - style.width / 2, center.y - style.height / 2);
  87661. p2 = external_L_default().point(center.x + style.width / 2, center.y + style.height / 2);
  87662. }
  87663. bounds = external_L_default().bounds(p1, p2);
  87664. if (bounds.contains(p)) {
  87665. return graphics[i];
  87666. }
  87667. }
  87668. return null;
  87669. },
  87670. containsPoint: function (p) {
  87671. return !!this._getGraphicAtPoint(p);
  87672. },
  87673. _handleClick: function (evt) {
  87674. evt.target = null;
  87675. const layer = this.layer;
  87676. const map = layer._map;
  87677. const graphic = this._getGraphicAtPoint(map.latLngToLayerPoint(evt.latlng));
  87678. if (graphic) {
  87679. this.layer._renderer._ctx.canvas.style.cursor = 'pointer';
  87680. evt.target = graphic;
  87681. if (evt.type === 'click' && layer.options.onClick) {
  87682. layer.options.onClick.call(layer, graphic, evt);
  87683. }
  87684. return;
  87685. }
  87686. this.layer._renderer._ctx.canvas.style.cursor = 'auto';
  87687. },
  87688. //跟GraphicWebGLRenderer保持一致
  87689. _clearBuffer: emptyFunc
  87690. });
  87691. external_L_default().Canvas.include({
  87692. drawGraphics: function (graphics, defaultStyle) {
  87693. var me = this;
  87694. if (!me._drawing) {
  87695. return;
  87696. }
  87697. //this._ctx.clearRect(0, 0, this._ctx.canvas.width, me._ctx.canvas.height);
  87698. graphics.forEach(function (graphic) {
  87699. var style = graphic.getStyle();
  87700. if (!style && defaultStyle) {
  87701. style = defaultStyle;
  87702. }
  87703. if (style.img) {
  87704. //绘制图片
  87705. me._drawImage.call(me, me._ctx, style, graphic.getLatLng());
  87706. } else {
  87707. //绘制canvas
  87708. me._drawCanvas.call(me, me._ctx, style, graphic.getLatLng());
  87709. }
  87710. });
  87711. },
  87712. _drawCanvas: function (ctx, style, latLng) {
  87713. var canvas = style;
  87714. var pt = this._map.latLngToLayerPoint(latLng);
  87715. var p0 = pt.x - canvas.width / 2;
  87716. var p1 = pt.y - canvas.height / 2;
  87717. var width = canvas.width;
  87718. var height = canvas.height;
  87719. ctx.drawImage(canvas, p0, p1, width, height);
  87720. },
  87721. _drawImage: function (ctx, style, latLng) {
  87722. //设置图片的大小
  87723. var width, height;
  87724. if (style.size) {
  87725. var size = style.size;
  87726. width = size[0];
  87727. height = size[1];
  87728. } else {
  87729. width = style.img.width;
  87730. height = style.img.height;
  87731. }
  87732. //设置偏移
  87733. var point = this._coordinateToPoint(latLng);
  87734. var pt = external_L_default().point(point),
  87735. ac = external_L_default().point(style.anchor || [width / 2, height / 2]);
  87736. point = [pt.x - ac.x, pt.y - ac.y];
  87737. //参数分别为:图片,图片裁剪下x,y位置,裁剪长宽,放置在画布的位置x,y, 占取画布长宽
  87738. //ctx.drawImage(style.img, 0, 0, width, height, point[0], point[1], width, height);
  87739. ctx.drawImage(style.img, point[0], point[1], width, height);
  87740. },
  87741. _coordinateToPoint: function (coordinate) {
  87742. if (!this._map) {
  87743. return coordinate;
  87744. }
  87745. var latLng = coordinate;
  87746. if (external_L_default().Util.isArray(coordinate)) {
  87747. latLng = external_L_default().latLng(coordinate[0], coordinate[1]);
  87748. } else if (coordinate instanceof (external_L_default()).LatLng) {
  87749. latLng = external_L_default().latLng(coordinate.lat, coordinate.lng);
  87750. }
  87751. var point = this._map.latLngToLayerPoint(latLng);
  87752. return [point.x, point.y];
  87753. }
  87754. });
  87755. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/WebGLRenderer.js
  87756. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87757. * This program are made available under the terms of the Apache License, Version 2.0
  87758. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87759. const WebGLRenderer_emptyFunc = (external_L_default()).Util.falseFn;
  87760. /**
  87761. * @private
  87762. * @class GraphicWebGLRenderer
  87763. * @classdesc 高效率点图层 webgl 渲染器。
  87764. * @category Visualization Graphic
  87765. * @extends {L.Layer}
  87766. * @param {Array.<GraphicLayer>} layer - 高效率点图层。
  87767. * @param {Object} options - 参数。
  87768. * @param {number} options.width - 地图宽度。
  87769. * @param {number} options.height - 地图高度。
  87770. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  87771. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  87772. * @param {number} [options.radius=10] - 半径。
  87773. * @param {number} [options.opacity=0.8] - 不透明度。
  87774. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  87775. * @param {number} [options.radiusScale=1] - 点放大倍数。
  87776. * @param {number} [options.radiusMinPixels=0] - 半径最小值,单位为像素。
  87777. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值,单位为像素。
  87778. * @param {number} [options.strokeWidth=1] - 边框大小。
  87779. * @param {boolean} [options.outline=false] - 是否显示边框。
  87780. * @param {function} [options.onClick] - 点击事件。
  87781. * @param {function} [options.onHover] - 悬停事件。
  87782. */
  87783. const CSS_TRANSFORM = (function () {
  87784. let div = document.createElement('div');
  87785. let props = [
  87786. 'transform',
  87787. 'WebkitTransform',
  87788. 'MozTransform',
  87789. 'OTransform',
  87790. 'msTransform'
  87791. ];
  87792. for (let i = 0; i < props.length; i++) {
  87793. let prop = props[i];
  87794. if (div.style[prop] !== undefined) {
  87795. return prop;
  87796. }
  87797. }
  87798. return props[0];
  87799. })();
  87800. var GraphicWebGLRenderer = external_L_default().Class.extend({
  87801. initialize: function (layer, options) {
  87802. this.layer = layer;
  87803. let opt = options || {};
  87804. external_L_default().Util.setOptions(this, opt);
  87805. this.options.radius = this._pixelToMeter(this.options.radius);
  87806. this._initContainer();
  87807. },
  87808. /**
  87809. * @private
  87810. * @function GraphicWebGLRenderer.prototype.getRenderer
  87811. * @description 返回渲染器,可对图层数据增加、删除和修改。
  87812. * @returns {GraphicWebGLRenderer}
  87813. */
  87814. getRenderer: function () {
  87815. return this;
  87816. },
  87817. /**
  87818. * @private
  87819. * @function GraphicWebGLRenderer.prototype.update
  87820. * @description 更新图层。
  87821. */
  87822. update: function (graphics) {
  87823. if (graphics && graphics.length > -1) {
  87824. this._data = graphics;
  87825. }
  87826. this._renderLayer.setChangeFlags({
  87827. dataChanged: true,
  87828. propsChanged: true,
  87829. viewportChanged: true,
  87830. updateTriggersChanged: true
  87831. });
  87832. this._refreshData();
  87833. let state = this._getLayerState();
  87834. state.data = this._data || [];
  87835. this._layerDefaultStyleCache = null;
  87836. this._renderLayer.setNeedsRedraw(true);
  87837. this._renderLayer.setState(state);
  87838. },
  87839. /**
  87840. * @private
  87841. * @function GraphicWebGLRenderer.prototype.drawGraphics
  87842. * @description 绘制点要素。
  87843. */
  87844. drawGraphics: function (graphics) {
  87845. this._clearBuffer();
  87846. let size = this.layer._map.getSize();
  87847. if (this._container.width !== size.x) {
  87848. this._container.width = size.x;
  87849. }
  87850. if (this._container.height !== size.y) {
  87851. this._container.height = size.y;
  87852. }
  87853. let mapPane = this.layer._map.getPanes().mapPane;
  87854. let point = mapPane._leaflet_pos;
  87855. this._container.style[CSS_TRANSFORM] = 'translate(' +
  87856. -Math.round(point.x) + 'px,' +
  87857. -Math.round(point.y) + 'px)';
  87858. this._data = graphics || [];
  87859. if (!this._renderLayer) {
  87860. this._createInnerRender();
  87861. }
  87862. this._draw();
  87863. },
  87864. _initContainer: function () {
  87865. this._container = this._createCanvas(this.options.width, this.options.height);
  87866. this._layerContainer = this.options.container;
  87867. this._wrapper = external_L_default().DomUtil.create('div', "deck-wrapper", this._layerContainer);
  87868. this._wrapper.appendChild(this._container);
  87869. },
  87870. _createCanvas: function (width, height) {
  87871. //leaflet-layer 对应的css会自动设置position
  87872. let canvas = external_L_default().DomUtil.create('canvas', 'graphicLayer leaflet-layer leaflet-zoom-hide');
  87873. canvas.oncontextmenu = (external_L_default()).Util.falseFn;
  87874. canvas.width = width;
  87875. canvas.height = height;
  87876. canvas.style.width = width + "px";
  87877. canvas.style.height = height + "px";
  87878. return canvas;
  87879. },
  87880. _pixelToMeter: function (pixel) {
  87881. const bounds = this.layer._map.getBounds();
  87882. const latlngRes = (bounds.getEast() - bounds.getWest()) / this.layer._map.getSize().x
  87883. const meterRes = latlngRes * (Math.PI * 6378137 / 180);
  87884. return pixel * meterRes;
  87885. },
  87886. _createInnerRender: function () {
  87887. let me = this;
  87888. let state = this._getLayerState();
  87889. let {
  87890. color,
  87891. radius,
  87892. opacity,
  87893. highlightColor,
  87894. radiusScale,
  87895. radiusMinPixels,
  87896. radiusMaxPixels,
  87897. strokeWidth,
  87898. outline
  87899. } = state;
  87900. let innerLayerOptions = {
  87901. id: 'scatter-plot',
  87902. data: me._data,
  87903. pickable: Boolean(this.options.onClick) || Boolean(this.options.onHover),
  87904. autoHighlight: true,
  87905. color: color,
  87906. opacity: opacity,
  87907. radius: radius,
  87908. radiusScale: radiusScale,
  87909. highlightColor: highlightColor,
  87910. radiusMinPixels: radiusMinPixels,
  87911. radiusMaxPixels: radiusMaxPixels,
  87912. strokeWidth: strokeWidth,
  87913. coordinateSystem:this._isWGS84()?window.DeckGL.COORDINATE_SYSTEM.LNGLAT_OFFSETS:window.DeckGL.COORDINATE_SYSTEM.LNGLAT,
  87914. isGeographicCoordinateSystem: this._isWGS84(),
  87915. outline: outline,
  87916. getPosition: function (point) {
  87917. if (!point) {
  87918. return [0, 0, 0];
  87919. }
  87920. let lngLat = point.getLatLng();
  87921. return lngLat && [lngLat.lng, lngLat.lat, 0];
  87922. },
  87923. getColor: function (point) {
  87924. let defaultStyle = me._getLayerDefaultStyle();
  87925. let style = point && point.options;
  87926. return style && style.color || defaultStyle.color
  87927. },
  87928. getRadius: function (point) {
  87929. let defaultStyle = me._getLayerDefaultStyle();
  87930. let style = point && point.getStyle();
  87931. return style && style.radius || defaultStyle.radius
  87932. },
  87933. updateTriggers: {
  87934. getColor: [color],
  87935. getRadius: [radius]
  87936. }
  87937. };
  87938. let _self = this;
  87939. if (this.options.onClick) {
  87940. innerLayerOptions.onClick = function () {
  87941. _self._container.style.cursor = "pointer";
  87942. _self.options.onClick.apply(_self, arguments)
  87943. };
  87944. }
  87945. if (this.options.onHover) {
  87946. innerLayerOptions.onHover = function () {
  87947. _self._container.style.cursor = "pointer";
  87948. _self.options.onHover.apply(_self, arguments)
  87949. };
  87950. }
  87951. me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
  87952. },
  87953. _getLayerDefaultStyle: function () {
  87954. if (this._layerDefaultStyleCache) {
  87955. return this._layerDefaultStyleCache;
  87956. }
  87957. let {
  87958. color,
  87959. opacity,
  87960. radius,
  87961. radiusScale,
  87962. radiusMinPixels,
  87963. radiusMaxPixels,
  87964. strokeWidth,
  87965. outline
  87966. } = this.layer.options;
  87967. radius = this._pixelToMeter(radius);
  87968. this._layerDefaultStyleCache = {
  87969. color,
  87970. opacity,
  87971. radius,
  87972. radiusScale,
  87973. radiusMinPixels,
  87974. radiusMaxPixels,
  87975. strokeWidth,
  87976. outline
  87977. }
  87978. return this._layerDefaultStyleCache
  87979. },
  87980. _getLayerState: function () {
  87981. let state = this.layer.getState();
  87982. state.zoom = state.zoom - 1;
  87983. return state;
  87984. },
  87985. _draw: function () {
  87986. let state = this._getLayerState();
  87987. this._refreshData();
  87988. state.data = this._data || [];
  87989. let deckOptions = {};
  87990. for (let key in state) {
  87991. deckOptions[key] = state[key];
  87992. }
  87993. this._layerDefaultStyleCache = null;
  87994. this._renderLayer.setNeedsRedraw(true);
  87995. deckOptions.layers = [this._renderLayer];
  87996. deckOptions.canvas = this._container;
  87997. deckOptions.onBeforeRender = this._onBeforeRender.bind(this);
  87998. deckOptions.onAfterRender = this._onAfterRender.bind(this);
  87999. deckOptions.coordinateSystem = this._isWGS84()? window.DeckGL.COORDINATE_SYSTEM.LNGLAT_OFFSETS:window.DeckGL.COORDINATE_SYSTEM.LNGLAT;
  88000. deckOptions.isGeographicCoordinateSystem = this._isWGS84();
  88001. if (!this.deckGL) {
  88002. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  88003. } else {
  88004. this.deckGL.setProps(deckOptions);
  88005. }
  88006. },
  88007. _clearBuffer: function () {
  88008. if (this.deckGL) {
  88009. let lm = this.deckGL.layerManager;
  88010. lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
  88011. }
  88012. return this;
  88013. },
  88014. _refreshData: function () {
  88015. let graphics = this._data || [];
  88016. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  88017. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  88018. if (!this._renderLayer.props.data) {
  88019. this._renderLayer.props.data = [];
  88020. }
  88021. this._renderLayer.props.data.length = 0;
  88022. for (let i = 0; i < sGraphics.length; i++) {
  88023. this._renderLayer.props.data.push(sGraphics[i]);
  88024. }
  88025. this._data = this._renderLayer.props.data;
  88026. },
  88027. _handleClick: WebGLRenderer_emptyFunc,
  88028. //deck渲染开始前调用,可以重写
  88029. _onBeforeRender: WebGLRenderer_emptyFunc,
  88030. //deck渲染结束后调用,可以重写
  88031. _onAfterRender: WebGLRenderer_emptyFunc,
  88032. //以下为leaflet再带的renderer的方法,为了保持接口正常调用,故增加这几个方法
  88033. _removePath: function () {
  88034. this._wrapper.parentElement.removeChild(this._wrapper);
  88035. this._container = null;
  88036. this._wrapper = null;
  88037. return this;
  88038. },
  88039. _initPath: WebGLRenderer_emptyFunc,
  88040. _addPath: WebGLRenderer_emptyFunc,
  88041. containsPoint: WebGLRenderer_emptyFunc,
  88042. _isWGS84(){
  88043. return this.layer._map.options.crs.code === "EPSG:4326";
  88044. }
  88045. });
  88046. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/index.js
  88047. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88048. * This program are made available under the terms of the Apache License, Version 2.0
  88049. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88050. ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphicLayer.js
  88051. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88052. * This program are made available under the terms of the Apache License, Version 2.0
  88053. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88054. const Renderer = ['canvas', 'webgl'];
  88055. const defaultProps = {
  88056. color: [0, 0, 0, 255],
  88057. opacity: 0.8,
  88058. radius: 10,
  88059. radiusScale: 1,
  88060. radiusMinPixels: 0,
  88061. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  88062. strokeWidth: 1,
  88063. outline: false
  88064. };
  88065. const BASE_RESOLUTIONS = {
  88066. 'EPSG:4326': 360.0 / 256,
  88067. 'EPSG:3857': (20037508.34279 * 2) / 256
  88068. };
  88069. const DEFAULT_ZOOM_OFFSET = {
  88070. 'EPSG:4326': 1,
  88071. 'EPSG:3857': 0
  88072. };
  88073. /**
  88074. * @class GraphicLayer
  88075. * @deprecatedclassinstance L.supermap.graphicLayer
  88076. * @classdesc 高效率点图层类。
  88077. * @category Visualization Graphic
  88078. * @modulecategory Overlay
  88079. * @extends {L.Path}
  88080. * @param {Array.<Graphic>} graphics - 要素对象。
  88081. * @param {Object} options - 参数。
  88082. * @param {string} [options.render='canvas'] - 指定使用的渲染器。可选值:'webgl','canvas'( webgl 渲染目前只支持散点)。
  88083. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 要素颜色。
  88084. * @param {Array.<number>} [options.highlightColor] - webgl 渲染时要素高亮颜色。
  88085. * @param {number} [options.opacity=0.8] - 要素透明度。当 {@link Graphic} 的 style 参数传入设置了 fillOpacity 或 opacity 的 {@link CircleStyle} 或 {@link CloverStyle},此参数无效。{@link Graphic} 的 style 传入 {@link ImageStyle} 后不支持此参数。
  88086. * @param {number} [options.radius=10] - 要素半径,单位为像素。当 {@link Graphic} 的 style 参数传入了 radius,此参数无效。
  88087. * @param {number} [options.radiusScale=1] - webgl 渲染时的要素放大倍数。
  88088. * @param {number} [options.radiusMinPixels=0] - webgl 渲染时的要素半径最小值,单位为像素。
  88089. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - webgl 渲染时的要素半径最大值,单位为像素。
  88090. * @param {number} [options.strokeWidth=1] - 边框大小。当 {@link Graphic} 的 style 参数传入了 weight,此参数无效。
  88091. * @param {boolean} [options.outline=false] - 是否显示边框。当 {@link Graphic} 的 style 参数传入设置了 stroke 的 {@link CircleStyle} 或 {@link CloverStyle},此参数无效。
  88092. * @param {function} [options.onClick] - 图层鼠标点击响应事件(支持 webgl、canvas 渲染)。
  88093. * @param {function} [options.onHover] - 图层鼠标悬停响应事件(只支持 webgl 渲染)。
  88094. * @usage
  88095. */
  88096. var GraphicLayer = external_L_default().Path.extend({
  88097. initialize: function (graphics, options) {
  88098. this.graphics = [].concat(graphics);
  88099. let opt = options || {};
  88100. // 由于是canvas实现所以不能更改pane
  88101. opt.pane = 'overlayPane';
  88102. external_L_default().Util.setOptions(this, opt);
  88103. //因为跟基类的renderer冲突,所以采用render这个名字
  88104. this.options.render = this.options.render || Renderer[0];
  88105. //浏览器支持webgl并且指定使用webgl渲染才使用webgl渲染
  88106. if (!Detector.supportWebGL2()) {
  88107. this.options.render = Renderer[0];
  88108. }
  88109. if (this.options.interactive) {
  88110. this.on('click mousemove dblclick mousedown mouseup mouseout contextmenu', this._handleClick, this);
  88111. }
  88112. },
  88113. /**
  88114. * @private
  88115. * @function GraphicLayer.prototype.getEvents
  88116. * @description 获取事件。
  88117. * @returns {Object} 返回该图层支持的事件对象。
  88118. */
  88119. getEvents: function () {
  88120. const events = {
  88121. resize: this._resize.bind(this),
  88122. moveend: this._moveEnd.bind(this)
  88123. };
  88124. return events;
  88125. },
  88126. /**
  88127. * @private
  88128. * @function GraphicLayer.prototype.onAdd
  88129. * @description 添加图形。
  88130. */
  88131. onAdd: function (map) {
  88132. this._map = map;
  88133. this._crs = map.options.crs;
  88134. this.defaultStyle = this._getDefaultStyle(this.options);
  88135. this._renderer = this._createRenderer();
  88136. this._container = this._renderer._container;
  88137. // this.addInteractiveTarget(this._container);
  88138. external_L_default().Path.prototype.onAdd.call(this);
  88139. },
  88140. /**
  88141. * @private
  88142. * @override
  88143. * @function GraphicLayer.prototype.onRemove
  88144. * @description 移除图层。
  88145. */
  88146. onRemove: function () {
  88147. this.off('click mousemove dblclick mousedown mouseup contextmenu', this._handleClick, this);
  88148. this._renderer._removePath(this);
  88149. },
  88150. /**
  88151. * @function GraphicLayer.prototype.setGraphics
  88152. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  88153. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  88154. */
  88155. setGraphics: function (graphics) {
  88156. this.graphics = this.graphics || [];
  88157. this.graphics.length = 0;
  88158. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  88159. this.graphics = [].concat(sGraphics);
  88160. this.update();
  88161. },
  88162. /**
  88163. * @function GraphicLayer.prototype.addGraphics
  88164. * @description 追加点要素,不会覆盖之前的要素。
  88165. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  88166. */
  88167. addGraphics: function (graphics) {
  88168. this.graphics = this.graphics || [];
  88169. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  88170. this.graphics = this.graphics.concat(sGraphics);
  88171. this.update();
  88172. },
  88173. /**
  88174. * @function GraphicLayer.prototype.getGraphicBy
  88175. * @description 指定属性名和属性值,获取第一个匹配的要素数组。
  88176. * @param {string} property - 属性名称。
  88177. * @param {string} value - 属性值。
  88178. * @returns {Graphic} 返回匹配的 graphic 。
  88179. */
  88180. getGraphicBy(property, value) {
  88181. let graphic = null;
  88182. for (let index in this.graphics) {
  88183. if (this.graphics[index][property] === value) {
  88184. graphic = this.graphics[index];
  88185. break;
  88186. }
  88187. }
  88188. return graphic;
  88189. },
  88190. /**
  88191. * @function GraphicLayer.prototype.getGraphicById
  88192. * @description 获取指定 ID 的矢量要素。
  88193. * @param {string} graphicId - 矢量要素的属性 ID。
  88194. * @returns {Graphic} 返回匹配的 graphic。
  88195. */
  88196. getGraphicById(graphicId) {
  88197. return this.getGraphicBy('id', graphicId);
  88198. },
  88199. /**
  88200. * @function GraphicLayer.prototype.getGraphicsByAttribute
  88201. * @description 指定属性名和属性值,获取所有匹配的要素数组。
  88202. * @param {string} attrName - 属性名称。
  88203. * @param {string} attrValue - 属性值。
  88204. * @returns {Array.<Graphic>} 返回匹配的 graphic 数组。
  88205. */
  88206. getGraphicsByAttribute(attrName, attrValue) {
  88207. var graphic,
  88208. foundgraphics = [];
  88209. for (let index in this.graphics) {
  88210. graphic = this.graphics[index];
  88211. if (graphic && graphic.attributes) {
  88212. if (graphic.attributes[attrName] === attrValue) {
  88213. foundgraphics.push(graphic);
  88214. }
  88215. }
  88216. }
  88217. return foundgraphics;
  88218. },
  88219. /**
  88220. * @function GraphicLayer.prototype.removeGraphics
  88221. * @description 删除要素数组,默认删除所有要素。
  88222. * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组。
  88223. */
  88224. removeGraphics(graphics = null) {
  88225. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  88226. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  88227. this.graphics.length = 0;
  88228. this.update();
  88229. return;
  88230. }
  88231. if (!Util_Util.isArray(graphics)) {
  88232. graphics = [graphics];
  88233. }
  88234. for (let i = graphics.length - 1; i >= 0; i--) {
  88235. let graphic = graphics[i];
  88236. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  88237. //并将其放入未删除的数组中。
  88238. let findex = Util_Util.indexOf(this.graphics, graphic);
  88239. if (findex === -1) {
  88240. continue;
  88241. }
  88242. this.graphics.splice(findex, 1);
  88243. }
  88244. //删除完成后重新设置 setGraphics,以更新
  88245. this.update();
  88246. },
  88247. /**
  88248. * @function GraphicLayer.prototype.setStyle
  88249. * @description 设置图层要素整体样式。
  88250. * @param {Object} styleOptions - 样式对象。
  88251. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  88252. * @param {number} [styleOptions.radius=10] - 点半径。
  88253. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  88254. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  88255. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  88256. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值,单位为像素。
  88257. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值,单位为像素。
  88258. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  88259. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  88260. */
  88261. setStyle: function (styleOptions) {
  88262. let _opt = this.options;
  88263. let styleOpt = {
  88264. color: _opt.color,
  88265. radius: _opt.radius,
  88266. opacity: _opt.opacity,
  88267. highlightColor: _opt.highlightColor,
  88268. radiusScale: _opt.radiusScale,
  88269. radiusMinPixels: _opt.radiusMinPixels,
  88270. radiusMaxPixels: _opt.radiusMaxPixels,
  88271. strokeWidth: _opt.strokeWidth,
  88272. outline: _opt.outline
  88273. };
  88274. this.options = external_L_default().Util.extend(this.options, styleOpt, styleOptions);
  88275. this.defaultStyle = this._getDefaultStyle(this.options);
  88276. this.update();
  88277. },
  88278. /**
  88279. * @function GraphicLayer.prototype.update
  88280. * @description 更新图层,数据或者样式改变后调用。
  88281. */
  88282. update: function () {
  88283. this._layerRenderer.update(this.graphics);
  88284. },
  88285. /**
  88286. * @function GraphicLayer.prototype.clear
  88287. * @description 释放图层资源。
  88288. */
  88289. clear: function () {
  88290. this.removeGraphics();
  88291. },
  88292. /**
  88293. * @function GraphicLayer.prototype.getRenderer
  88294. * @description 获取渲染器。
  88295. * @returns {Object} 内部渲染器。
  88296. */
  88297. getRenderer: function () {
  88298. return this._renderer;
  88299. },
  88300. /**
  88301. * @function GraphicLayer.prototype.getState
  88302. * @description 获取当前地图和图层状态。
  88303. * @returns {Object} 地图和图层状态,包含地图状态信息和本图层相关状态。
  88304. */
  88305. getState: function () {
  88306. let map = this._map;
  88307. let width = map.getSize().x;
  88308. let height = map.getSize().y;
  88309. let center = map.getCenter();
  88310. let longitude = center.lng;
  88311. let latitude = center.lat;
  88312. let zoomOffset = DEFAULT_ZOOM_OFFSET[this._crs.code] || 0;
  88313. if(BASE_RESOLUTIONS[this._crs.code] && this._crs.resolutions && this._crs.resolutions.length > 0 ){
  88314. zoomOffset = Math.round(Math.log2(BASE_RESOLUTIONS[this._crs.code]/this._crs.resolutions[0]))
  88315. }
  88316. let zoom = map.getZoom() + zoomOffset;
  88317. let maxZoom = map.getMaxZoom() + zoomOffset;
  88318. let mapViewport = {
  88319. longitude: longitude,
  88320. latitude: latitude,
  88321. zoom: zoom,
  88322. maxZoom: maxZoom,
  88323. pitch: 0,
  88324. bearing: 0
  88325. };
  88326. let state = {};
  88327. for (let key in mapViewport) {
  88328. state[key] = mapViewport[key];
  88329. }
  88330. state.width = width;
  88331. state.height = height;
  88332. let options = this.options;
  88333. state.color = options.color;
  88334. state.radius = options.radius;
  88335. state.opacity = options.opacity;
  88336. state.highlightColor = options.highlightColor;
  88337. state.radiusScale = options.radiusScale;
  88338. state.radiusMinPixels = options.radiusMinPixels;
  88339. state.radiusMaxPixels = options.radiusMaxPixels;
  88340. state.strokeWidth = options.strokeWidth;
  88341. state.outline = options.outline;
  88342. return state;
  88343. },
  88344. _resize: function () {
  88345. let size = this._map.getSize();
  88346. this._container.width = size.x;
  88347. this._container.height = size.y;
  88348. this._container.style.width = size.x + 'px';
  88349. this._container.style.height = size.y + 'px';
  88350. let mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  88351. external_L_default().DomUtil.setPosition(this._container, mapOffset);
  88352. this._update();
  88353. },
  88354. _moveEnd: function () {
  88355. if (this._layerRenderer instanceof GraphicWebGLRenderer) {
  88356. this._update();
  88357. }
  88358. },
  88359. //使用canvas渲染或webgl渲染
  88360. _createRenderer: function () {
  88361. let map = this._map;
  88362. let width = map.getSize().x;
  88363. let height = map.getSize().y;
  88364. let _renderer;
  88365. if (this.options.render === Renderer[0]) {
  88366. _renderer = new GraphicCanvasRenderer(this, {
  88367. width: width,
  88368. height: height,
  88369. renderer: map.getRenderer(this)
  88370. });
  88371. } else {
  88372. let optDefault = external_L_default().Util.setOptions({}, defaultProps);
  88373. let opt = external_L_default().Util.setOptions(
  88374. {
  88375. options: optDefault
  88376. },
  88377. this.options
  88378. );
  88379. opt = external_L_default().Util.setOptions(this, opt);
  88380. opt.container = map.getPane('overlayPane');
  88381. opt.width = width;
  88382. opt.height = height;
  88383. _renderer = new GraphicWebGLRenderer(this, opt);
  88384. }
  88385. _renderer.defaultStyle = this.defaultStyle;
  88386. this._layerRenderer = _renderer;
  88387. return this._layerRenderer.getRenderer();
  88388. },
  88389. /**
  88390. * @private
  88391. * @override
  88392. */
  88393. _update: function () {
  88394. if (this._map) {
  88395. this._updatePath();
  88396. }
  88397. },
  88398. /**
  88399. * @private
  88400. * @override
  88401. */
  88402. _updatePath: function () {
  88403. let graphics = this._getGraphicsInBounds();
  88404. this._renderer.drawGraphics(graphics, this.defaultStyle);
  88405. },
  88406. /**
  88407. * @private
  88408. * @override
  88409. */
  88410. _project: function () {
  88411. let me = this;
  88412. me._getGraphicsInBounds().map(function (graphic) {
  88413. let point = me._map.latLngToLayerPoint(graphic.getLatLng());
  88414. let w = me._clickTolerance();
  88415. let p = [graphic._anchor + w, graphic._anchor + w];
  88416. graphic._pxBounds = new (external_L_default()).Bounds(point.subtract(p), point.add(p));
  88417. return graphic;
  88418. });
  88419. me._pxBounds = external_L_default().bounds(external_L_default().point(0, 0), external_L_default().point(this._container.width, this._container.height));
  88420. },
  88421. _getDefaultStyle: function (options) {
  88422. const target = {};
  88423. if (options.color) {
  88424. target.fill = true;
  88425. const color = this.toRGBA(options.color);
  88426. target.color = color;
  88427. target.fillColor = color;
  88428. }
  88429. if (options.opacity) {
  88430. target.opacity = options.opacity;
  88431. target.fillOpacity = options.opacity;
  88432. }
  88433. if (options.radius) {
  88434. target.radius = options.radius;
  88435. }
  88436. if (options.strokeWidth) {
  88437. target.weight = options.strokeWidth;
  88438. }
  88439. if (options.outline) {
  88440. target.stroke = options.outline;
  88441. }
  88442. return new CircleStyle(target).getStyle();
  88443. },
  88444. toRGBA(colorArray) {
  88445. return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${(colorArray[3] || 255) / 255})`;
  88446. },
  88447. _getGraphicsInBounds: function () {
  88448. let me = this;
  88449. let graphicsInBounds = [];
  88450. let viewBounds = me._map.getBounds();
  88451. this.graphics.map(function (graphic) {
  88452. if (viewBounds.contains(graphic.getLatLng())) {
  88453. graphicsInBounds.push(graphic);
  88454. }
  88455. return graphic;
  88456. });
  88457. return graphicsInBounds;
  88458. },
  88459. _handleClick: function (evt) {
  88460. this._layerRenderer._handleClick(evt);
  88461. },
  88462. /**
  88463. * @private
  88464. * @override
  88465. */
  88466. beforeAdd: (external_L_default()).Util.falseFn,
  88467. /**
  88468. * @private
  88469. * @override
  88470. */
  88471. _containsPoint: function (p) {
  88472. return this._layerRenderer.containsPoint(p);
  88473. }
  88474. });
  88475. let graphicLayer = function (graphics, options) {
  88476. return new GraphicLayer(graphics, options);
  88477. };
  88478. ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphThemeLayer.js
  88479. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88480. * This program are made available under the terms of the Apache License, Version 2.0
  88481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88482. /**
  88483. * @class GraphThemeLayer
  88484. * @deprecatedclassinstance L.supermap.graphThemeLayer
  88485. * @category Visualization Theme
  88486. * @modulecategory Overlay
  88487. * @classdesc 统计专题图图层类。统计专题图通过为每个要素绘制统计图表来反映其对应的专题值的大小。它可同时表示多个字段属性信息,在区域本身与各区域之间形成横向和纵向的对比。
  88488. * 统计专题图多用于具有相关数量特征的地图上,比如表示不同地区多年的粮食产量、GDP、人口等,不同时段客运量、地铁流量等。
  88489. * 目前提供的统计图类型有:柱状图(Bar),折线图(Line),饼图(Pie),三维柱状图(Bar3D),点状图(Point),环状图(Ring)。
  88490. * @extends ThemeLayer
  88491. * @param {string} name - 专题图表名称。
  88492. * @param {string} chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  88493. * @param {Object} options - 参数。
  88494. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  88495. * @param {string} options.themeFields - 指定创建专题图字段。
  88496. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  88497. * @param {Object} [options.cache] - 缓存。
  88498. * @param {Object} [options.charts] - 图表。
  88499. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  88500. * @param {number} [options.opacity=1] - 图层透明度。
  88501. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。专题要素事件临时存储。
  88502. * @param {Object} options.chartsSetting - 各类型图表的 chartsSetting 对象可设属性请参考具体图表模型类的注释中对 chartsSetting 对象可设属性的描述。chartsSetting 对象通常都具有以下 5 个基础可设属性:</br>
  88503. * @param {number} options.chartsSetting.width - 专题要素(图表)宽度。
  88504. * @param {number} options.chartsSetting.height - 专题要素(图表)高度。
  88505. * @param {Array.<number>} options.chartsSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  88506. * @param {number} [options.chartsSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位为像素。
  88507. * @param {number} [options.chartsSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位为像素。
  88508. * @param {Array.<number>} [options.chartsSetting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  88509. * @param {number} [options.chartsSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  88510. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  88511. * @usage
  88512. */
  88513. var GraphThemeLayer = ThemeLayer.extend({
  88514. options: {
  88515. //是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表,默认值:true。
  88516. isOverLay: true
  88517. },
  88518. initialize: function (name, chartsType, options) {
  88519. var newArgs = [];
  88520. newArgs.push(name);
  88521. newArgs.push(options);
  88522. ThemeLayer.prototype.initialize.apply(this, newArgs);
  88523. this.chartsType = chartsType;
  88524. this.themeFields = options && options.themeFields ? options.themeFields : null;
  88525. this.charts = options && options.charts ? options.charts : [];
  88526. this.cache = options && options.cache ? options.cache : {};
  88527. this.chartsSetting = options && options.chartsSetting ? options.chartsSetting : {};
  88528. },
  88529. /**
  88530. * @function GraphThemeLayer.prototype.setChartsType
  88531. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。图表类型,目前支持:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
  88532. * @param {string} chartsType - 图表类型。目前可用:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
  88533. */
  88534. setChartsType: function (chartsType) {
  88535. this.chartsType = chartsType;
  88536. this.redraw();
  88537. },
  88538. /**
  88539. * @function GraphThemeLayer.prototype.addFeatures
  88540. * @description 向专题图图层中添加数据。
  88541. * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加的要素。
  88542. */
  88543. addFeatures: function (features) {
  88544. var me = this;
  88545. /**
  88546. * @event GraphThemeLayer#beforefeaturesadded
  88547. * @description 向专题图图层中添加数据之前触发。
  88548. * @property {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加的要素。
  88549. */
  88550. me.fire("beforefeaturesadded", {features: features});
  88551. //转换 features 形式
  88552. this.features = this.toiClientFeature(features);
  88553. //绘制专题要素
  88554. if (!me.renderer) {
  88555. return;
  88556. }
  88557. if (me._map) {
  88558. me.redrawThematicFeatures(me._map.getBounds());
  88559. } else {
  88560. me.redrawThematicFeatures();
  88561. }
  88562. },
  88563. /**
  88564. * @function GraphThemeLayer.prototype.redrawThematicFeatures
  88565. * @description 重绘所有专题要素。此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,压盖处理,缓存等步骤。地图漫游时调用此方法进行图层刷新。
  88566. * @param {L.Bounds} bounds - 重绘的范围。
  88567. */
  88568. redrawThematicFeatures: function (bounds) {
  88569. var me = this;
  88570. //清除当前所有可视元素
  88571. me.renderer.clearAll();
  88572. var features = me.features;
  88573. if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
  88574. var crs = this._map.options.crs;
  88575. bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
  88576. }
  88577. bounds = CommontypesConversion.toSuperMapBounds(bounds);
  88578. for (var i = 0, len = features.length; i < len; i++) {
  88579. var feature = features[i];
  88580. // 要素范围判断
  88581. var feaBounds = feature.geometry.getBounds();
  88582. //剔除当前视图(地理)范围以外的数据
  88583. if (bounds && !bounds.intersectsBounds(feaBounds)) {
  88584. continue;
  88585. }
  88586. var cache = me.cache;
  88587. // 用feature id 做缓存标识
  88588. var cacheField = feature.id;
  88589. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  88590. if (!cache[cacheField]) {
  88591. cache[cacheField] = cacheField;
  88592. var chart = me.createThematicFeature(feature);
  88593. // 压盖处理权重值
  88594. var isValidOverlayWeightField = me.overlayWeightField
  88595. && feature.attributes[me.overlayWeightField]
  88596. && !isNaN(feature.attributes[me.overlayWeightField]);
  88597. if (chart && isValidOverlayWeightField) {
  88598. chart["__overlayWeight"] = feature.attributes[me.overlayWeightField];
  88599. }
  88600. if (chart) {
  88601. me.charts.push(chart);
  88602. }
  88603. }
  88604. }
  88605. me.drawCharts();
  88606. },
  88607. /**
  88608. * @function GraphThemeLayer.prototype.createThematicFeature
  88609. * @description 创建专题要素(图表)。
  88610. * @param {Object} feature - 待创建的要素。
  88611. */
  88612. createThematicFeature: function (feature) {
  88613. var me = this;
  88614. var thematicFeature;
  88615. // 检查图表创建条件并创建图形
  88616. if (Theme_Theme[me.chartsType] && me.themeFields && me.chartsSetting) {
  88617. thematicFeature = new Theme_Theme[me.chartsType](feature, me, me.themeFields, me.chartsSetting);
  88618. }
  88619. // thematicFeature 是否创建成功
  88620. if (!thematicFeature) {
  88621. return false
  88622. }
  88623. // 对专题要素执行图形装载
  88624. thematicFeature.assembleShapes();
  88625. return thematicFeature;
  88626. },
  88627. /**
  88628. * @function GraphThemeLayer.prototype.drawCharts
  88629. * @description 绘制图表。包含压盖处理。
  88630. */
  88631. drawCharts: function () {
  88632. var me = this;
  88633. if (!me.renderer) {
  88634. return;
  88635. }
  88636. // 图表权重值处理
  88637. if (me.overlayWeightField) {
  88638. me._sortChart();
  88639. }
  88640. if (me.options && !me.options.isOverLay) {
  88641. // 不进行避让
  88642. me._addOverlayShape();
  88643. } else {
  88644. //进行避让
  88645. me._addNoOverlayShape();
  88646. }
  88647. // 绘制图形
  88648. me.renderer.render();
  88649. },
  88650. /**
  88651. * @function GraphThemeLayer.prototype.getShapesByFeatureID
  88652. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  88653. * @param {number} featureID - 要素 ID。
  88654. */
  88655. getShapesByFeatureID: function (featureID) {
  88656. var me = this, list = [];
  88657. var shapeList = me.renderer.getAllShapes();
  88658. if (!featureID) {
  88659. return shapeList;
  88660. }
  88661. for (var i = 0, len = shapeList.length; i < len; i++) {
  88662. var si = shapeList[i];
  88663. if (si.refDataID && featureID === si.refDataID) {
  88664. list.push(si);
  88665. }
  88666. }
  88667. return list;
  88668. },
  88669. /**
  88670. * @function GraphThemeLayer.prototype.isQuadrilateralOverLap
  88671. * @description 判断两个四边形是否有压盖。
  88672. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  88673. * @example
  88674. * [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}];
  88675. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  88676. */
  88677. isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
  88678. var me = this;
  88679. var quadLen = quadrilateral.length,
  88680. quad2Len = quadrilateral2.length;
  88681. if (quadLen !== 5 || quad2Len !== 5) {
  88682. return null;
  88683. }//不是四边形
  88684. var OverLap = false;
  88685. //如果两四边形互不包含对方的节点,则两个四边形不相交
  88686. for (var i = 0; i < quadLen; i++) {
  88687. if (me.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  88688. OverLap = true;
  88689. break;
  88690. }
  88691. }
  88692. for (let i = 0; i < quad2Len; i++) {
  88693. if (me.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  88694. OverLap = true;
  88695. break;
  88696. }
  88697. }
  88698. //加上两矩形十字相交的情况
  88699. for (let i = 0; i < quadLen - 1; i++) {
  88700. if (OverLap) {
  88701. break;
  88702. }
  88703. for (let j = 0; j < quad2Len - 1; j++) {
  88704. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  88705. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  88706. OverLap = true;
  88707. break;
  88708. }
  88709. }
  88710. }
  88711. return OverLap;
  88712. },
  88713. /**
  88714. * @function GraphThemeLayer.prototype.isPointInPoly
  88715. * @description 判断一个点是否在多边形里面(射线法)。
  88716. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  88717. * @param {Array.<Object>} poly - 多边形节点数组。
  88718. * 例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  88719. */
  88720. isPointInPoly: function (pt, poly) {
  88721. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  88722. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y))
  88723. && (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x)
  88724. && (isIn = !isIn);
  88725. }
  88726. return isIn;
  88727. },
  88728. /**
  88729. * @function GraphThemeLayer.prototype.isChartInMap
  88730. * @description 判断图表是否在地图里。
  88731. * @param {Bounds} mapPxBounds - 地图像素范围。
  88732. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  88733. * 例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  88734. */
  88735. isChartInMap: function (mapPxBounds, chartPxBounds) {
  88736. var mb = mapPxBounds;
  88737. var isIn = false;
  88738. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  88739. var cb = chartPxBounds[i];
  88740. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  88741. isIn = true;
  88742. break;
  88743. }
  88744. }
  88745. return isIn;
  88746. },
  88747. /**
  88748. * @function GraphThemeLayer.prototype.clearCache
  88749. * @description 清除缓存数据。
  88750. */
  88751. clearCache: function () {
  88752. this.cache = {};
  88753. this.charts = [];
  88754. },
  88755. /**
  88756. * @function GraphThemeLayer.prototype.removeFeatures
  88757. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素(数据)。
  88758. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 待删除的要素或用于条件删除的回调函数。
  88759. */
  88760. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  88761. var me = this;
  88762. me.clearCache();
  88763. ThemeLayer.prototype.removeFeatures.call(me, features);
  88764. },
  88765. /**
  88766. * @function GraphThemeLayer.prototype.removeAllFeatures
  88767. * @description 清除当前图层所有的矢量要素。
  88768. */
  88769. removeAllFeatures: function () {
  88770. var me = this;
  88771. me.clearCache();
  88772. ThemeLayer.prototype.removeAllFeatures.apply(me, arguments);
  88773. },
  88774. /**
  88775. * @function GraphThemeLayer.prototype.redraw
  88776. * @description 重绘该图层,成功则返回 true,否则返回 false。
  88777. */
  88778. redraw: function () {
  88779. var me = this;
  88780. me.clearCache();
  88781. return ThemeLayer.prototype.redraw.apply(me, arguments);
  88782. },
  88783. /**
  88784. * @function GraphThemeLayer.prototype.clear
  88785. * @description 清除图层。清除的内容包括数据(features)、专题要素、缓存。
  88786. */
  88787. clear: function () {
  88788. var me = this;
  88789. if (me.renderer) {
  88790. me.renderer.clearAll();
  88791. me.renderer.refresh();
  88792. }
  88793. me.removeAllFeatures();
  88794. me.clearCache();
  88795. },
  88796. /**
  88797. * @function GraphThemeLayer.prototype.getWeightFieldValue
  88798. * @description 获取权重字段的值。
  88799. * @param {FeatureVector} feature - 矢量要素。
  88800. * @param {Array.<string>} weightField - 字段名数组。
  88801. * @param {number} defaultValue - 当通过 weightField 获取不到权重值时,使用 defaultValue 作为权重值。
  88802. */
  88803. getWeightFieldValue: function (feature, weightField, defaultValue) {
  88804. if (typeof(defaultValue) === "undefined" || isNaN(defaultValue)) {
  88805. defaultValue = 0;
  88806. }
  88807. if (!feature.attributes) {
  88808. return defaultValue;
  88809. }
  88810. var fieldValue = feature.attributes[weightField];
  88811. if (typeof(fieldValue) === "undefined" || isNaN(fieldValue)) {
  88812. fieldValue = defaultValue
  88813. }
  88814. return fieldValue;
  88815. },
  88816. _sortChart: function () {
  88817. var me = this;
  88818. if (!me.charts) {
  88819. return;
  88820. }
  88821. me.charts.sort(function (cs, ce) {
  88822. if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
  88823. return 0;
  88824. } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
  88825. return -1;
  88826. } else if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
  88827. return 1;
  88828. } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
  88829. return (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) ? 1 : -1;
  88830. }
  88831. return 0;
  88832. });
  88833. },
  88834. _addOverlayShape: function () {
  88835. var me = this;
  88836. var charts = me.charts;
  88837. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  88838. var chart_m = charts[m];
  88839. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  88840. var shapeROP_m = chart_m.resetLocation();
  88841. // 添加图形
  88842. var shapes_m = chart_m.shapes;
  88843. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  88844. shapes_m[n].refOriginalPosition = shapeROP_m;
  88845. me.renderer.addShape(shapes_m[n]);
  88846. }
  88847. }
  88848. },
  88849. _addNoOverlayShape: function () {
  88850. var me = this;
  88851. // 压盖判断所需 chartsBounds 集合
  88852. var mapBounds = me._map.getBounds();
  88853. var crs = this._map.options.crs;
  88854. if (this.options.alwaysMapCRS) {
  88855. mapBounds = external_L_default().bounds(crs.project(mapBounds.getSouthWest()), crs.project(mapBounds.getNorthEast()));
  88856. }
  88857. mapBounds = CommontypesConversion.toSuperMapBounds(mapBounds);
  88858. var charts = me.charts;
  88859. var chartsBounds = [];
  88860. // 获取地图像素 bounds
  88861. var mapPxLT = me.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  88862. var mapPxRB = me.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  88863. var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  88864. // 压盖处理 & 添加图形
  88865. for (var i = 0, len = charts.length; i < len; i++) {
  88866. var chart = charts[i];
  88867. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  88868. var shapeROP = chart.resetLocation();
  88869. // 图表框
  88870. var cbs = chart.chartBounds;
  88871. var cBounds = [
  88872. {"x": cbs.left, "y": cbs.top},
  88873. {"x": cbs.left, "y": cbs.bottom},
  88874. {"x": cbs.right, "y": cbs.bottom},
  88875. {"x": cbs.right, "y": cbs.top},
  88876. {"x": cbs.left, "y": cbs.top}
  88877. ];
  88878. // 地图范围外不绘制
  88879. if (mBounds && !me.isChartInMap(mBounds, cBounds)) {
  88880. continue;
  88881. }
  88882. // 是否压盖
  88883. var isOverlay = false;
  88884. for (let j = 0; j < chartsBounds.length; j++) {
  88885. //压盖判断
  88886. if (me.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  88887. isOverlay = true;
  88888. break;
  88889. }
  88890. }
  88891. if (isOverlay) {
  88892. continue;
  88893. } else {
  88894. chartsBounds.push(cBounds);
  88895. }
  88896. // 添加图形
  88897. var shapes = chart.shapes;
  88898. for (let j = 0, slen = shapes.length; j < slen; j++) {
  88899. shapes[j].refOriginalPosition = shapeROP;
  88900. me.renderer.addShape(shapes[j]);
  88901. }
  88902. }
  88903. }
  88904. });
  88905. var graphThemeLayer = function (name, chartsType, options) {
  88906. return new GraphThemeLayer(name, chartsType, options);
  88907. };
  88908. ;// CONCATENATED MODULE: ./src/leaflet/overlay/RankSymbolThemeLayer.js
  88909. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88910. * This program are made available under the terms of the Apache License, Version 2.0
  88911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88912. /**
  88913. * @class RankSymbolThemeLayer
  88914. * @deprecatedclassinstance L.supermap.rankSymbolThemeLayer
  88915. * @category Visualization Theme
  88916. * @classdesc 符号专题图图层类。符号专题图通过为每个要素绘制符号大小来反映其对应的专题值的大小;它只能表示单个字段属性信息。
  88917. * 符号专题图多用于具有相关数量特征的地图上,比如表示不同地区粮食产量、GDP、人口等。
  88918. * 即通过制作一个符号专题图,就可以清晰展示各个区域相关 Value 的分布差异等。
  88919. * 目前提供的符号图形有:圆形(后续进行扩展:心形、五角星、多角星、图片等)。
  88920. * @modulecategory Overlay
  88921. * @extends {GraphThemeLayer}
  88922. * @param {string} name - 专题图层名。
  88923. * @param {ChartType} symbolType - 符号类型。目前支持:'Circle'。
  88924. * @param {Object} options - 参数。
  88925. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,表示在图表绘制过程中隐藏对已存在的图表产生压盖的图表。
  88926. * @param {string} options.themeFields - 指定创建专题图字段。
  88927. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  88928. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  88929. * @param {number} [options.opacity=1] - 图层透明度。
  88930. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  88931. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  88932. * @usage
  88933. */
  88934. var RankSymbolThemeLayer = GraphThemeLayer.extend({
  88935. /**
  88936. * @member {Object} RankSymbolThemeLayer.prototype.symbolSetting
  88937. * @description 符号 Circle 配置对象。
  88938. * @property {Array} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  88939. * @property {number} [maxR] - 圆形的最大半径。
  88940. * @property {number} [minR] - 圆形的最小半径。
  88941. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  88942. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  88943. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  88944. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  88945. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  88946. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  88947. */
  88948. initialize: function (name, symbolType, options) { // eslint-disable-line no-unused-vars
  88949. GraphThemeLayer.prototype.initialize.apply(this, arguments);
  88950. this.symbolType = symbolType;
  88951. this.symbolSetting = {};
  88952. },
  88953. /**
  88954. * @function RankSymbolThemeLayer.prototype.setSymbolType
  88955. * @description 设置符号类型,此函数可动态改变图表类型。在调用此函数前请通过 symbolSetting 为新类型的图表做相关配置。
  88956. * @param {ChartType} symbolType - 目前支持:'Circle'。
  88957. *
  88958. */
  88959. //todo 这里怎么又是supermap的类型
  88960. setSymbolType: function (symbolType) {
  88961. this.symbolType = symbolType;
  88962. this.redraw();
  88963. },
  88964. /**
  88965. * @private
  88966. * @function RankSymbolThemeLayer.prototype.createThematicFeature
  88967. * @description 创建专题要素(图形)。
  88968. * @param {FeatureVector} feature - 要创建的专题图形要素。
  88969. * @returns {FeatureTheme} 专题图形。
  88970. */
  88971. createThematicFeature: function (feature) {
  88972. var me = this;
  88973. var thematicFeature;
  88974. // 检查图形创建条件并创建图形
  88975. if (Theme_Theme[me.symbolType] && me.themeField && me.symbolSetting) {
  88976. thematicFeature = new Theme_Theme[me.symbolType](feature, me, [me.themeField], me.symbolSetting);
  88977. }
  88978. // thematicFeature 是否创建成功
  88979. if (!thematicFeature) {
  88980. return false;
  88981. }
  88982. // 对专题要素执行图形装载
  88983. thematicFeature.assembleShapes();
  88984. return thematicFeature;
  88985. }
  88986. });
  88987. var rankSymbolThemeLayer = function (name, symbolType, options) {
  88988. return new RankSymbolThemeLayer(name, symbolType, options);
  88989. };
  88990. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SVGRenderer.js
  88991. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88992. * This program are made available under the terms of the Apache License, Version 2.0
  88993. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88994. /**
  88995. * @class SVGRenderer
  88996. * @classdesc 矢量图层缩放渲染器类。
  88997. * @category Visualization VectorTile
  88998. * @private
  88999. * @extends {L.SVG}
  89000. * @param {Object} tileCoord - 切片坐标系。
  89001. * @param {number} tileSize - 切片大小。
  89002. * @param {Object} options - 渲染器参数。
  89003. */
  89004. var SVGRenderer = external_L_default().SVG.extend({
  89005. initialize: function (tileCoord, tileSize, options) {
  89006. external_L_default().SVG.prototype.initialize.call(this, options);
  89007. this._tileCoord = tileCoord;
  89008. this._size = tileSize;
  89009. this._initContainer();
  89010. this._container.setAttribute('width', this._size.x);
  89011. this._container.setAttribute('height', this._size.y);
  89012. this._container.setAttribute('viewBox', [0, 0, this._size.x, this._size.y].join(' '));
  89013. this._layers = {};
  89014. },
  89015. /**
  89016. * @function SVGRenderer.prototype.getCoord
  89017. * @description 获取坐标。
  89018. */
  89019. getCoord: function () {
  89020. return this._tileCoord;
  89021. },
  89022. /**
  89023. * @function SVGRenderer.prototype.getContainer
  89024. * @description 获取容器。
  89025. */
  89026. getContainer: function () {
  89027. return this._container;
  89028. },
  89029. onAdd: (external_L_default()).Util.falseFn,
  89030. /**
  89031. * @function SVGRenderer.prototype.addTo
  89032. * @description 添加到地图。
  89033. * @param {L.Map} map - Leaflet Map 对象。
  89034. */
  89035. addTo: function (map) {
  89036. this._map = map;
  89037. if (this.options.interactive) {
  89038. for (var i in this._layers) {
  89039. var layer = this._layers[i];
  89040. layer._path.style.pointerEvents = 'auto';
  89041. this._map._targets[external_L_default().stamp(layer._path)] = layer;
  89042. }
  89043. }
  89044. },
  89045. /**
  89046. * @function SVGRenderer.prototype.removeFrom
  89047. * @description 从地图移除。
  89048. * @param {L.Map} map - Leaflet Map 对象。
  89049. */
  89050. removeFrom: function (map) {
  89051. var _map = map || this._map;
  89052. if (this.options.interactive) {
  89053. for (var i in this._layers) {
  89054. var layer = this._layers[i];
  89055. delete _map._targets[external_L_default().stamp(layer._path)];
  89056. }
  89057. }
  89058. delete this._map;
  89059. },
  89060. _addPath: function (layer) {
  89061. if (!this._rootGroup) {
  89062. this._initContainer();
  89063. }
  89064. if (!this._rootGroup) {
  89065. this._rootGroup = this._container;
  89066. }
  89067. this._rootGroup.appendChild(layer._path);
  89068. this._layers[external_L_default().stamp(layer)] = layer;
  89069. },
  89070. _updateIcon: function (layer) {
  89071. var path = layer._path = external_L_default().SVG.create('image'),
  89072. options = layer.options,
  89073. iconUrl = options.iconUrl;
  89074. if (options.iconSize) {
  89075. var size = external_L_default().point(options.iconSize),
  89076. anchor = size && size.divideBy(2, true),
  89077. p = layer._point.subtract(anchor);
  89078. path.setAttribute('x', p.x);
  89079. path.setAttribute('y', p.y);
  89080. path.setAttribute('width', size.x + 'px');
  89081. path.setAttribute('height', size.y + 'px');
  89082. } else {
  89083. var img = new Image();
  89084. img.src = iconUrl;
  89085. external_L_default().DomEvent.on(img, 'load', function () {
  89086. var size = external_L_default().point([img.width, img.height]),
  89087. anchor = size && size.divideBy(2, true),
  89088. p = layer._point.subtract(anchor);
  89089. path.setAttribute('x', p.x);
  89090. path.setAttribute('y', p.y);
  89091. path.setAttribute('width', size.x + 'px');
  89092. path.setAttribute('height', size.y + 'px');
  89093. });
  89094. }
  89095. path.setAttribute('href', iconUrl);
  89096. }
  89097. });
  89098. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/CanvasRenderer.js
  89099. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89100. * This program are made available under the terms of the Apache License, Version 2.0
  89101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89102. /**
  89103. * @class CanvasRenderer
  89104. * @private
  89105. * @classdesc 画布渲染器。
  89106. * @category Visualization VectorTile
  89107. * @extends {L.Canvas}
  89108. * @param {Object} tileCoord - 切片坐标系。
  89109. * @param {number} tileSize - 切片大小。
  89110. * @param {Object} options - 渲染器参数。
  89111. */
  89112. var CanvasRenderer = external_L_default().Canvas.extend({
  89113. initialize: function (tileCoord, tileSize, options) {
  89114. external_L_default().Canvas.prototype.initialize.call(this, options);
  89115. this._tileCoord = tileCoord;
  89116. this._size = tileSize;
  89117. this._initContainer();
  89118. this._container.setAttribute('width', this._size.x);
  89119. this._container.setAttribute('height', this._size.y);
  89120. this._layers = {};
  89121. this._drawnLayers = {};
  89122. this._drawing = true;
  89123. if (options.interactive) {
  89124. this._container.style.pointerEvents = 'auto';
  89125. }
  89126. },
  89127. /**
  89128. * @function CanvasRenderer.prototype.getCoord
  89129. * @description 获取坐标。
  89130. */
  89131. getCoord: function () {
  89132. return this._tileCoord;
  89133. },
  89134. /**
  89135. * @function CanvasRenderer.prototype.getContainer
  89136. * @description 获取容器。
  89137. */
  89138. getContainer: function () {
  89139. return this._container;
  89140. },
  89141. /**
  89142. * @function CanvasRenderer.prototype.getOffset
  89143. * @description 停止渲染。
  89144. */
  89145. getOffset: function () {
  89146. return this._tileCoord.scaleBy(this._size).subtract(this._map.getPixelOrigin());
  89147. },
  89148. onAdd: (external_L_default()).Util.falseFn,
  89149. /**
  89150. * @function CanvasRenderer.prototype.addTo
  89151. * @description 添加到地图。
  89152. * @param {L.Map} map - Leaflet Map 对象。
  89153. */
  89154. addTo: function (map) {
  89155. this._map = map;
  89156. },
  89157. /**
  89158. * @function CanvasRenderer.prototype.removeFrom
  89159. * @description 从地图移除。
  89160. * @param {L.Map} map - Leaflet Map 对象。
  89161. */
  89162. removeFrom: function (map) { // eslint-disable-line no-unused-vars
  89163. delete this._map;
  89164. },
  89165. _updateDashArray: function (layer) {
  89166. var array = layer.options.dashArray;
  89167. if (array && typeof array === "string") {
  89168. var parts = array.split(','),
  89169. dashArray = [],
  89170. i;
  89171. for (i = 0; i < parts.length; i++) {
  89172. dashArray.push(Number(parts[i]));
  89173. }
  89174. layer.options._dashArray = dashArray;
  89175. } else {
  89176. layer.options._dashArray = array;
  89177. }
  89178. },
  89179. _onClick: function (e) {
  89180. var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset()), layer, clickedLayer;
  89181. for (var id in this._layers) {
  89182. layer = this._layers[id];
  89183. if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
  89184. clickedLayer = layer;
  89185. }
  89186. }
  89187. if (clickedLayer) {
  89188. external_L_default().DomEvent.stop(e);
  89189. this._fireEvent([clickedLayer], e);
  89190. }
  89191. },
  89192. _onMouseMove: function (e) {
  89193. if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) {
  89194. return;
  89195. }
  89196. var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset());
  89197. this._handleMouseHover(e, point);
  89198. },
  89199. _updateIcon: function (layer) {
  89200. if (!this._drawing) {
  89201. return;
  89202. }
  89203. var options = layer.options,
  89204. ctx = this._ctx,
  89205. img = layer._getImage();
  89206. if (options.iconSize && img.complete) {
  89207. var size = external_L_default().point(options.iconSize),
  89208. anchor = size && size.divideBy(2, true),
  89209. p = layer._point.subtract(anchor);
  89210. ctx.drawImage(img, p.x, p.y, size.x, size.y);
  89211. } else {
  89212. external_L_default().DomEvent.on(img, 'load', function () {
  89213. var size = external_L_default().point([img.width, img.height]),
  89214. anchor = size && size.divideBy(2, true),
  89215. p = layer._point.subtract(anchor);
  89216. ctx.drawImage(img, p.x, p.y, size.x, size.y);
  89217. });
  89218. }
  89219. this._drawnLayers[layer._leaflet_id] = layer;
  89220. }
  89221. });
  89222. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorFeatureType.js
  89223. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89224. * This program are made available under the terms of the Apache License, Version 2.0
  89225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89226. /**
  89227. * @constant VectorFeatureType
  89228. * @description 矢量图层要素类型,和 SuperMap.CartoStyleMap 中的类型相对应。
  89229. * @category Visualization VectorTile
  89230. * @private
  89231. */
  89232. var VectorFeatureType = {
  89233. LABEL: "LABEL",//label实际处理成TEXT
  89234. TEXT: "TEXT",
  89235. POINT: "POINT",
  89236. LINE: "LINE",
  89237. REGION: "REGION"
  89238. };
  89239. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/Symbolizer.js
  89240. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89241. * This program are made available under the terms of the Apache License, Version 2.0
  89242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89243. /**
  89244. * @class Symbolizer
  89245. * @description 符号类。
  89246. * @category Visualization VectorTile
  89247. * @private
  89248. * @extends {L.Class}
  89249. * @param {Object} feature — 要素。
  89250. */
  89251. var Symbolizer = external_L_default().Class.extend({
  89252. initialize: function (feature) {
  89253. this.properties = feature.properties;
  89254. this.type = feature.type;
  89255. this.layerName = feature.layerName;
  89256. },
  89257. /**
  89258. * @function Symbolizer.prototype.render
  89259. * @description 绘制线符号。
  89260. * @param {Object} renderer - 渲染器。
  89261. * @param {string} style - 符号样式。
  89262. */
  89263. render: function (renderer, style) {
  89264. this._renderer = renderer;
  89265. this._container = renderer._container;
  89266. this.options = style;
  89267. renderer._initPath(this);
  89268. renderer._updateStyle(this);
  89269. var elem = this.getElement();
  89270. if (elem && this.layerName) {
  89271. external_L_default().DomUtil.addClass(elem, this.layerName);
  89272. }
  89273. },
  89274. /**
  89275. * @function Symbolizer.prototype.updateStyle
  89276. * @description 更新符号样式。
  89277. * @param {Object} renderer - 渲染器。
  89278. * @param {string} style - 符号样式。
  89279. */
  89280. updateStyle: function (renderer, style) {
  89281. this.options = style;
  89282. renderer._updateStyle(this);
  89283. },
  89284. /**
  89285. * @function Symbolizer.prototype.getElement
  89286. * @description 获取文本信息。
  89287. */
  89288. getElement: function () {
  89289. return this._path || this._renderer._container;
  89290. },
  89291. _getPixelBounds: function () {
  89292. var parts = this._parts;
  89293. var bounds = external_L_default().bounds([]);
  89294. for (var i = 0; i < parts.length; i++) {
  89295. var part = parts[i];
  89296. for (var j = 0; j < part.length; j++) {
  89297. bounds.extend(part[j]);
  89298. }
  89299. }
  89300. var w = this._clickTolerance(),
  89301. p = new (external_L_default()).Point(w, w);
  89302. bounds.min._subtract(p);
  89303. bounds.max._add(p);
  89304. return bounds;
  89305. },
  89306. _clickTolerance: (external_L_default()).Path.prototype._clickTolerance
  89307. });
  89308. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/TextSymbolizer.js
  89309. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89310. * This program are made available under the terms of the Apache License, Version 2.0
  89311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89312. /**
  89313. * @class TextSymbolizer
  89314. * @classdesc 文本符号类。
  89315. * @category Visualization VectorTile
  89316. * @private
  89317. * @extends {L.Path}
  89318. * @param {Object} feature - 要素。
  89319. * @param {number} pxPerExtent - 文本符号大小。
  89320. */
  89321. var TextSymbolizer = external_L_default().Path.extend({
  89322. /**
  89323. * @member TextSymbolizer.prototype.includes
  89324. * @description 包含的符号。
  89325. */
  89326. includes: Symbolizer.prototype,
  89327. options: {
  89328. color: 'white',
  89329. fillColor: 'black',
  89330. fill: true,
  89331. fillOpacity: 1,
  89332. opacity: 0.6,
  89333. weight: 1,
  89334. rotation: 0.0,
  89335. stroke: true,
  89336. fontFamily: "Arial Unicode MS Regular",
  89337. fontSize: 14,
  89338. fontWeight: 'normal',
  89339. textAlign: 'center',
  89340. offsetX: 1,
  89341. offsetY: 1
  89342. },
  89343. initialize: function (feature, pxPerExtent) {
  89344. Symbolizer.prototype.initialize.call(this, feature);
  89345. this._makeFeatureParts(feature, pxPerExtent);
  89346. this.options.offsetX = pxPerExtent || 1;
  89347. this.options.offsetY = pxPerExtent || 1;
  89348. },
  89349. /**
  89350. * @function TextSymbolizer.prototype.render
  89351. * @description 绘制点符号。
  89352. * @param {Object} renderer - 渲染器。
  89353. * @param {string} style - 符号样式。
  89354. */
  89355. render: function (renderer, style) {
  89356. //原本类型就是text的情况
  89357. if (this.properties.texts) {
  89358. this._text = this.properties.texts[0];
  89359. }
  89360. //类型是label的情况
  89361. if (!this._text) {
  89362. var attributes = this.properties.attributes;
  89363. this._text = (attributes && this.properties.textField) ?
  89364. attributes[this.properties.textField] || "" : "";
  89365. }
  89366. var options = this.options;
  89367. this._pxBounds = external_L_default().bounds(this._point, this._point);
  89368. Symbolizer.prototype.render.apply(this, [renderer, style]);
  89369. this.options = external_L_default().Util.extend(options, style);
  89370. this._updatePath();
  89371. },
  89372. _makeFeatureParts: function (feat, pxPerExtent) {
  89373. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  89374. var coord = feat.geometry[0];
  89375. if (typeof coord[0] === 'object' && 'x' in coord[0]) {
  89376. this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
  89377. this._empty = (external_L_default()).Util.falseFn;
  89378. } else {
  89379. this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
  89380. this._empty = (external_L_default()).Util.falseFn;
  89381. }
  89382. },
  89383. /**
  89384. * @function TextSymbolizer.prototype.makeInteractive
  89385. * @description 设置交互。
  89386. */
  89387. makeInteractive: function () {
  89388. this._updateBounds();
  89389. },
  89390. /**
  89391. * @function TextSymbolizer.prototype.updateStyle
  89392. * @description 更新符号样式。
  89393. * @param {Object} renderer - 渲染器。
  89394. * @param {string} style - 符号样式。
  89395. */
  89396. updateStyle: function (renderer, style) {
  89397. this._updateBounds();
  89398. return Symbolizer.prototype.updateStyle.call(this, renderer, style);
  89399. },
  89400. _updateBounds: function () {
  89401. var w = this._renderer._getTextWidth(this);
  89402. var p = [w / 2, w / 2];
  89403. this._pxBounds = external_L_default().bounds(this._point.subtract(p), this._point.add(p));
  89404. },
  89405. _updatePath: function () {
  89406. this._renderer._updateText(this);
  89407. },
  89408. _containsPoint: function (point) { // eslint-disable-line no-unused-vars
  89409. return false;
  89410. }
  89411. });
  89412. CanvasRenderer.include({
  89413. _getTextWidth: function (layer) {
  89414. return this._ctx.measureText(layer._text).width;
  89415. },
  89416. _updateText: function (layer) {
  89417. if (!this._drawing || layer._empty()) {
  89418. return;
  89419. }
  89420. var container = this.getContainer();
  89421. var size = this._map.getSize();
  89422. container.width = size.x;
  89423. container.height = size.y;
  89424. container.style.width = size.x + 'px';
  89425. container.style.height = size.y + 'px';
  89426. var ctx = this._ctx,
  89427. options = layer.options,
  89428. offsetX = options.offsetX || 1,
  89429. offsetY = options.offsetY || 1,
  89430. p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
  89431. if (!options.fill) {
  89432. return;
  89433. }
  89434. this._drawnLayers[layer._leaflet_id] = layer;
  89435. ctx.fillRect(0, 0, size.x, size.y);
  89436. ctx.font = [
  89437. options.fontWeight ? options.fontWeight : "normal",
  89438. options.fontSize ? options.fontSize : "14px",
  89439. options.fontFamily ? options.fontFamily : "Arial Unicode MS Regular,Microsoft Yahei"
  89440. ].join(" ");
  89441. ctx.textAlign = options.textAlign;
  89442. ctx.lineWidth = options.weight;
  89443. ctx.fillStyle = options.fillColor;
  89444. ctx.fillText(layer._text, p.x, p.y);
  89445. ctx.strokeStyle = options.color;
  89446. ctx.strokeText(layer._text, p.x, p.y);
  89447. ctx.rotate(options.rotation);
  89448. }
  89449. });
  89450. SVGRenderer.include({
  89451. _getTextWidth: function (layer) {
  89452. return layer._path.getComputedTextLength() || 0;
  89453. },
  89454. _initPath: function (layer) {
  89455. var path;
  89456. if (TextSymbolizer && layer instanceof TextSymbolizer) {
  89457. path = layer._path = external_L_default().SVG.create("text");
  89458. path.textContent = layer._text;
  89459. } else {
  89460. path = layer._path = external_L_default().SVG.create("path");
  89461. }
  89462. if (layer.options.className) {
  89463. external_L_default().DomUtil.addClass(path, layer.options.className);
  89464. }
  89465. if (layer.options.interactive) {
  89466. external_L_default().DomUtil.addClass(path, 'leaflet-interactive');
  89467. }
  89468. this._updateStyle(layer);
  89469. this._layers[external_L_default().stamp(layer)] = layer;
  89470. },
  89471. _updateText: function (layer) {
  89472. var path = layer._path,
  89473. options = layer.options,
  89474. offsetX = options.offsetX || 1,
  89475. offsetY = options.offsetY || 1,
  89476. p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
  89477. path.setAttribute('x', p.x);
  89478. path.setAttribute('y', p.y);
  89479. options.rotation = options.rotation || 0;
  89480. path.setAttribute('transform', 'rotate(' + options.rotation / Math.PI * 180 + ' ' + p.x + ' ' + p.y + ')');
  89481. path.setAttribute('text-anchor', options.textAlign === 'center' ? 'middle' : options.textAlign);
  89482. path.style.fontSize = options.fontSize;
  89483. path.style.fontFamily = options.fontFamily;
  89484. path.style.fontWeight = options.fontWeight || "normal";
  89485. path.style.glyphOrientationVertical = options.rotation||'';
  89486. if (options.stroke) {
  89487. path.setAttribute('stroke', options.color);
  89488. path.setAttribute('stroke-linecap', 'round');
  89489. path.setAttribute('stroke-linejoin', 'round');
  89490. path.setAttribute('stroke-opacity', options.opacity);
  89491. path.setAttribute('stroke-width', options.weight > 1 ? options.weight / 10 : options.weight);
  89492. } else {
  89493. path.setAttribute('stroke', 'none');
  89494. }
  89495. if (options.fill) {
  89496. path.setAttribute('fill', options.fillColor || options.color);
  89497. path.setAttribute('fill-opacity', options.fillOpacity);
  89498. } else {
  89499. path.setAttribute('fill', 'none');
  89500. }
  89501. }
  89502. });
  89503. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/PointSymbolizer.js
  89504. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89505. * This program are made available under the terms of the Apache License, Version 2.0
  89506. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89507. /**
  89508. * @class PointSymbolizer
  89509. * @classdesc 点符号类。
  89510. * @category Visualization VectorTile
  89511. * @private
  89512. * @extends {L.CircleMarker}
  89513. * @param {Object} feature - 点要素。
  89514. * @param {number} pxPerExtent - 点符号大小。
  89515. */
  89516. var PointSymbolizer = external_L_default().CircleMarker.extend({
  89517. /**
  89518. * @member PointSymbolizer.prototype.includes
  89519. * @description 包含的符号。
  89520. */
  89521. includes: Symbolizer.prototype,
  89522. statics: {
  89523. iconCache: {}
  89524. },
  89525. initialize: function (feature, pxPerExtent) {
  89526. Symbolizer.prototype.initialize.call(this, feature);
  89527. this._makeFeatureParts(feature, pxPerExtent);
  89528. },
  89529. getLatLng: undefined,
  89530. /**
  89531. * @function PointSymbolizer.prototype.render
  89532. * @description 绘制点符号。
  89533. * @param {Object} renderer - 渲染器。
  89534. * @param {string} style - 符号样式。
  89535. */
  89536. render: function (renderer, style) {
  89537. Symbolizer.prototype.render.call(this, renderer, style);
  89538. this._radius = style.radius || (external_L_default()).CircleMarker.prototype.options.radius;
  89539. this._updatePath();
  89540. },
  89541. _makeFeatureParts: function (feat, pxPerExtent) {
  89542. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  89543. var coord = feat.geometry[0];
  89544. if (typeof coord[0] === 'object' && 'x' in coord[0]) {
  89545. this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
  89546. this._empty = (external_L_default()).Util.falseFn;
  89547. } else {
  89548. this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
  89549. this._empty = (external_L_default()).Util.falseFn;
  89550. }
  89551. },
  89552. /**
  89553. * @function PointSymbolizer.prototype.makeInteractive
  89554. * @description 设置交互。
  89555. */
  89556. makeInteractive: function () {
  89557. this._updateBounds();
  89558. },
  89559. /**
  89560. * @function PointSymbolizer.prototype.updateStyle
  89561. * @description 更新符号样式。
  89562. * @param {Object} renderer - 渲染器。
  89563. * @param {string} style - 符号样式。
  89564. */
  89565. updateStyle: function (renderer, style) {
  89566. this._radius = style.radius || this._radius;
  89567. this._updateBounds();
  89568. return Symbolizer.prototype.updateStyle.call(this, renderer, style);
  89569. },
  89570. _updateBounds: function () {
  89571. var icon = this.options.iconUrl;
  89572. if (icon && this.options.iconSize) {
  89573. var size = external_L_default().point(this.options.iconSize),
  89574. anchor = size && size.divideBy(2, true),
  89575. p = this._point.subtract(anchor);
  89576. this._pxBounds = new (external_L_default()).Bounds(p, p.add(size));
  89577. } else {
  89578. external_L_default().CircleMarker.prototype._updateBounds.call(this);
  89579. }
  89580. },
  89581. _updatePath: function () {
  89582. if (this.options.iconUrl) {
  89583. this._renderer._updateIcon(this)
  89584. } else {
  89585. external_L_default().CircleMarker.prototype._updatePath.call(this);
  89586. }
  89587. },
  89588. _getImage: function () {
  89589. if (!this.options.iconUrl) {
  89590. return null;
  89591. }
  89592. var url = this.options.iconUrl,
  89593. img = PointSymbolizer.iconCache[url];
  89594. if (!img) {
  89595. var iconSize = this.options.iconSize || [50, 50];
  89596. img = PointSymbolizer.iconCache[url] = this._createIcon(url, iconSize);
  89597. }
  89598. return img;
  89599. },
  89600. _createIcon: function (url, iconSize) {
  89601. var src = url;
  89602. if (!src) {
  89603. throw new Error('iconUrl not set in Icon options (see the docs).');
  89604. }
  89605. var img = document.createElement('img'), name = "icon";
  89606. img.src = src;
  89607. img.className = 'leaflet-marker-' + name + ' ' + (this.layerName || '');
  89608. // var options = this.options;
  89609. var sizeOption = iconSize;
  89610. if (typeof sizeOption === 'number') {
  89611. sizeOption = [sizeOption, sizeOption];
  89612. }
  89613. if (sizeOption) {
  89614. var size = external_L_default().point(sizeOption),
  89615. anchor = external_L_default().point(size && size.divideBy(2, true));
  89616. if (size) {
  89617. img.style.width = size.x + 'px';
  89618. img.style.height = size.y + 'px';
  89619. }
  89620. if (anchor) {
  89621. img.style.marginLeft = (-anchor.x) + 'px';
  89622. img.style.marginTop = (-anchor.y) + 'px';
  89623. }
  89624. }
  89625. img.onload = function () {
  89626. if (!sizeOption) {
  89627. img.style.width = this.width + 'px';
  89628. img.style.height = this.height + 'px';
  89629. }
  89630. };
  89631. return img;
  89632. },
  89633. _containsPoint: function (p) {
  89634. var icon = this.options.iconUrl;
  89635. if (icon) {
  89636. return this._pxBounds.contains(p);
  89637. } else {
  89638. return external_L_default().CircleMarker.prototype._containsPoint.call(this, p);
  89639. }
  89640. }
  89641. });
  89642. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SymbolizerPolyBase.js
  89643. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89644. * This program are made available under the terms of the Apache License, Version 2.0
  89645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89646. /**
  89647. * @class PolyBase
  89648. * @classdesc 多边形基类。
  89649. * @category Visualization VectorTile
  89650. * @private
  89651. */
  89652. //@type {{_makeFeatureParts: PolyBase._makeFeatureParts, makeInteractive: PolyBase.makeInteractive}}
  89653. var PolyBase = {
  89654. _makeFeatureParts: function (feat, pxPerExtent) {
  89655. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  89656. var rings = feat.geometry;
  89657. var coord;
  89658. this._parts = [];
  89659. for (var i = 0; i < rings.length; i++) {
  89660. var ring = rings[i];
  89661. var part = [];
  89662. for (var j = 0; j < ring.length; j++) {
  89663. coord = ring[j];
  89664. part.push(external_L_default().point(coord).scaleBy(pxPerExtent));
  89665. }
  89666. this._parts.push(part);
  89667. }
  89668. },
  89669. /**
  89670. * @function PolyBase.prototype.makeInteractive
  89671. * @description 设置交互。
  89672. */
  89673. makeInteractive: function () {
  89674. this._pxBounds = this._getPixelBounds();
  89675. }
  89676. };
  89677. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/LineSymbolizer.js
  89678. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89679. * This program are made available under the terms of the Apache License, Version 2.0
  89680. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89681. /**
  89682. * @class LineSymbolizer
  89683. * @classdesc 线符号类。
  89684. * @category Visualization VectorTile
  89685. * @private
  89686. * @extends {L.Polyline}
  89687. * @param {Object} feature - 线要素。
  89688. * @param {number} pxPerExtent - 线长。
  89689. */
  89690. var LineSymbolizer = external_L_default().Polyline.extend({
  89691. /**
  89692. * @member LineSymbolizer.prototype.includes
  89693. * @description 包含符号。
  89694. */
  89695. includes: [Symbolizer.prototype, PolyBase],
  89696. initialize: function (feature, pxPerExtent) {
  89697. Symbolizer.prototype.initialize.call(this, feature);
  89698. this._makeFeatureParts(feature, pxPerExtent);
  89699. },
  89700. /**
  89701. * @function LineSymbolizer.prototype.render
  89702. * @description 绘制线符号。
  89703. * @param {Object} renderer - 渲染器。
  89704. * @param {string} style - 符号样式。
  89705. */
  89706. render: function (renderer, style) {
  89707. style.fill = false;
  89708. Symbolizer.prototype.render.call(this, renderer, style);
  89709. this._updatePath();
  89710. },
  89711. /**
  89712. * @function LineSymbolizer.prototype.updateStyle
  89713. * @description 更新符号样式。
  89714. * @param {Object} renderer - 渲染器。
  89715. * @param {string} style - 符号样式。
  89716. */
  89717. updateStyle: function (renderer, style) {
  89718. style.fill = false;
  89719. Symbolizer.prototype.updateStyle.call(this, renderer, style);
  89720. }
  89721. });
  89722. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/RegionSymbolizer.js
  89723. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89724. * This program are made available under the terms of the Apache License, Version 2.0
  89725. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89726. /**
  89727. * @class RegionSymbolizer
  89728. * @classdesc 面符号类。
  89729. * @category Visualization VectorTile
  89730. * @private
  89731. * @extends {L.Polygon}
  89732. * @param {Object} feature - 面要素。
  89733. * @param {number} pxPerExtent - 面积像素大小。
  89734. */
  89735. var RegionSymbolizer = external_L_default().Polygon.extend({
  89736. /**
  89737. * @member RegionSymbolizer.prototype.includes
  89738. * @description 包含的符号。
  89739. */
  89740. includes: [Symbolizer.prototype, PolyBase],
  89741. initialize: function (feature, pxPerExtent) {
  89742. Symbolizer.prototype.initialize.call(this, feature);
  89743. this._makeFeatureParts(feature, pxPerExtent);
  89744. },
  89745. /**
  89746. * @function RegionSymbolizer.prototype.render
  89747. * @description 绘制面符号。
  89748. * @param {Object} renderer - 渲染器。
  89749. * @param {string} style - 符号样式。
  89750. */
  89751. render: function (renderer, style) {
  89752. Symbolizer.prototype.render.call(this, renderer, style);
  89753. this._updatePath();
  89754. }
  89755. });
  89756. // EXTERNAL MODULE: ./node_modules/pbf/index.js
  89757. var node_modules_pbf = __webpack_require__(614);
  89758. var pbf_default = /*#__PURE__*/__webpack_require__.n(node_modules_pbf);
  89759. // EXTERNAL MODULE: ./node_modules/@mapbox/vector-tile/index.js
  89760. var vector_tile = __webpack_require__(929);
  89761. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTilePBF.js
  89762. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89763. * This program are made available under the terms of the Apache License, Version 2.0
  89764. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89765. /**
  89766. * @class VectorTilePBF
  89767. * @classdesc 矢量瓦片 PBF(MVT) 表述出图。
  89768. * @category Visualization VectorTile
  89769. * @private
  89770. * @extends {L.Class}
  89771. * @param {string} url - 服务地址。
  89772. */
  89773. var VectorTilePBF = external_L_default().Class.extend({
  89774. initialize: function (url) {
  89775. this.url = url;
  89776. },
  89777. /**
  89778. * @function VectorTilePBF.prototype.getTile
  89779. * @description 获取瓦片 PBF(MVT)。
  89780. * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
  89781. */
  89782. getTile: function () {
  89783. var me = this;
  89784. return FetchRequest.get(me.url, null, {
  89785. timeout: 10000
  89786. }).then(function (response) {
  89787. if (!response.ok) {
  89788. return {layers: []};
  89789. }
  89790. return response.blob().then(function (blob) {
  89791. var reader = new FileReader();
  89792. return new Promise(function (resolve) {
  89793. reader.addEventListener("loadend", function () {
  89794. var pbf = new (pbf_default())(reader.result);
  89795. return resolve(new vector_tile.VectorTile(pbf));
  89796. });
  89797. reader.readAsArrayBuffer(blob);
  89798. });
  89799. });
  89800. }).then(function (json) {
  89801. return me._processVectorTileSpec(json);
  89802. });
  89803. },
  89804. _processVectorTileSpec: function (vectorTile) {
  89805. var layers = [];
  89806. for (var layerName in vectorTile.layers) {
  89807. var feats = [];
  89808. for (var i = 0; i < vectorTile.layers[layerName].length; i++) {
  89809. var feat = vectorTile.layers[layerName].feature(i);
  89810. feat.geometry = feat.loadGeometry();
  89811. feat.layerName = layerName;
  89812. feat.properties = {attributes: external_L_default().Util.extend({}, feat.properties), id: feat.id};
  89813. switch (feat.type) {
  89814. case 1:
  89815. feat.type = VectorFeatureType.POINT;
  89816. break;
  89817. case 2:
  89818. feat.type = VectorFeatureType.LINE;
  89819. break;
  89820. case 3:
  89821. feat.type = VectorFeatureType.REGION;
  89822. break;
  89823. default:
  89824. break;
  89825. }
  89826. feats.push(feat);
  89827. }
  89828. var layer = {};
  89829. layer.features = feats;
  89830. layer.layerName = layerName;
  89831. layer.extent = vectorTile.layers[layerName].extent;
  89832. layers.push(layer);
  89833. }
  89834. return layers;
  89835. }
  89836. });
  89837. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTileJSON.js
  89838. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89839. * This program are made available under the terms of the Apache License, Version 2.0
  89840. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89841. /**
  89842. * @class VectorTileJSON
  89843. * @classdesc iServer 矢量瓦片 JSON 表述出图。
  89844. * @category Visualization VectorTile
  89845. * @private
  89846. * @extends {L.Class}
  89847. * @param {string} url - 服务地址。
  89848. */
  89849. var VectorTileJSON = external_L_default().Class.extend({
  89850. initialize: function (url) {
  89851. this.url = url;
  89852. },
  89853. /**
  89854. * @function VectorTileJSON.prototype.getTile
  89855. * @description 获取瓦片。
  89856. * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
  89857. */
  89858. getTile: function () {
  89859. var me = this;
  89860. return FetchRequest.get(me.url, null, {
  89861. timeout: 10000
  89862. }).then(function (response) {
  89863. return response.json()
  89864. }).then(function (json) {
  89865. return me._processRecordSets(json, me);
  89866. });
  89867. },
  89868. _processRecordSets: function (records, scope) {
  89869. var recordsets = records.recordsets;
  89870. // 如果iServer支持了tileFeature geojson表述则不需要此步骤
  89871. recordsets = scope._convertToGeoJSON(recordsets);
  89872. if (!recordsets) {
  89873. return null;
  89874. }
  89875. //类似VT标准的数据格式,并为每个要素添加一个layerName字段
  89876. for (var i = 0; i < recordsets.length; i++) {
  89877. var recordset = recordsets[i];
  89878. for (var j = 0; j < recordset.features.length; j++) {
  89879. var feature = recordset.features[j];
  89880. feature = scope._convertToVectorLayerFeature(feature, scope);
  89881. feature.layerName = recordset.layerName;
  89882. recordset.features[j] = feature;
  89883. }
  89884. recordset.extent = 256;
  89885. delete recordset.fieldTypes;
  89886. delete recordset.fields;
  89887. }
  89888. return recordsets;
  89889. },
  89890. _convertToVectorLayerFeature: function (feature, scope) {
  89891. if (!feature.geometry) {
  89892. return;
  89893. }
  89894. var newFeature = {};
  89895. var geom = feature.geometry,
  89896. type = geom.type,
  89897. coords = geom.coordinates,
  89898. tags = feature.properties,
  89899. id = tags.id,
  89900. i, j, rings, projectedRing;
  89901. if (type === 'Point') {
  89902. newFeature = (tags && tags.texts) ?
  89903. scope._createFeature(id, VectorFeatureType.TEXT, [coords], tags) :
  89904. scope._createFeature(id, VectorFeatureType.POINT, [coords], tags);
  89905. } else if (type === 'MultiPoint') {
  89906. newFeature = scope._createFeature(id, VectorFeatureType.POINT, coords, tags);
  89907. } else if (type === 'LineString') {
  89908. newFeature = scope._createFeature(id, VectorFeatureType.LINE, [coords], tags);
  89909. } else if (type === 'MultiLineString' || type === 'Polygon') {
  89910. rings = [];
  89911. for (i = 0; i < coords.length; i++) {
  89912. projectedRing = coords[i];
  89913. if (type === 'Polygon') {
  89914. projectedRing.outer = (i === 0);
  89915. }
  89916. rings.push(projectedRing);
  89917. }
  89918. var featureType = (type === 'Polygon') ?
  89919. VectorFeatureType.REGION :
  89920. VectorFeatureType.LINE;
  89921. newFeature = scope._createFeature(id, featureType, rings, tags);
  89922. } else if (type === 'MultiPolygon') {
  89923. rings = [];
  89924. for (i = 0; i < coords.length; i++) {
  89925. for (j = 0; j < coords[i].length; j++) {
  89926. projectedRing = coords[i][j];
  89927. projectedRing.outer = (j === 0);
  89928. rings.push(projectedRing);
  89929. }
  89930. }
  89931. newFeature = scope._createFeature(id, VectorFeatureType.REGION, rings, tags);
  89932. } else {
  89933. throw new Error('Illegal GeoJSON object');
  89934. }
  89935. return newFeature;
  89936. },
  89937. _convertToGeoJSON: function (recordsets) {
  89938. if (!recordsets) {
  89939. return;
  89940. }
  89941. for (var i = 0; i < recordsets.length; i++) {
  89942. var recordset = recordsets[i];
  89943. for (var j = 0; j < recordset.features.length; j++) {
  89944. var feature = recordset.features[j];
  89945. var points = [];
  89946. var startIndex = 0;
  89947. for (var k = 0; k < feature.geometry.parts.length; k++) {
  89948. var partPointsLength = feature.geometry.parts[k] * 2;
  89949. for (var l = 0, index = startIndex; l < partPointsLength; l += 2, index += 2) {
  89950. var x = feature.geometry.points[index];
  89951. var y = feature.geometry.points[index + 1];
  89952. points.push({x: x, y: y});
  89953. }
  89954. startIndex += partPointsLength;
  89955. }
  89956. feature.geometry.points = points;
  89957. }
  89958. recordset.features = toGeoJSON(recordset.features).features;
  89959. }
  89960. return recordsets;
  89961. },
  89962. _createFeature: function (id, type, geometry, properties) {
  89963. return {
  89964. id: id,
  89965. type: type,
  89966. geometry: geometry,
  89967. properties: properties
  89968. }
  89969. }
  89970. });
  89971. ;// CONCATENATED MODULE: ./src/leaflet/overlay/VectorTileFormat.js
  89972. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89973. * This program are made available under the terms of the Apache License, Version 2.0
  89974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89975. /**
  89976. * @enum VectorTileFormat
  89977. * @category BaseTypes Constant
  89978. * @description 矢量瓦片格式。
  89979. * @type {string}
  89980. * @usage
  89981. * ```
  89982. * // 浏览器
  89983. * <script type="text/javascript" src="{cdn}"></script>
  89984. * <script>
  89985. * const result = {namespace}.VectorTileFormat.JSON;
  89986. *
  89987. * </script>
  89988. * // ES6 Import
  89989. * import { VectorTileFormat } from '{npm}';
  89990. *
  89991. * const result = VectorTileFormat.JSON;
  89992. * ```
  89993. */
  89994. var VectorTileFormat = {
  89995. /** JSON */
  89996. JSON: "JSON",
  89997. /** MVT */
  89998. MVT: "MVT",
  89999. /** PBF */
  90000. PBF: "PBF"
  90001. };
  90002. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTile.js
  90003. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90004. * This program are made available under the terms of the Apache License, Version 2.0
  90005. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90006. /**
  90007. * @class VectorTile
  90008. * @classdesc 矢量瓦片图层基类。
  90009. * @category Visualization VectorTile
  90010. * @private
  90011. * @extends {L.Class}
  90012. * @param {Object} options - 参数。
  90013. * @param {string} [options.layer] - 图层名称。
  90014. * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
  90015. * @param {string} [options.format] - 返回值类型。
  90016. * @param {Object} [options.coords] - 坐标系统对象。
  90017. * @param {Object} [options.renderer] - 渲染器对象。
  90018. * @param {function} done - 回调函数。
  90019. */
  90020. var VectorTile = external_L_default().Class.extend({
  90021. initialize: function (options, done) {
  90022. this.layer = options.layer;
  90023. this.tileSize = options.layer.getTileSize();
  90024. this.format = options.format;
  90025. this.coords = options.coords;
  90026. this.renderer = options.renderer;
  90027. this.done = done;
  90028. this.layer._textVectorTiles = {};
  90029. },
  90030. /**
  90031. * @function VectorTile.prototype.renderTile
  90032. * @description 渲染切片。
  90033. */
  90034. renderTile: function () {
  90035. var me = this, layer = me.layer, coords = me.coords;
  90036. var tileFeatureUrl = layer._getTileUrl(coords);
  90037. var format = [VectorTileFormat.MVT, VectorTileFormat.PBF];
  90038. var tileFeaturePromise;
  90039. if (format.indexOf(me.format.toUpperCase()) > -1) {
  90040. tileFeaturePromise = new VectorTilePBF(tileFeatureUrl);
  90041. } else {
  90042. tileFeaturePromise = new VectorTileJSON(tileFeatureUrl)
  90043. }
  90044. tileFeaturePromise.getTile().then(function (tileFeature) {
  90045. me.render(tileFeature, coords);
  90046. })
  90047. },
  90048. /**
  90049. * @function VectorTile.prototype.render
  90050. * @description 渲染切片要素。
  90051. * @param {Object} tileFeature - 需要渲染的切片要素。
  90052. * @param {Object} coords - 切片坐标参数对象。
  90053. */
  90054. render: function (tileFeature, coords) {
  90055. if (!tileFeature) {
  90056. return;
  90057. }
  90058. var me = this,
  90059. renderer = me.renderer,
  90060. tileLayer = me.layer;
  90061. for (var k = 0; k < tileFeature.length; k++) {
  90062. var layer = tileFeature[k], layerName = layer.layerName;
  90063. tileLayer._dataLayerNames[layerName] = true;
  90064. var pxPerExtent = me.tileSize.divideBy(layer.extent);
  90065. var layerStyleInfo = tileLayer.getLayerStyleInfo(layer.layerName);
  90066. for (var i = 0; i < layer.features.length; i++) {
  90067. var feat = layer.features[i];
  90068. if (!feat) {
  90069. continue;
  90070. }
  90071. //标签图层处理为文本
  90072. if (layerStyleInfo && layerStyleInfo.type === VectorFeatureType.LABEL
  90073. && feat.type === VectorFeatureType.POINT
  90074. && feat.properties.attributes) {
  90075. feat.type = VectorFeatureType.TEXT;
  90076. }
  90077. var styleOptions = me._getStyleOptions(coords, feat, layerName, me);
  90078. if (!styleOptions.length) {
  90079. continue;
  90080. }
  90081. var featureLayer = me._createFeatureLayer(feat, pxPerExtent);
  90082. if (!featureLayer) {
  90083. continue;
  90084. }
  90085. // 保存文本图层单独绘制,避免被压盖
  90086. var param = {scope: me, coords: coords, renderer: renderer};
  90087. if (me._extractTextLayer(feat, featureLayer, styleOptions, param)) {
  90088. continue;
  90089. }
  90090. for (var j = 0; j < styleOptions.length; j++) {
  90091. var style = me._validateStyle(styleOptions[j], feat.type);
  90092. featureLayer.render(renderer, style);
  90093. renderer._addPath(featureLayer);
  90094. }
  90095. if (tileLayer.options.interactive) {
  90096. featureLayer.makeInteractive();
  90097. }
  90098. var featureKey = tileLayer._getFeatureKey(feat.id, layerName);
  90099. renderer._features[featureKey] = {
  90100. layerName: layerName,
  90101. feature: featureLayer
  90102. };
  90103. }
  90104. }
  90105. if (tileLayer._map) {
  90106. renderer.addTo(tileLayer._map);
  90107. }
  90108. external_L_default().Util.requestAnimFrame(me.done.bind(coords, null, me.layer._vectorTiles[me.layer._tileCoordsToKey(coords)]));
  90109. },
  90110. // 保存文本图层单独绘制,避免被压盖
  90111. _extractTextLayer: function (feat, featureLayer, style, param) {
  90112. if (feat.type !== VectorFeatureType.TEXT) {
  90113. return false;
  90114. }
  90115. var me = param.scope,
  90116. coords = param.coords,
  90117. tileLayer = me.layer,
  90118. key = tileLayer._tileCoordsToKey(coords);
  90119. var id = feat.id,
  90120. layerName = feat.layerName;
  90121. var textTileLayers = tileLayer._textVectorTiles[key];
  90122. if (!textTileLayers) {
  90123. textTileLayers = {
  90124. layers: {},
  90125. coords: coords,
  90126. renderer: param.renderer
  90127. };
  90128. }
  90129. // 不同瓦片可能请求到同一个文本图层,为避免重复绘制,只保存绘制最后一个
  90130. textTileLayers.layers[id] = {
  90131. layer: featureLayer,
  90132. style: style,
  90133. layerName: layerName
  90134. };
  90135. tileLayer._textVectorTiles[key] = textTileLayers;
  90136. return true;
  90137. },
  90138. _getStyleOptions: function (coords, feature, layerName, scope) {
  90139. var me = scope;
  90140. var tileLayer = me.layer;
  90141. var styleOptions = tileLayer.getVectorTileLayerStyle(coords, feature) || me._defaultStyle(feature.type);
  90142. //根据id和layerName识别唯一要素
  90143. var id = feature.id,
  90144. styleKey = tileLayer._getFeatureKey(id, layerName),
  90145. styleOverride = tileLayer._overriddenStyles[styleKey];
  90146. styleOptions = styleOverride ? styleOverride : styleOptions;
  90147. styleOptions = (styleOptions instanceof Function) ? styleOptions(feature.properties, coords.z) : styleOptions;
  90148. styleOptions = !(styleOptions instanceof Array) ? [styleOptions] : styleOptions;
  90149. return styleOptions;
  90150. },
  90151. _createFeatureLayer: function (feat, pxPerExtent) {
  90152. var layer;
  90153. switch (feat.type) {
  90154. case VectorFeatureType.POINT:
  90155. layer = new PointSymbolizer(feat, pxPerExtent);
  90156. break;
  90157. case VectorFeatureType.LINE:
  90158. layer = new LineSymbolizer(feat, pxPerExtent);
  90159. break;
  90160. case VectorFeatureType.REGION:
  90161. layer = new RegionSymbolizer(feat, pxPerExtent);
  90162. break;
  90163. case VectorFeatureType.TEXT:
  90164. layer = new TextSymbolizer(feat, pxPerExtent);
  90165. break;
  90166. default:
  90167. break;
  90168. }
  90169. var vectorLayer = this.layer;
  90170. if (layer && vectorLayer.options.interactive) {
  90171. layer.addEventParent(vectorLayer);
  90172. }
  90173. return layer;
  90174. },
  90175. //矫正一些参数
  90176. _validateStyle: function (style, type) {
  90177. //默认leaflet path的边宽为3,矩形颜色填充透明度为0.2,跟iClient不一样,故作调整
  90178. (external_L_default()).Path.prototype.options.weight = 1;
  90179. (external_L_default()).Path.prototype.options.fillOpacity = 1;
  90180. switch (type) {
  90181. case VectorFeatureType.POINT:
  90182. return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
  90183. case VectorFeatureType.LINE:
  90184. return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
  90185. case VectorFeatureType.REGION:
  90186. return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
  90187. case VectorFeatureType.TEXT:
  90188. return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
  90189. default:
  90190. break;
  90191. }
  90192. },
  90193. //如果cartoCSS和layerInfo都没有得到样式,则使用该默认样式
  90194. _defaultStyle: function (type) {
  90195. var defaultOptions = (external_L_default()).Path.prototype.options;
  90196. defaultOptions.weight = 1;
  90197. defaultOptions.fillOpacity = 1;
  90198. defaultOptions.radius = 3;
  90199. switch (type) {
  90200. case VectorFeatureType.POINT:
  90201. return external_L_default().extend({}, defaultOptions, (external_L_default()).CircleMarker.prototype.options);
  90202. case VectorFeatureType.LINE:
  90203. return external_L_default().extend({}, defaultOptions, (external_L_default()).Polyline.prototype.options);
  90204. case VectorFeatureType.REGION:
  90205. return external_L_default().extend({}, defaultOptions, (external_L_default()).Polygon.prototype.options);
  90206. case VectorFeatureType.TEXT:
  90207. return external_L_default().extend({}, defaultOptions, TextSymbolizer.prototype.options);
  90208. default:
  90209. break;
  90210. }
  90211. }
  90212. });
  90213. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorGrid.js
  90214. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90215. * This program are made available under the terms of the Apache License, Version 2.0
  90216. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90217. /**
  90218. * Inspired by https://github.com/Leaflet/Leaflet.VectorGrid
  90219. */
  90220. /**
  90221. * @class VectorGrid
  90222. * @classdesc 矢量瓦片图层基类。
  90223. * @category Visualization VectorTile
  90224. * @extends {L.GridLayer}
  90225. * @param {Object} options - 参数。
  90226. * @param {Object} [options.vectorTileLayerStyles] - 矢量网片图层风格。
  90227. * @param {string} [options.renderer='SVG'] - 渲染器类型。
  90228. * @param {VectorTileFormat} [options.format=VectorTileFormat.JSON] - 矢量瓦片格式。
  90229. * @param {boolean} [options.interactive=true] - 是否可交互。
  90230. * @param {number} [options.maxZoom=23] - 最大缩放级别。
  90231. * @usage
  90232. */
  90233. var VectorGrid = external_L_default().GridLayer.extend({
  90234. options: {
  90235. vectorTileLayerStyles: null,
  90236. //SVG or Canvas
  90237. renderer: "SVG",
  90238. format: VectorTileFormat.JSON,
  90239. interactive: true,
  90240. maxZoom:23
  90241. },
  90242. initialize: function (options) {
  90243. var me = this;
  90244. external_L_default().setOptions(me, options);
  90245. external_L_default().GridLayer.prototype.initialize.call(me, options);
  90246. me._vectorTiles = {};
  90247. //交互事件使用,键值为id_layerName
  90248. me._overriddenStyles = {};
  90249. me.vectorTileLayerStyles = me.options.vectorTileLayerStyles;
  90250. me.on('tileunload', function (e) {
  90251. var key = me._tileCoordsToKey(e.coords),
  90252. tile = me._vectorTiles[key];
  90253. if (tile && me._map) {
  90254. tile.removeFrom(me._map);
  90255. }
  90256. delete me._vectorTiles[key];
  90257. }, me);
  90258. me.on('tileerror ', me._renderText, me);
  90259. me.on('load', me._renderText, me);
  90260. me._dataLayerNames = {};
  90261. },
  90262. /**
  90263. * @private
  90264. * @function VectorGrid.prototype.createTile
  90265. * @description 创建切片图层。
  90266. * @param {Object} coords - 切片坐标参数对象。
  90267. * @param {function} done - todo。
  90268. */
  90269. createTile: function (coords, done) {
  90270. var me = this;
  90271. var tileSize = me.getTileSize();
  90272. var renderer = null;
  90273. if (me.options.renderer === "Canvas") {
  90274. renderer = new CanvasRenderer(coords, tileSize, me.options);
  90275. } else {
  90276. renderer = new SVGRenderer(coords, tileSize, me.options);
  90277. }
  90278. me._vectorTiles[me._tileCoordsToKey(coords)] = renderer;
  90279. renderer._features = {};
  90280. new VectorTile({
  90281. layer: me,
  90282. format: me.options.format,
  90283. coords: coords,
  90284. renderer: renderer
  90285. }, done).renderTile();
  90286. return renderer.getContainer();
  90287. },
  90288. /**
  90289. * @function VectorGrid.prototype.getStyles
  90290. * @description 获取图层样式。
  90291. * @returns {Object} 所有图层的样式。
  90292. */
  90293. getStyles: function () {
  90294. return this.vectorTileLayerStyles;
  90295. },
  90296. /**
  90297. * @function VectorGrid.prototype.getStyle
  90298. * @description 获取指定图层样式。
  90299. * @param {string} layerName - 图层名称。
  90300. * @returns {Object} 指定图层的样式。
  90301. */
  90302. getStyle: function (layerName) {
  90303. return this.vectorTileLayerStyles && this.vectorTileLayerStyles[layerName];
  90304. },
  90305. /**
  90306. * @function VectorGrid.prototype.setFeatureStyle
  90307. * @description 指定要素 ID 和图层名称设置要素风格。
  90308. * @param {number} id - 要素 ID。
  90309. * @param {string} layerName - 图层名称。
  90310. * @param {(Array|function)} layerStyle - 图层样式。
  90311. * @returns {VectorGrid} VectorGrid的实例对象。
  90312. */
  90313. setFeatureStyle: function (id, layerName, layerStyle) {
  90314. var featureKey = this._getFeatureKey(id, layerName);
  90315. this._overriddenStyles[featureKey] = layerStyle;
  90316. for (var tileKey in this._vectorTiles) {
  90317. var tile = this._vectorTiles[tileKey];
  90318. var features = tile._features;
  90319. var data = features[featureKey];
  90320. if (data) {
  90321. var feat = data.feature;
  90322. this._updateStyles(feat, tile, layerStyle);
  90323. }
  90324. }
  90325. return this;
  90326. },
  90327. /**
  90328. * @function VectorGrid.prototype.resetFeatureStyle
  90329. * @description 指定要素 ID 和图层名称重绘要素风格。
  90330. * @param {number} id - 要素 ID。
  90331. * @param {string} layerName - 图层名称。
  90332. * @returns {VectorGrid} VectorGrid的实例对象。
  90333. */
  90334. resetFeatureStyle: function (id, layerName) {
  90335. var featureKey = this._getFeatureKey(id, layerName);
  90336. delete this._overriddenStyles[featureKey];
  90337. for (var tileKey in this._vectorTiles) {
  90338. var tile = this._vectorTiles[tileKey];
  90339. var data = tile._features[featureKey];
  90340. if (data) {
  90341. var feat = data.feature;
  90342. var styleOptions = this.vectorTileLayerStyles[data.layerName];
  90343. this._updateStyles(feat, tile, styleOptions);
  90344. }
  90345. }
  90346. return this;
  90347. },
  90348. /**
  90349. * @function VectorGrid.prototype.getDataLayerNames
  90350. * @description 获取数据图层名称。
  90351. * @returns {Array} 返回数据图层名称数组。
  90352. */
  90353. getDataLayerNames: function () {
  90354. return Object.keys(this._dataLayerNames);
  90355. },
  90356. _removeAllTiles: function () {
  90357. external_L_default().GridLayer.prototype._removeAllTiles.call(this);
  90358. this._textVectorTiles = {};
  90359. },
  90360. _renderText: function () {
  90361. var textVectorTiles = this._textVectorTiles;
  90362. for (var key in textVectorTiles) {
  90363. var textTiles = textVectorTiles[key];
  90364. var renderer = textTiles.renderer;
  90365. for (var layerId in textTiles.layers) {
  90366. var tile = textTiles.layers[layerId];
  90367. var styleOptions = tile.style,
  90368. featureLayer = tile.layer;
  90369. for (var j = 0; j < styleOptions.length; j++) {
  90370. featureLayer.render(renderer, styleOptions[j]);
  90371. renderer._addPath(featureLayer);
  90372. }
  90373. if (this.options.interactive) {
  90374. featureLayer.makeInteractive();
  90375. }
  90376. }
  90377. }
  90378. },
  90379. _getFeatureKey: function (id, layerName) {
  90380. id = id || 0;
  90381. layerName = layerName || "null";
  90382. return id + "_" + layerName;
  90383. },
  90384. _updateStyles: function (feat, renderer, styleOptions) {
  90385. styleOptions = (styleOptions instanceof Function) ?
  90386. styleOptions(feat.properties, renderer.getCoord().z) :
  90387. styleOptions;
  90388. if (!(styleOptions instanceof Array)) {
  90389. styleOptions = [styleOptions];
  90390. }
  90391. for (var j = 0; j < styleOptions.length; j++) {
  90392. var style = this._extendStyle(styleOptions[j], feat.type);
  90393. feat.updateStyle(renderer, style);
  90394. }
  90395. },
  90396. //矫正一些参数
  90397. _extendStyle: function (style, type) {
  90398. switch (type) {
  90399. case VectorFeatureType.POINT:
  90400. return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
  90401. case VectorFeatureType.LINE:
  90402. return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
  90403. case VectorFeatureType.REGION:
  90404. return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
  90405. case VectorFeatureType.TEXT:
  90406. return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
  90407. default:
  90408. break;
  90409. }
  90410. }
  90411. });
  90412. ;// CONCATENATED MODULE: ./src/leaflet/overlay/TiledVectorLayer.js
  90413. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90414. * This program are made available under the terms of the Apache License, Version 2.0
  90415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90416. /**
  90417. * @class TiledVectorLayer
  90418. * @deprecatedclassinstance L.supermap.tiledVectorLayer
  90419. * @classdesc SuperMap iServer 的矢量瓦片图层。
  90420. * @category Visualization VectorTile
  90421. * @extends VectorGrid
  90422. * @example
  90423. * new TiledVectorLayer(url).addTo(map);
  90424. * @param {string} url - 服务地址。
  90425. * @param {Object} options - 参数。
  90426. * @param {string} options.layerNames - 指定图层的名称列表,支持的类型为矢量图层。
  90427. * @param {string} options.layersID - 获取进行切片的地图图层 ID。
  90428. * @param {string} [options.cartoCSS] - 客户端 CartoCSS 样式字符串。
  90429. * @param {boolean} [options.serverCartoCSSStyle=true] - 是否使用服务端 CartoCSS 样式。
  90430. * @param {boolean} [options.processCharacters=false] - 设置客户端 CartoCSS 样式时是否进行特定字符转换。
  90431. * @param {CRS} [options.crs] - 坐标系统类。
  90432. * @param {boolean} [options.returnAttributes=false] - 是否返回 attributes。
  90433. * @param {string} [options.expands] - expands。
  90434. * @param {boolean} [options.cacheEnabled=true] - 是否启用缓存。
  90435. * @param {Object} [options.tileTemplate] - 瓦片模板,如果设置了此参数,则按此模板出图。默认出图方式为 URL 对接的第三方瓦片。
  90436. * @param {string} [options.subdomains] - 子域名。
  90437. * @param {number} [options.timeout=10000] - 延时。
  90438. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`] - 版权信息。
  90439. * @usage
  90440. */
  90441. var TiledVectorLayer = VectorGrid.extend({
  90442. options: {
  90443. crs: null,
  90444. //客户端cartocss样式
  90445. cartoCSS: null,
  90446. // 指定图层的名称列表。支持的类型为矢量图层
  90447. layerNames: null,
  90448. //获取进行切片的地图图层 ID
  90449. layersID: null,
  90450. //是否服务端CartoCSS样式,默认使用
  90451. serverCartoCSSStyle: true,
  90452. //设置客户端CartoCSS样式时是否进行特定字符转换
  90453. processCharacters: false,
  90454. returnAttributes: false,
  90455. /*各图层扩展的像素值。
  90456. *例如:
  90457. * 0_15:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,除0、1图层外的子图层的扩展像素都为15像素。
  90458. * 0:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,其他除0、1图层外的子图层的扩展像素为根据该图层默认样式计算得出的默认值。
  90459. */
  90460. expands: null,
  90461. cacheEnabled: false,
  90462. //瓦片模板,如果设置了此参数,则按此模板出图,url无效(对接第三方瓦片)
  90463. tileTemplate: null,
  90464. subdomains: 'abc',
  90465. timeout: 10000,
  90466. attribution: core_Attributions.Common.attribution
  90467. },
  90468. initialize: function (url, options) {
  90469. options = options || {};
  90470. options.noWrap = (options.noWrap == null) ? true : options.noWrap;
  90471. external_L_default().setOptions(this, options);
  90472. VectorGrid.prototype.initialize.call(this, options);
  90473. external_L_default().stamp(this);
  90474. var me = this;
  90475. if (!url || url.indexOf("http") < 0) {
  90476. url = "";
  90477. return this;
  90478. }
  90479. me.url = url;
  90480. if (url.indexOf("/") === (url.length - 1)) {
  90481. url = url.substr(0, url.length - 1);
  90482. me.url = url;
  90483. }
  90484. this.cartoCSSToLeaflet = new CartoCSSToLeaflet(me.url);
  90485. me.initLayersInfo();
  90486. if (!me.options.serverCartoCSSStyle && me.options.cartoCSS) {
  90487. me.setClientCartoCSS(me.options.cartoCSS);
  90488. }
  90489. },
  90490. /**
  90491. * @private
  90492. * @function TiledVectorLayer.prototype.onAdd
  90493. * @description 添加地图。
  90494. * @param {L.Map} map - Leaflet Map 对象。
  90495. */
  90496. onAdd: function (map) {
  90497. this._crs = this.options.crs || map.options.crs;
  90498. this._map = map;
  90499. this._initLayerUrl();
  90500. if (this.options.tileTemplate || !this.options.serverCartoCSSStyle) {
  90501. this._initGrid();
  90502. }
  90503. },
  90504. /**
  90505. * @private
  90506. * @function TiledVectorLayer.prototype.initLayersInfo
  90507. * @description 获取服务器图层资源下的风格信息(当 CartoCSS 中不存在相应图层渲染信息时使用)。
  90508. */
  90509. initLayersInfo: function () {
  90510. var me = this;
  90511. var layersUrl = Util_Util.urlPathAppend(me.url, "layers");
  90512. FetchRequest.get(SecurityManager.appendCredential(layersUrl), null, {
  90513. timeout: me.options.timeout
  90514. }).then(function (response) {
  90515. return response.json();
  90516. }).then(function (json) {
  90517. me.layersInfoInitialized = true;
  90518. me.layersInfo = json;
  90519. if (!me.layersInfo) {
  90520. return;
  90521. }
  90522. var layersInfo = {};
  90523. for (var i = 0, len = me.layersInfo.length; i < len; i++) {
  90524. var layers = me.layersInfo[i].subLayers.layers;
  90525. for (var j = 0, len1 = layers.length; j < len1; j++) {
  90526. layers[j].layerIndex = len1 - j;
  90527. layersInfo[layers[j].name] = layers[j];
  90528. }
  90529. }
  90530. me.layersInfo = layersInfo;
  90531. me.cartoCSSToLeaflet.layersInfo = layersInfo;
  90532. if (me.options.serverCartoCSSStyle) {
  90533. me.getVectorStylesFromServer();
  90534. }
  90535. }).catch(function (ex) {
  90536. console.error('error', ex)
  90537. });
  90538. },
  90539. /**
  90540. * @function TiledVectorLayer.prototype.getLayerStyleInfo
  90541. * @description 获取图层样式信息。
  90542. * @param {string} layerName - 图层名称。
  90543. */
  90544. getLayerStyleInfo: function (layerName) {
  90545. var me = this,
  90546. layerInfo_simple;
  90547. me.layersStyles = me.layersStyles || {};
  90548. layerInfo_simple = me.layersStyles[layerName];
  90549. if (layerInfo_simple) {
  90550. return layerInfo_simple;
  90551. }
  90552. if (!me.layersInfo) {
  90553. return {};
  90554. }
  90555. var layerInfo = me.layersInfo[layerName];
  90556. if (!layerInfo) {
  90557. return null;
  90558. }
  90559. layerInfo_simple = {
  90560. layerIndex: layerInfo.layerIndex,
  90561. ugcLayerType: layerInfo.ugcLayerType
  90562. };
  90563. switch (layerInfo.ugcLayerType) {
  90564. case "VECTOR":
  90565. layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
  90566. break;
  90567. case "THEME":
  90568. var theme = layerInfo.theme;
  90569. //标注图层特别标明
  90570. layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
  90571. if (theme && theme.type === "LABEL") {
  90572. layerInfo_simple.type = theme.type;
  90573. layerInfo_simple.textField = theme.labelExpression;
  90574. }
  90575. break;
  90576. default:
  90577. //SVTile发布出来的地图没有ugcLayerType属性
  90578. if (layerInfo.style) {
  90579. layerInfo_simple.layerStyle = layerInfo.style;
  90580. }
  90581. break;
  90582. }
  90583. me.layersStyles[layerName] = layerInfo_simple;
  90584. return layerInfo_simple;
  90585. },
  90586. /*
  90587. * @function TiledVectorLayer.prototype.getVectorStylesFromServer
  90588. * @description 等待服务器的 carto 返回之后拼接本地配置的 cartoCSS, 并调用 onAdd 出图。
  90589. */
  90590. getVectorStylesFromServer: function () {
  90591. var me = this;
  90592. var vectorStyleUrl = Util_Util.urlPathAppend(me.url, "tileFeature/vectorstyles");
  90593. FetchRequest.get(SecurityManager.appendCredential(vectorStyleUrl), null, {
  90594. timeout: me.options.timeout
  90595. }).then(function (response) {
  90596. return response.json()
  90597. }).then(function (styles) {
  90598. if (!styles || !styles.style) {
  90599. return null;
  90600. }
  90601. if (styles.style && styles.type === 'cartoCSS') {
  90602. me.setServerCartoCSS(styles.style);
  90603. }
  90604. if (me.options) {
  90605. me.setClientCartoCSS(me.options.cartoCSS);
  90606. }
  90607. me._initGrid();
  90608. }).catch(function (ex) {
  90609. console.error('error', ex)
  90610. });
  90611. },
  90612. /**
  90613. * @private
  90614. * @function TiledVectorLayer.prototype.setServerCartoCSS
  90615. * @description 设置服务端获取到的 cartoCSS 样式, cartoCSS 请求回来之后自动调用。
  90616. */
  90617. setServerCartoCSS: function (cartoCSSStr) {
  90618. this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, true);
  90619. },
  90620. /**
  90621. * @function TiledVectorLayer.prototype.setClientCartoCSS
  90622. * @description 客户端设置 cartoCSS 样式。
  90623. */
  90624. setClientCartoCSS: function (cartoCSSStr) {
  90625. let processCharacters = false;
  90626. if (this.options.processCharacters) {
  90627. processCharacters = this.options.processCharacters;
  90628. }
  90629. this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, processCharacters);
  90630. },
  90631. /**
  90632. * @private
  90633. * @function TiledVectorLayer.prototype.getVectorTileLayerStyle
  90634. * @description 获取图层风格信息,当 CartoCSS 中包含有对该图层的渲染信息时,优先获取,否则获取图层资源下图层样式的渲染信息。
  90635. * @param {Object} coords - 图层坐标参数对象。
  90636. * @param {Object} feature - 需要获取的要素。
  90637. */
  90638. getVectorTileLayerStyle: function (coords, feature) {
  90639. if (!feature) {
  90640. return null;
  90641. }
  90642. var me = this,
  90643. layerName = feature.layerName,
  90644. layerStyleInfo = me.getLayerStyleInfo(layerName);
  90645. //处理标签图层
  90646. if (layerStyleInfo && layerStyleInfo.textField) {
  90647. var textField = layerStyleInfo.textField;
  90648. if (textField && textField.indexOf('.')) {
  90649. var arr = textField.split('.');
  90650. textField = arr && arr.length > 0 && arr[arr.length - 1];
  90651. }
  90652. feature.properties.textField = textField;
  90653. }
  90654. me.vectorTileLayerStyles = me.vectorTileLayerStyles || {};
  90655. var style = me.vectorTileLayerStyles[layerName];
  90656. if (style) {
  90657. feature = this._mergeFeatureTextField(feature, style);
  90658. return style;
  90659. }
  90660. // CartoCSSToLeaflet内部做了客户端配置的cartoCSS和服务端cartoCSS的拼接处理
  90661. // 客户端配置的cartoCSS会覆盖相应图层的服务端cartoCSS
  90662. var scale = this.getScaleFromCoords(coords);
  90663. var shaders = this.cartoCSSToLeaflet.pickShader(layerName) || [];
  90664. style = [];
  90665. for (var itemKey in shaders) {
  90666. var shader = shaders[itemKey];
  90667. for (var j = 0; j < shader.length; j++) {
  90668. var serverStyle = this.cartoCSSToLeaflet.getValidStyleFromCarto(coords.z, scale, shader[j], feature,this.options.serverCartoCSSStyle);
  90669. if (serverStyle) {
  90670. style.push(serverStyle);
  90671. }
  90672. }
  90673. }
  90674. feature = this._mergeFeatureTextField(feature, style);
  90675. //次优先级是layers资源的默认的样式,最低优先级是CartoDefaultStyle的样式
  90676. if (feature.type === "TEXT" || style.length === 0) {
  90677. style = this.cartoCSSToLeaflet.getValidStyleFromLayerInfo(feature, layerStyleInfo);
  90678. if (feature.type === "TEXT") {
  90679. style.textName = "[" + feature.properties.textField + "]";
  90680. }
  90681. }
  90682. me.vectorTileLayerStyles[layerName] = style;
  90683. return style;
  90684. },
  90685. /**
  90686. * @function TiledVectorLayer.prototype.getScale
  90687. * @description 通过缩放级别获取比例尺。
  90688. * @param {number} zoom - 缩放级别。
  90689. * @returns {number} 比例尺。
  90690. */
  90691. getScale: function (zoom) {
  90692. var me = this;
  90693. //返回当前比例尺
  90694. var z = zoom || me._map.getZoom();
  90695. return me.scales[z];
  90696. },
  90697. /**
  90698. * @function TiledVectorLayer.prototype.getScaleFromCoords
  90699. * @description 通过行列号获取比例尺。
  90700. * @param {Object} coords - 行列号。
  90701. * @returns {number} 比例尺。
  90702. */
  90703. getScaleFromCoords: function (coords) {
  90704. var me = this,
  90705. scale;
  90706. if (me.scales && me.scales[coords.z]) {
  90707. return me.scales[coords.z];
  90708. }
  90709. me.scales = me.scales || {};
  90710. scale = me.getDefaultScale(coords);
  90711. me.scales[coords.z] = scale;
  90712. return scale;
  90713. },
  90714. /**
  90715. * @private
  90716. * @function TiledVectorLayer.prototype.getDefaultScale
  90717. * @description 根据行列号获取默认比例尺。
  90718. * @param {Object} coords - 行列号。
  90719. * @returns {number} 默认比例尺。
  90720. */
  90721. getDefaultScale: function (coords) {
  90722. var me = this,
  90723. crs = me._crs;
  90724. if (crs.scales) {
  90725. return crs.scales[coords.z];
  90726. } else {
  90727. var tileBounds = me._tileCoordsToBounds(coords);
  90728. var ne = crs.project(tileBounds.getNorthEast());
  90729. var sw = crs.project(tileBounds.getSouthWest());
  90730. var tileSize = me.options.tileSize;
  90731. var resolution = Math.max(
  90732. Math.abs(ne.x - sw.x) / tileSize,
  90733. Math.abs(ne.y - sw.y) / tileSize
  90734. );
  90735. var mapUnit = Unit.METER;
  90736. if (crs.code) {
  90737. var array = crs.code.split(':');
  90738. if (array && array.length > 1) {
  90739. var code = parseInt(array[1]);
  90740. mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
  90741. }
  90742. }
  90743. return resolutionToScale(resolution, 96, mapUnit);
  90744. }
  90745. },
  90746. _mergeFeatureTextField: function (feature, style) {
  90747. //如果设置了使用服务端cartocss样式,则文本专题图图层优先从carto中读取文本字段的key
  90748. if (!this.options.serverCartoCSSStyle || !style || feature.type !== "TEXT") {
  90749. return feature;
  90750. }
  90751. var tempStyle = style;
  90752. if (!external_L_default().Util.isArray(style)) {
  90753. tempStyle = [style];
  90754. }
  90755. for (var i = 0; i < tempStyle.length; i++) {
  90756. var textName = tempStyle[i].textName;
  90757. if (textName && feature.properties) {
  90758. feature.properties.textField = textName.substring(1, textName.length - 1);
  90759. }
  90760. }
  90761. return feature;
  90762. },
  90763. _getTileUrl: function (coords) {
  90764. var me = this,
  90765. tileTemplate = me.options.tileTemplate;
  90766. if (!tileTemplate) {
  90767. return me._getDefaultTileUrl(coords);
  90768. }
  90769. return me._getTileTemplateUrl(coords)
  90770. },
  90771. _getTileTemplateUrl: function (coords) {
  90772. var me = this,
  90773. tileTemplate = me.options.tileTemplate;
  90774. var data = {
  90775. s: me._getSubdomain(coords),
  90776. x: coords.x,
  90777. y: coords.y,
  90778. z: coords.z
  90779. };
  90780. if (me._map && !me._map.options.crs.infinite) {
  90781. var invertedY = me._globalTileRange.max.y - coords.y;
  90782. if (me.options.tms) {
  90783. data['y'] = invertedY;
  90784. }
  90785. data['-y'] = invertedY;
  90786. }
  90787. var tileUrl = external_L_default().Util.template(tileTemplate, external_L_default().extend(data, me.options));
  90788. return tileUrl;
  90789. },
  90790. _initGrid: function () {
  90791. VectorGrid.prototype.onAdd.call(this, this._map);
  90792. },
  90793. _getSubdomain: (external_L_default()).TileLayer.prototype._getSubdomain,
  90794. _getDefaultTileUrl: function (coords) {
  90795. var x = coords.x,
  90796. y = coords.y;
  90797. var tileUrl = this._tileUrl + "&x=" + x + "&y=" + y;
  90798. var scale = this.getScaleFromCoords(coords);
  90799. tileUrl += "&scale=" + scale;
  90800. return tileUrl;
  90801. },
  90802. _initLayerUrl: function () {
  90803. var options = this.options;
  90804. if (!this.url) {
  90805. return;
  90806. }
  90807. var format = options.format.toString().toLowerCase();
  90808. this._tileUrl = Util_Util.urlPathAppend(this.url, "tileFeature." + format );
  90809. this._tileUrl = Util_Util.urlAppend(this._tileUrl, encodeURI(this._createURLParam(options)));
  90810. },
  90811. _createURLParam: function (options) {
  90812. var params = [];
  90813. //添加安全认证信息
  90814. var credential = this._getCredential(this._tileUrl);
  90815. if (credential) {
  90816. params.push(credential);
  90817. }
  90818. if (options.layersID) {
  90819. params.push("layersID=" + options.layersID);
  90820. }
  90821. if (options.layerNames) {
  90822. if (!external_L_default().Util.isArray(options.layerNames)) {
  90823. options.layerNames = [options.layerNames];
  90824. }
  90825. var layerNamesString = '[' + options.layerNames.join(',') + ']';
  90826. params.push("layerNames=" + layerNamesString);
  90827. }
  90828. //切片的起始参考点,默认为地图范围的左上角。
  90829. var crs = this._crs;
  90830. if (crs.options && crs.options.origin) {
  90831. params.push("origin=" + JSON.stringify({
  90832. x: crs.options.origin[0],
  90833. y: crs.options.origin[1]
  90834. }));
  90835. } else if (crs.projection && crs.projection.bounds) {
  90836. var bounds = crs.projection.bounds;
  90837. var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
  90838. params.push("origin=" + JSON.stringify({
  90839. x: tileOrigin.x,
  90840. y: tileOrigin.y
  90841. }));
  90842. }
  90843. if (options.expands) {
  90844. params.push("expands=" + options.expands);
  90845. }
  90846. params.push("returnAttributes=" + options.returnAttributes);
  90847. params.push("cacheEnabled=" + options.cacheEnabled);
  90848. var tileSize = this.options.tileSize;
  90849. params.push("width=" + tileSize);
  90850. params.push("height=" + tileSize);
  90851. return params.join("&");
  90852. },
  90853. //获取token或key表达式
  90854. _getCredential: function (url) {
  90855. var value = SecurityManager.getToken(url);
  90856. var credential = value ? new Credential(value, 'token') || new Credential(value, 'key') : null;
  90857. if (credential) {
  90858. return credential.getUrlParameters();
  90859. }
  90860. return null;
  90861. }
  90862. });
  90863. var tiledVectorLayer = function (url, options) {
  90864. return new TiledVectorLayer(url, options);
  90865. };
  90866. ;// CONCATENATED MODULE: external "function(){try{return turf}catch(e){return {}}}()"
  90867. const external_function_try_return_turf_catch_e_return_namespaceObject = function(){try{return turf}catch(e){return {}}}();
  90868. ;// CONCATENATED MODULE: ./src/leaflet/overlay/TurfLayer.js
  90869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90870. * This program are made available under the terms of the Apache License, Version 2.0
  90871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90872. /**
  90873. * @class TurfLayer
  90874. * @deprecatedclassinstance L.supermap.turfLayer
  90875. * @classdesc Turf 图层类。
  90876. * @category Visualization Turf
  90877. * @modulecategory Overlay
  90878. * @extends {L.Layer}
  90879. * @param {Object} options - 参数。
  90880. * @param {string} [options.attribution='<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>'] - 版权信息。
  90881. * @usage
  90882. */
  90883. var TurfLayer = external_L_default().GeoJSON.extend({
  90884. turfMap: {
  90885. "Measurement.along": ["line", "distance", "units"],
  90886. "Measurement.area": ["geojson"],
  90887. "Measurement.bbox": ["geojson"],
  90888. "Measurement.bboxPolygon": ["bbox"],
  90889. "Measurement.bearing": ["start", "end", "final"],
  90890. "Measurement.center": ["geojson", "properties"],
  90891. "Measurement.centerOfMass": ["geojson", "properties"],
  90892. "Measurement.centroid": ["geojson", "properties"],
  90893. "Measurement.destination": ["origin", "distance", "bearing", "units"],
  90894. "Measurement.distance": ["from", "to", "units"],
  90895. "Measurement.envelope": ["geojson"],
  90896. "Measurement.length": ["geojson", "units"],
  90897. "Measurement.midpoint": ["point1", "point2"],
  90898. "Measurement.pointOnFeature": ["geojson"],
  90899. "Measurement.polygonTangents": ["point", "polygon"],
  90900. "Measurement.rhumbBearing": ["start", "end", "final"],
  90901. "Measurement.rhumbDestination": ["origin", "distance", "bearing", "units"],
  90902. "Measurement.rhumbDistance": ["from", "to", "units"],
  90903. "Measurement.square": ["bbox"],
  90904. "Measurement.greatCircle": ["start", "end", "properties", "npoints", "offset"],
  90905. "CoordinateMutation.cleanCoords": ["geojson", "mutate"],
  90906. "CoordinateMutation.flip": ["geojson", "mutate"],
  90907. "CoordinateMutation.rewind": ["geojson", "reverse", "mutate"],
  90908. "CoordinateMutation.round": ["num", "precision"],
  90909. "CoordinateMutation.truncate": ["geojson", "precision", "coordinates", "mutate"],
  90910. "Transformation.bboxClip": ["feature", "bbox"],
  90911. "Transformation.bezierSpline": ["line", "resolution", "sharpness"],
  90912. "Transformation.buffer": ["geojson", "radius", "units", "steps"],
  90913. "Transformation.circle": ["center", "radius", "steps", "units", "properties"],
  90914. "Transformation.clone": ["geojson"],
  90915. "Transformation.concave": ["points", "maxEdge", "units"],
  90916. "Transformation.convex": ["geojson", "concavity"],
  90917. "Transformation.difference": ["polygon1", "polygon2"],
  90918. "Transformation.dissolve": ["featureCollection", "propertyName"],
  90919. "Transformation.intersect": ["poly1", "poly2"],
  90920. "Transformation.lineOffset": ["geojson", "distance", "units"],
  90921. "Transformation.simplify": ["feature", "tolerance", "highQuality"],
  90922. "Transformation.tesselate": ["poly"],
  90923. "Transformation.transformRotate": ["geojson", "angle", "pivot", "mutate"],
  90924. "Transformation.transformTranslate": ["geojson", "distance", "direction", "units", "zTranslation", "mutate"],
  90925. "Transformation.transformScale": ["geojson", "factor", "origin", "mutate"],
  90926. "Transformation.union": ["A"],
  90927. "Transformation.voronoi": ["points", "bbox"],
  90928. "featureConversion.combine": ["fc"],
  90929. "featureConversion.explode": ["geojson"],
  90930. "featureConversion.flatten": ["geojson"],
  90931. "featureConversion.lineStringToPolygon": ["lines", "properties", "autoComplete", "orderCoords"],
  90932. "featureConversion.polygonize": ["geojson"],
  90933. "featureConversion.polygonToLineString": ["polygon", "properties"],
  90934. "Misc.kinks": ["featureIn"],
  90935. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  90936. "Misc.lineChunk": ["geojson", "segmentLength", "units", "reverse"],
  90937. "Misc.lineIntersect": ["line1", "line2"],
  90938. "Misc.lineOverlap": ["line1", "line2"],
  90939. "Misc.lineSegment": ["geojson"],
  90940. "Misc.lineSlice": ["startPt", "stopPt", "line"],
  90941. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", "units"],
  90942. "Misc.lineSplit": ["line", "splitter"],
  90943. "Misc.mask": ["polygon", "mask"],
  90944. "Misc.pointOnLine": ["lines", "pt", "units"],
  90945. "Misc.sector": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  90946. "Misc.shortestPath": ["start", "end", "obstacles", "units", "resolution"],
  90947. "Misc.unkinkPolygon": ["geojson"],
  90948. "Helper.featureCollection": ["features", "bbox", "id"],
  90949. "Helper.feature": ["geometry", "properties", "bbox", "id"],
  90950. "Helper.geometryCollection": ["geometries", "properties", "bbox", "id"],
  90951. "Helper.lineString": ["coordinates", "properties", "bbox", "id"],
  90952. "Helper.multiLineString": ["coordinates", "properties", "bbox", "id"],
  90953. "Helper.multiPoint": ["coordinates", "properties", "bbox", "id"],
  90954. "Helper.multiPolygon": ["coordinates", "properties", "bbox", "id"],
  90955. "Helper.point": ["coordinates", "properties", "bbox", "id"],
  90956. "Helper.polygon": ["coordinates", "properties", "bbox", "id"],
  90957. "Data.sample": ["featurecollection", "num"],
  90958. "Interpolation.interpolate": ["points", "cellSize", "gridType", "property", "units", "weight"],
  90959. "Interpolation.isobands": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  90960. "Interpolation.isolines": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  90961. "Interpolation.planepoint": ["point", "triangle"],
  90962. "Interpolation.tin": ["points", "z"],
  90963. "Joins.pointsWithinPolygon": ["points", "polygons"],
  90964. "Joins.tag": ["points", "polygons", "field", "outField", "mask", "properties"],
  90965. "Grids.hexGrid": ["bbox", "cellSide", "units", "triangles"],
  90966. "Grids.pointGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  90967. "Grids.squareGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  90968. "Grids.triangleGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  90969. "Classification.nearestPoint": ["targetPoint", "points"],
  90970. "Aggregation.collect": ["polygons", "points", "inProperty", "outProperty"],
  90971. "Aggregation.clustersDbscan": ["points", "maxDistance", "units", "minPoints", "mutate"],
  90972. "Aggregation.clustersKmeans": ["points", "numberOfClusters", "mutate"],
  90973. "Meta.coordAll": ["geojson"],
  90974. "Meta.coordEach": ["geojson", "callback", "excludeWrapCoord"],
  90975. "Meta.coordReduce": ["geojson", "callback", "initialValue", "excludeWrapCoord"],
  90976. "Meta.featureEach": ["geojson", "callback"],
  90977. "Meta.featureReduce": ["geojson", "callback", "initialValue"],
  90978. "Meta.flattenEach": ["geojson", "callback"],
  90979. "Meta.flattenReduce": ["geojson", "callback", "initialValue"],
  90980. "Meta.getCoord": ["coord"],
  90981. "Meta.getCoords": ["coords"],
  90982. "Meta.getGeom": ["geojson"],
  90983. "Meta.getGeomType": ["geojson", "name"],
  90984. "Meta.geomEach": ["geojson", "callback"],
  90985. "Meta.geomReduce": ["geojson", "callback", "initialValue"],
  90986. "Meta.propEach": ["geojson", "callback"],
  90987. "Meta.propReduce": ["geojson", "callback", "initialValue"],
  90988. "Meta.segmentEach": ["geojson", "callback"],
  90989. "Meta.segmentReduce": ["geojson", "callback", "initialValue"],
  90990. "Meta.getCluster": ["geojson", "filter"],
  90991. "Meta.clusterEach": ["geojson", "property", "callback"],
  90992. "Meta.clusterReduce": ["geojson", "property", "callback", "initialValue"],
  90993. "Assertions.collectionOf": ["featureCollection", "type", "name"],
  90994. "Assertions.containsNumber": ["coordinates"],
  90995. "Assertions.geojsonType": ["value", "type", "name"],
  90996. "Assertions.featureOf": ["feature", "type", "name"],
  90997. "Booleans.booleanClockwise": ["line"],
  90998. "Booleans.booleanContains": ["feature1", "feature2"],
  90999. "Booleans.booleanCrosses": ["feature1", "feature2"],
  91000. "Booleans.booleanDisjoint": ["feature1", "feature2"],
  91001. "Booleans.booleanEqual": ["feature1", "feature2"],
  91002. "Booleans.booleanOverlap": ["feature1", "feature2"],
  91003. "Booleans.booleanParallel": ["feature1", "feature2"],
  91004. "Booleans.booleanPointInPolygon": ["point", "polygon", "ignoreBoundary"],
  91005. "Booleans.booleanPointOnLine": ["point", "linestring", "ignoreEndVertices"],
  91006. "UnitConversion.bearingToAngle": ["bearing"],
  91007. "UnitConversion.convertArea": ["area", "originalUnit", "finalUnit"],
  91008. "UnitConversion.convertLength": ["length", "originalUnit", "finalUnit"],
  91009. "UnitConversion.degreesToradians": ["degrees"],
  91010. "UnitConversion.lengthToRadians": ["distance", "units"],
  91011. "UnitConversion.lengthToDegrees": ["distance", "units"],
  91012. "UnitConversion.radiansToLength": ["radians", "units"],
  91013. "UnitConversion.radiansToDegrees": ["radians"],
  91014. "UnitConversion.toMercator": ["geojson", "mutate"],
  91015. "UnitConversion.toWgs84": ["geojson", "mutate"]
  91016. },
  91017. options: {
  91018. attribution: core_Attributions.Turf.attribution
  91019. },
  91020. initialize: function (options) {
  91021. options = options || {};
  91022. external_L_default().Util.setOptions(this, options);
  91023. external_L_default().stamp(this);
  91024. this._layers = {};
  91025. },
  91026. // 5.0.0 及以上版本参数配置
  91027. turfOptionMap: {
  91028. "Measurement.along": ["line", "distance", {units: ""}],
  91029. "Measurement.bboxPolygon": ["bbox", {properties: "", id: ""}],
  91030. "Measurement.bearing": ["start", "end", {final: ""}],
  91031. "Measurement.center": ["geojson", {properties: ""}],
  91032. "Measurement.destination": ["origin", "distance", "bearing", {units: "", properties: ""}],
  91033. "Measurement.distance": ["from", "to", {units: ""}],
  91034. "Measurement.length": ["geojson", {units: ""}],
  91035. "Measurement.rhumbBearing": ["start", "end", {final: ""}],
  91036. "Measurement.rhumbDestination": ["origin", "distance", "bearing", {units: "", properties: ""}],
  91037. "Measurement.rhumbDistance": ["from", "to", {units: ""}],
  91038. "Measurement.greatCircle": ["start", "end", {properties: "", npoints: "", offset: ""}],
  91039. "CoordinateMutation.cleanCoords": ["geojson", {mutate: ""}],
  91040. "CoordinateMutation.flip": ["geojson", {mutate: ""}],
  91041. "CoordinateMutation.rewind": ["geojson", {mutate: "", reverse: ""}],
  91042. "CoordinateMutation.truncate": ["geojson", {precision: "", coordinates: "", mutate: ""}],
  91043. "Transformation.bezierSpline": ["line", {resolution: "", sharpness: ""}],
  91044. "Transformation.buffer": ["geojson", "radius", {units: "", steps: ""}],
  91045. "Transformation.circle": ["center", "radius", {units: "", steps: "", properties: ""}],
  91046. "Transformation.concave": ["points", {maxEdge: "", units: ""}],
  91047. "Transformation.convex": ["geojson", {concavity: ""}],
  91048. "Transformation.dissolve": ["featureCollection", {propertyName: ""}],
  91049. "Transformation.lineOffset": ["geojson", "distance", {units: ""}],
  91050. "Transformation.simplify": ["geojson", {tolerance: "", highQuality: ""}],
  91051. "Transformation.transformRotate": ["geojson", "angle", {pivot: "", mutate: ""}],
  91052. "Transformation.transformTranslate": ["geojson", "distance", "direction", {
  91053. units: "",
  91054. zTranslation: "",
  91055. mutate: ""
  91056. }],
  91057. "Transformation.transformScale": ["geojson", "factor", {origin: "", mutate: ""}],
  91058. "Transformation.voronoi": ["points", {bbox: ""}],
  91059. "featureConversion.lineStringToPolygon": ["lines", {properties: "", autoComplete: "", orderCoords: ""}],
  91060. "featureConversion.polygonToLineString": ["polygon", {properties: ""}],
  91061. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", {steps: "", units: ""}],
  91062. "Misc.lineChunk": ["geojson", "segmentLength", {units: "", reverse: ""}],
  91063. "Misc.lineOverlap": ["line1", "line2", {tolerance: ""}],
  91064. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", {units: ""}],
  91065. "Misc.pointOnLine": ["lines", "pt", {units: ""}],
  91066. "Misc.sector": ["center", "radius", "bearing1", "bearing2", {units: "", steps: "", properties: ""}],
  91067. "Misc.shortestPath": ["start", "end", {obstacles: "", units: "", resolution: ""}],
  91068. "Helper.feature": ["geometry", "properties", {bbox: "", id: ""}],
  91069. "Helper.geometryCollection": ["geometries", "properties", {bbox: "", id: ""}],
  91070. "Helper.lineString": ["coordinates", "properties", {bbox: "", id: ""}],
  91071. "Helper.multiLineString": ["coordinates", "properties", {bbox: "", id: ""}],
  91072. "Helper.multiPoint": ["coordinates", "properties", {bbox: "", id: ""}],
  91073. "Helper.multiPolygon": ["coordinates", "properties", {bbox: "", id: ""}],
  91074. "Helper.point": ["coordinates", "properties", {bbox: "", id: ""}],
  91075. "Helper.polygon": ["coordinates", "properties", {bbox: "", id: ""}],
  91076. "Interpolation.interpolate": ["points", "cellSize", {gridType: "", property: "", units: "", weight: ""}],
  91077. "Interpolation.isobands": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
  91078. "Interpolation.isolines": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
  91079. "Grids.hexGrid": ["bbox", "cellSide", {units: "", triangles: "", properties: "", mask: ""}],
  91080. "Grids.pointGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  91081. "Grids.squareGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  91082. "Grids.triangleGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  91083. "Aggregation.clustersDbscan": ["points", "maxDistance", {units: "", minPoints: "", mutate: ""}],
  91084. "Aggregation.clustersKmeans": ["points", {numberOfClusters: "", mutate: ""}],
  91085. "Booleans.booleanPointInPolygon": ["point", "polygon", {ignoreBoundary: ""}],
  91086. "Booleans.booleanPointOnLine": ["point", "linestring", {ignoreEndVertices: ""}],
  91087. "UnitConversion.toMercator": ["geojson", {mutate: ""}],
  91088. "UnitConversion.toWgs84": ["geojson", {mutate: ""}]
  91089. },
  91090. /**
  91091. * @function TurfLayer.prototype.process
  91092. * @description 执行 Turf.js 提供的相关空间分析方法。
  91093. * @param {string} type - Turf.js 提供的空间分析方法名。
  91094. * @param {Object} args - Turf.js 提供的空间分析方法对应的参数对象。
  91095. * @param {function} callback - 空间分析完成执行的回调函数,返回执行的结果。
  91096. * @param {boolean} [addFeaturesToMap=true] - 是否添加到地图。
  91097. */
  91098. process: function (type, args, callback, addFeaturesToMap) {
  91099. // 兼容版本4到5
  91100. var result;
  91101. try {
  91102. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parse(type, args));
  91103. } catch (e) {
  91104. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parseOption(type, args));
  91105. }
  91106. addFeaturesToMap = addFeaturesToMap == null ? true : addFeaturesToMap;
  91107. if (addFeaturesToMap) {
  91108. this.addData([result]);
  91109. }
  91110. if (callback) {
  91111. callback(result);
  91112. }
  91113. },
  91114. parse: function (type, args) {
  91115. if (type === 'Transformation.union') {
  91116. return args['A'];
  91117. }
  91118. var result = [];
  91119. var tempArgs = this.turfMap[type];
  91120. if (tempArgs) {
  91121. tempArgs.map(function (key) {
  91122. result.push(args[key]);
  91123. return args[key];
  91124. });
  91125. }
  91126. return result;
  91127. },
  91128. parseOption(type, args) {
  91129. var result = [];
  91130. var tempArgs = this.turfOptionMap[type];
  91131. tempArgs.map(function (key) {
  91132. if (key instanceof Object) {
  91133. var options = key;
  91134. Object.keys(options).forEach(function (k) {
  91135. options[k] = args[k]
  91136. })
  91137. result.push(options);
  91138. } else {
  91139. result.push(args[key])
  91140. }
  91141. return args;
  91142. })
  91143. return result;
  91144. }
  91145. });
  91146. var turfLayer = function (options) {
  91147. return new TurfLayer(options);
  91148. };
  91149. ;// CONCATENATED MODULE: ./src/leaflet/overlay/HeatMapLayer.js
  91150. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  91151. * This program are made available under the terms of the Apache License, Version 2.0
  91152. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  91153. /**
  91154. * @class HeatMapFeature
  91155. * @deprecatedclassinstance L.supermap.heatMapFeature
  91156. * @category Visualization HeatMap
  91157. * @classdesc 客户端专题图要素类。
  91158. * 支持的 geometry 参数类型为 {@link L.Point}、{@link L.LatLng}、{@link L.CircleMarker}。
  91159. * @modulecategory Overlay
  91160. * @extends {L.Class}
  91161. * @param {(L.Point|L.LatLng|L.CircleMarker)} geometry - 要素图形。
  91162. * @param {Object} attributes - 要素属性。
  91163. * @usage
  91164. */
  91165. var HeatMapFeature = external_L_default().Class.extend({
  91166. initialize: function (geometry, attributes) {
  91167. this.geometry = geometry;
  91168. this.attributes = attributes;
  91169. },
  91170. /**
  91171. * @function HeatMapFeature.prototype.toFeature
  91172. * @description 转为内部矢量要素。
  91173. * @returns {FeatureVector} 内部矢量要素。
  91174. */
  91175. toFeature: function () {
  91176. var geometry = this.geometry;
  91177. var points = [];
  91178. if (geometry instanceof (external_L_default()).LatLng) {
  91179. points = [geometry.lng, geometry.lat];
  91180. } else if (geometry instanceof (external_L_default()).Point) {
  91181. points = [geometry.x, geometry.y];
  91182. } else if (geometry instanceof (external_L_default()).CircleMarker) {
  91183. var latLng = geometry.getLatLng();
  91184. points = [latLng.lng, latLng.lat];
  91185. } else {
  91186. points = geometry;
  91187. }
  91188. if (points.length === 2) {
  91189. geometry = new Point(points[0], points[1]);
  91190. }
  91191. return new Vector(geometry, this.attributes);
  91192. }
  91193. });
  91194. var heatMapFeature = function (geometry, attributes) {
  91195. return new HeatMapFeature(geometry, attributes);
  91196. };
  91197. /**
  91198. * @class HeatMapLayer
  91199. * @classdesc 热力图层类。
  91200. * @category Visualization HeatMap
  91201. * @param {string} name - 图层名称。
  91202. * @param {boolean} [loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
  91203. * @param {Object} options - 构造参数。
  91204. * @param {L.Map} options.map - Leaflet Map 对象。
  91205. * @param {string} [options.id] - 专题图层 ID,默认使用 CommonUtil.createUniqueID("heatMapLayer_") 创建专题图层 ID。
  91206. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  91207. * @param {string} [options.featureWeight] - 对应 feature 属性中的热点权重字段名称,权重值类型为 number。
  91208. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit 参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  91209. * @param {number} [options.opacity=1] - 图层透明度。
  91210. * @param {Array.<string>} [options.colors=['blue', 'cyan', 'lime', 'yellow', 'red']] - 颜色线性渐变数组,颜色值必须为 canvas 所支持的。
  91211. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  91212. * @param {number} [options.blur] - 模糊量,单位为 px。默认值为半径的二分之一。
  91213. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  91214. *
  91215. * @extends {L.Layer}
  91216. * @fires HeatMapLayer#featuresremoved
  91217. * @fires HeatMapLayer#changelayer
  91218. * @usage
  91219. */
  91220. var HeatMapLayer = external_L_default().Layer.extend({
  91221. options: {
  91222. //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
  91223. alwaysMapCRS: false,
  91224. //热力图默认参数:
  91225. id: Util_Util.createUniqueID("heatMapLayer_"),
  91226. featureWeight: null,
  91227. opacity: 1,
  91228. colors: ['blue', 'cyan', 'lime', 'yellow', 'red'],
  91229. useGeoUnit: false,
  91230. radius: 50,
  91231. attribution: core_Attributions.Common.attribution
  91232. },
  91233. initialize: function (name, options) {
  91234. external_L_default().Util.setOptions(this, options);
  91235. this.name = name;
  91236. this.features = [];
  91237. this.maxWeight = null;
  91238. this.minWeight = null;
  91239. this.rootCanvas = null;
  91240. this.canvasContext = null;
  91241. this.maxWidth = null;
  91242. this.maxHeight = null;
  91243. //热力图参数:
  91244. this.id = this.options.id;
  91245. /*
  91246. * options.featureWeight对应 feature 属性中的热点权重字段名称,权重值类型为float
  91247. * //例如:
  91248. * //feature.attributes中表示权重的字段为height,则在HeatMapLayer的featureWeight参数赋值为"height"
  91249. * feature1.attributes.height = 7.0;
  91250. * feature2.attributes.height = 6.0;
  91251. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  91252. * heatMapLayer.addFeatures([feature1,feature2]);
  91253. * @type {null}
  91254. */
  91255. this.featureWeight = this.options.featureWeight;
  91256. this.colors = this.options.colors;
  91257. this.useGeoUnit = this.options.useGeoUnit;
  91258. this.opacity = this.options.opacity;
  91259. this.radius = this.options.radius;
  91260. this.blur = this.options.blur;
  91261. this.movingOffset = [0, 0];
  91262. },
  91263. /**
  91264. * @function HeatMapLayer.prototype.onRemove
  91265. * @description 删除某个地图。
  91266. * @param {L.Map} map - Leaflet Map 对象。
  91267. * @private
  91268. */
  91269. onRemove: function (map) {
  91270. var me = this;
  91271. external_L_default().DomUtil.remove(me.rootCanvas);
  91272. map.off("mousemove", me.mouseMoveHandler);
  91273. },
  91274. /**
  91275. * @function HeatMapLayer.prototype.onAdd
  91276. * @description 添加专题图。
  91277. * @param {L.Map} map - Leaflet Map 对象。
  91278. * @private
  91279. */
  91280. onAdd: function (map) {
  91281. var me = this;
  91282. me._map = map;
  91283. me._createCanvasContainer();
  91284. if (!me.rootCanvas) {
  91285. map.removeLayer(me);
  91286. return;
  91287. }
  91288. //初始化渲染器
  91289. var size = map.getSize();
  91290. me.rootCanvas.width = me.maxWidth = size.x;
  91291. me.rootCanvas.height = me.maxHeight = size.y;
  91292. me._updateOpacity();
  91293. me.mouseMoveHandler = function (e) {
  91294. var xy = e.layerPoint;
  91295. me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
  91296. };
  91297. map.on("mousemove", me.mouseMoveHandler);
  91298. me.update();
  91299. },
  91300. /**
  91301. * @function HeatMapLayer.prototype.addFeatures
  91302. * @description 添加热点信息。
  91303. * @param {(GeoJSONObject|HeatMapFeature)} features - 待添加的要素数组。
  91304. *
  91305. * @example
  91306. * var geojson = {
  91307. * "type": "FeatureCollection",
  91308. * "features": [
  91309. * {
  91310. * "type": "feature",
  91311. * "geometry": {
  91312. * "type": "Point", //只支持point类型
  91313. * "coordinates": [0, 0]
  91314. * },
  91315. * "properties": {
  91316. * "height": Math.random()*9,
  91317. * "geoRadius": useGeoRadius?radius:null
  91318. * }
  91319. * }
  91320. * ]
  91321. * };
  91322. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"id":"heatmap"});
  91323. * heatMapLayer.addFeatures(geojson);
  91324. */
  91325. addFeatures: function (features) {
  91326. this.features = this.toiClientFeature(features);
  91327. this.refresh();
  91328. },
  91329. /**
  91330. * @function HeatMapLayer.prototype.refresh
  91331. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  91332. */
  91333. refresh: function () {
  91334. if (this.features.length === 0) {
  91335. return;
  91336. }
  91337. if (this._map) {
  91338. var extent = this._map.getBounds();
  91339. this.updateHeatPoints(extent);
  91340. }
  91341. },
  91342. /**
  91343. * @function HeatMapLayer.prototype.updateHeatPoints
  91344. * @description 刷新热点图显示。
  91345. * @param {L.LatLngBounds} bounds - 当前显示范围。
  91346. */
  91347. updateHeatPoints: function (bounds) {
  91348. if (this.features && this.features.length > 0) {
  91349. this.convertFastToPixelPoints(bounds);
  91350. } else {
  91351. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  91352. }
  91353. },
  91354. /**
  91355. * @function HeatMapLayer.prototype.convertFastToPixelPoints
  91356. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  91357. * @param {L.LatLngBounds} bounds - 当前显示范围。
  91358. * @private
  91359. */
  91360. convertFastToPixelPoints: function (bounds) {
  91361. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  91362. //获取当前像素下的地理范围
  91363. var dw = bounds.getEast() - bounds.getWest();
  91364. var dh = bounds.getNorth() - bounds.getSouth();
  91365. var mapCanvas = this._map.getSize();
  91366. if (dw / mapCanvas.x > dh / mapCanvas.y) {
  91367. resolution = dw / mapCanvas.x;
  91368. } else {
  91369. resolution = dh / mapCanvas.y;
  91370. }
  91371. //热点半径
  91372. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  91373. for (var i = 0; i < this.features.length; i++) {
  91374. var feature = this.features[i];
  91375. var point = feature.geometry;
  91376. var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
  91377. if (this.featureWeight) {
  91378. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  91379. if (!this.maxWeight) {
  91380. //找出最大最小权重值
  91381. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  91382. minTemp = minTemp ? minTemp : pixelPoint.weight;
  91383. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  91384. minTemp = Math.min(minTemp, pixelPoint.weight);
  91385. }
  91386. } else {
  91387. pixelPoint.weight = 1;
  91388. }
  91389. x = Math.floor(pixelPoint[0]);
  91390. y = Math.floor(pixelPoint[1]);
  91391. k = pixelPoint.weight;
  91392. data.push([x, y, k]);
  91393. }
  91394. //无最大权重设置
  91395. if (!this.maxWeight) {
  91396. if (maxTemp && minTemp) {
  91397. maxWeightTemp = (maxTemp + minTemp) / 2;
  91398. } else {
  91399. maxWeightTemp = 1;
  91400. }
  91401. this.draw(data, maxWeightTemp);
  91402. } else {
  91403. this.draw(data, this.maxWeight);
  91404. }
  91405. },
  91406. /**
  91407. * @function HeatMapLayer.prototype.draw
  91408. * @description 绘制热点图。
  91409. * @param {Array} data - convertToPixelPoints 方法计算出的点。
  91410. * @param {number} maxWeight - 最大权重。
  91411. * @private
  91412. */
  91413. draw: function (data, maxWeight) {
  91414. if (this.maxHeight > 0 && this.maxWidth > 0) {
  91415. var ctx = this.canvasContext;
  91416. //清空
  91417. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  91418. this.drawCircle(this.useRadius);
  91419. this.createGradient();
  91420. for (var i = 0; i < data.length; i++) {
  91421. var p = data[i];
  91422. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  91423. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  91424. }
  91425. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  91426. this.colorize(colored.data, this.grad);
  91427. ctx.putImageData(colored, 0, 0);
  91428. } else {
  91429. return false;
  91430. }
  91431. },
  91432. /**
  91433. * @function HeatMapLayer.prototype.colorize
  91434. * @description 根据渐变色重置热点图 rgb 值。
  91435. * @param {Array} pixels 像素 RGBA 值。
  91436. * @param {Array} gradient 渐变 canvas.getImageData.data。
  91437. * @private
  91438. */
  91439. colorize: function (pixels, gradient) {
  91440. for (var i = 0, j; i < pixels.length; i += 4) {
  91441. j = pixels[i + 3] * 4;
  91442. if (j) {
  91443. pixels[i] = gradient[j];
  91444. pixels[i + 1] = gradient[j + 1];
  91445. pixels[i + 2] = gradient[j + 2];
  91446. }
  91447. }
  91448. },
  91449. /**
  91450. * @function HeatMapLayer.drawCircle
  91451. * @description 绘制热点半径圆。
  91452. * @param {number} r - 热点半径。
  91453. * @private
  91454. */
  91455. drawCircle: function (r) {
  91456. var blur = this.blur || r / 2;
  91457. var circle = this.circle = document.createElement('canvas'),
  91458. ctx = circle.getContext("2d");
  91459. circle.height = 2 * r;
  91460. circle.width = 2 * r;
  91461. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  91462. ctx.shadowBlur = blur;
  91463. ctx.shadowColor = "#000000";
  91464. ctx.beginPath();
  91465. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  91466. ctx.closePath();
  91467. ctx.fill();
  91468. },
  91469. /**
  91470. * @function HeatMapLayer.createGradient
  91471. * @description 根据 this.canvasColors 设置渐变并 getImageData。
  91472. * @private
  91473. */
  91474. createGradient: function () {
  91475. var colors = this.colors;
  91476. var canvas = document.createElement('canvas'),
  91477. ctx = canvas.getContext("2d"),
  91478. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  91479. canvas.height = 256;
  91480. canvas.width = 1;
  91481. var index = 1;
  91482. for (var i = 0, len = colors.length; i < len; i++) {
  91483. gradient.addColorStop(index / len, colors[i]);
  91484. index++;
  91485. }
  91486. ctx.fillStyle = gradient;
  91487. ctx.fillRect(0, 0, 1, 256);
  91488. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  91489. },
  91490. /**
  91491. * @function HeatMapLayer.prototype.update
  91492. * @description 更新图层。
  91493. */
  91494. update: function () {
  91495. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  91496. external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
  91497. var me = this;
  91498. me.refresh();
  91499. if (me.currentMousePosition) {
  91500. me.currentMousePosition = external_L_default().point(
  91501. me.currentMousePosition.x - me.movingOffset[0],
  91502. me.currentMousePosition.y - me.movingOffset[1]);
  91503. }
  91504. me.movingOffset = [0, 0];
  91505. me._zoom = me._map.getZoom();
  91506. me._center = me._map.getCenter();
  91507. },
  91508. /**
  91509. * @function HeatMapLayer.prototype.getLocalXY
  91510. * @description 地理坐标转为像素坐标。
  91511. * @param {Array} coordinate - 地理坐标。
  91512. */
  91513. getLocalXY: function (coordinate) {
  91514. if (!this._map) {
  91515. return coordinate;
  91516. }
  91517. var coor = coordinate;
  91518. if (external_L_default().Util.isArray(coordinate)) {
  91519. coor = external_L_default().point(coordinate[0], coordinate[1]);
  91520. }
  91521. if (!(coordinate instanceof (external_L_default()).Point)) {
  91522. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  91523. coor = external_L_default().point(coordinate.x, coordinate.y);
  91524. } else {
  91525. coor = external_L_default().point(coordinate.lon, coordinate.lat);
  91526. }
  91527. }
  91528. var point = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
  91529. return [point.x, point.y];
  91530. },
  91531. /**
  91532. * @function HeatMapLayer.prototype.setOpacity
  91533. * @description 设置图层的不透明度,取值 [0-1] 之间。
  91534. * @param {number} opacity - 不透明度。
  91535. */
  91536. setOpacity: function (opacity) {
  91537. var me = this;
  91538. if (opacity === me.options.opacity) {
  91539. return;
  91540. }
  91541. if (opacity) {
  91542. me.options.opacity = opacity;
  91543. }
  91544. me._updateOpacity();
  91545. },
  91546. /**
  91547. * @function HeatMapLayer.prototype.removeFeatures
  91548. * @description 移除指定的热点信息。
  91549. * @param {Array.<FeatureVector>} features - 热点信息数组。
  91550. */
  91551. removeFeatures: function (features) {
  91552. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  91553. return;
  91554. }
  91555. if (features === this.features) {
  91556. return this.removeAllFeatures();
  91557. }
  91558. if (!(Util_Util.isArray(features))) {
  91559. features = [features];
  91560. }
  91561. var heatPoint, index, heatPointsFailedRemoved = [];
  91562. for (var i = 0, len = features.length; i < len; i++) {
  91563. heatPoint = features[i];
  91564. index = Util_Util.indexOf(this.features, heatPoint);
  91565. //找不到视为删除失败
  91566. if (index === -1) {
  91567. heatPointsFailedRemoved.push(heatPoint);
  91568. continue;
  91569. }
  91570. //删除热点
  91571. this.features.splice(index, 1);
  91572. }
  91573. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  91574. //派发删除features成功的事件
  91575. /**
  91576. * @event HeatMapLayer#featuresremoved
  91577. * @description 删除features成功后触发。
  91578. * @property {Array.<FeatureVector>} features - 事件对象。
  91579. * @property {boolean} succeed - 删除是否成功,false 为失败,true 为成功。
  91580. */
  91581. this._map.fire("featuresremoved", {features: heatPointsFailedRemoved, succeed: succeed});
  91582. this.refresh();
  91583. },
  91584. /**
  91585. * @function HeatMapLayer.prototype.removeAllFeatures
  91586. * @description 移除全部的热点信息。
  91587. */
  91588. removeAllFeatures: function () {
  91589. this.features = [];
  91590. this.refresh();
  91591. },
  91592. /**
  91593. * @function HeatMapLayer.prototype._createCanvasContainer
  91594. * @description 创建热力图绘制容器。
  91595. * @private
  91596. */
  91597. _createCanvasContainer: function () {
  91598. //构建绘图面板
  91599. var parentContainer = this.getPane();
  91600. var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
  91601. var className = 'heatMapLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
  91602. this.rootCanvas = external_L_default().DomUtil.create("canvas", className, parentContainer);
  91603. var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  91604. this.rootCanvas.id = this.id;
  91605. this.rootCanvas.style[originProp] = '50% 50%';
  91606. this.rootCanvas.style.position = "absolute";
  91607. this.rootCanvas.style.zIndex = 200;
  91608. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  91609. null, null, null, this.opacity);
  91610. this.canvasContext = this.rootCanvas.getContext('2d');
  91611. },
  91612. _updateOpacity: function () {
  91613. var me = this;
  91614. Util_Util.modifyDOMElement(me.rootCanvas, null, null, null, null, null, null, me.options.opacity);
  91615. if (me._map !== null) {
  91616. /**
  91617. * @event HeatMapLayer#changelayer
  91618. * @description 图层透明度更新成功之后触发。
  91619. * @property {HeatMapLayer} layer - 图层。
  91620. * @property {string} property - 改变的图层属性。
  91621. */
  91622. me._map.fire("changelayer", {layer: me, property: "opacity"});
  91623. }
  91624. },
  91625. /**
  91626. * @function HeatMapLayer.prototype.getEvents
  91627. * @description 获取图层事件。
  91628. * @returns {Object} 返回图层支持的事件。
  91629. * @private
  91630. */
  91631. getEvents: function () {
  91632. var me = this;
  91633. var events = {
  91634. zoomend: me._reset,
  91635. moveend: me._reset,
  91636. resize: me._resize
  91637. };
  91638. if (this._map._zoomAnimated) {
  91639. events.zoomanim = me._zoomAnim;
  91640. }
  91641. return events;
  91642. },
  91643. /**
  91644. * @function HeatMapLayer.prototype.toiClientFeature
  91645. * @description 转为 iClient 要素。
  91646. * @param {(GeoJSONObject|HeatMapFeature)} features - 待添加的要素数组。
  91647. * @returns {FeatureVector} 转换后的 iClient 要素。
  91648. */
  91649. toiClientFeature: function (features) {
  91650. if (!external_L_default().Util.isArray(features)) {
  91651. features = [features];
  91652. }
  91653. let featuresTemp = [];
  91654. for (let i = 0, len = features.length; i < len; i++) {
  91655. //支持ThemeFeature类型的feature
  91656. //支持传入ThemeFeature类型,ThemeFeature.geometry instanceof L.LatLng | ThemeFeature.geometry instanceof L.Point
  91657. if (features[i] instanceof HeatMapFeature) {
  91658. featuresTemp.push(features[i].toFeature());
  91659. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  91660. const format = new GeoJSON();
  91661. featuresTemp = featuresTemp.concat(format.read(features[i]));
  91662. } else if (features[i].geometry && features[i].geometry.parts) {
  91663. //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
  91664. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  91665. } else {
  91666. throw new Error("Features's type does not match, please check.");
  91667. }
  91668. }
  91669. return featuresTemp;
  91670. },
  91671. _zoomAnim: function (e) {
  91672. var scale = this._map.getZoomScale(e.zoom),
  91673. offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
  91674. if ((external_L_default()).DomUtil.setTransform) {
  91675. external_L_default().DomUtil.setTransform(this.rootCanvas, offset, scale);
  91676. } else {
  91677. this.rootCanvas.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
  91678. }
  91679. },
  91680. //缩放移动重绘
  91681. _reset: function () {
  91682. var me = this;
  91683. me.update();
  91684. var size = me._map.getSize();
  91685. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  91686. external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
  91687. if (parseFloat(me.rootCanvas.width) !== parseFloat(size.x)) {
  91688. me.rootCanvas.width = size.x;
  91689. }
  91690. if (parseFloat(me.rootCanvas.height) !== parseFloat(size.y)) {
  91691. me.rootCanvas.height = size.y;
  91692. }
  91693. me.refresh();
  91694. },
  91695. //通知渲染器的尺寸变化
  91696. _resize: function () {
  91697. var me = this;
  91698. var newSize = me._map.getSize();
  91699. me.maxWidth = newSize.x;
  91700. me.maxHeight = newSize.y;
  91701. }
  91702. });
  91703. var heatMapLayer = function (name, options) {
  91704. return new HeatMapLayer(name, options);
  91705. };
  91706. // EXTERNAL MODULE: ./node_modules/rbush/index.js
  91707. var rbush = __webpack_require__(510);
  91708. var rbush_default = /*#__PURE__*/__webpack_require__.n(rbush);
  91709. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry-type.js
  91710. var geometry_type_GeometryType;
  91711. (function (GeometryType) {
  91712. GeometryType[GeometryType["Unknown"] = 0] = "Unknown";
  91713. GeometryType[GeometryType["Point"] = 1] = "Point";
  91714. GeometryType[GeometryType["LineString"] = 2] = "LineString";
  91715. GeometryType[GeometryType["Polygon"] = 3] = "Polygon";
  91716. GeometryType[GeometryType["MultiPoint"] = 4] = "MultiPoint";
  91717. GeometryType[GeometryType["MultiLineString"] = 5] = "MultiLineString";
  91718. GeometryType[GeometryType["MultiPolygon"] = 6] = "MultiPolygon";
  91719. GeometryType[GeometryType["GeometryCollection"] = 7] = "GeometryCollection";
  91720. GeometryType[GeometryType["CircularString"] = 8] = "CircularString";
  91721. GeometryType[GeometryType["CompoundCurve"] = 9] = "CompoundCurve";
  91722. GeometryType[GeometryType["CurvePolygon"] = 10] = "CurvePolygon";
  91723. GeometryType[GeometryType["MultiCurve"] = 11] = "MultiCurve";
  91724. GeometryType[GeometryType["MultiSurface"] = 12] = "MultiSurface";
  91725. GeometryType[GeometryType["Curve"] = 13] = "Curve";
  91726. GeometryType[GeometryType["Surface"] = 14] = "Surface";
  91727. GeometryType[GeometryType["PolyhedralSurface"] = 15] = "PolyhedralSurface";
  91728. GeometryType[GeometryType["TIN"] = 16] = "TIN";
  91729. GeometryType[GeometryType["Triangle"] = 17] = "Triangle";
  91730. })(geometry_type_GeometryType || (geometry_type_GeometryType = {}));
  91731. // EXTERNAL MODULE: ./node_modules/flatbuffers/js/flatbuffers.js
  91732. var js_flatbuffers = __webpack_require__(903);
  91733. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry.js
  91734. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  91735. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  91736. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  91737. var geometry_Geometry = /*#__PURE__*/function () {
  91738. function Geometry() {
  91739. _classCallCheck(this, Geometry);
  91740. this.bb = null;
  91741. this.bb_pos = 0;
  91742. }
  91743. _createClass(Geometry, [{
  91744. key: "__init",
  91745. value: function __init(i, bb) {
  91746. this.bb_pos = i;
  91747. this.bb = bb;
  91748. return this;
  91749. }
  91750. }, {
  91751. key: "ends",
  91752. value: function ends(index) {
  91753. var offset = this.bb.__offset(this.bb_pos, 4);
  91754. return offset ? this.bb.readUint32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
  91755. }
  91756. }, {
  91757. key: "endsLength",
  91758. value: function endsLength() {
  91759. var offset = this.bb.__offset(this.bb_pos, 4);
  91760. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91761. }
  91762. }, {
  91763. key: "endsArray",
  91764. value: function endsArray() {
  91765. var offset = this.bb.__offset(this.bb_pos, 4);
  91766. return offset ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91767. }
  91768. }, {
  91769. key: "xy",
  91770. value: function xy(index) {
  91771. var offset = this.bb.__offset(this.bb_pos, 6);
  91772. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  91773. }
  91774. }, {
  91775. key: "xyLength",
  91776. value: function xyLength() {
  91777. var offset = this.bb.__offset(this.bb_pos, 6);
  91778. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91779. }
  91780. }, {
  91781. key: "xyArray",
  91782. value: function xyArray() {
  91783. var offset = this.bb.__offset(this.bb_pos, 6);
  91784. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91785. }
  91786. }, {
  91787. key: "z",
  91788. value: function z(index) {
  91789. var offset = this.bb.__offset(this.bb_pos, 8);
  91790. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  91791. }
  91792. }, {
  91793. key: "zLength",
  91794. value: function zLength() {
  91795. var offset = this.bb.__offset(this.bb_pos, 8);
  91796. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91797. }
  91798. }, {
  91799. key: "zArray",
  91800. value: function zArray() {
  91801. var offset = this.bb.__offset(this.bb_pos, 8);
  91802. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91803. }
  91804. }, {
  91805. key: "m",
  91806. value: function m(index) {
  91807. var offset = this.bb.__offset(this.bb_pos, 10);
  91808. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  91809. }
  91810. }, {
  91811. key: "mLength",
  91812. value: function mLength() {
  91813. var offset = this.bb.__offset(this.bb_pos, 10);
  91814. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91815. }
  91816. }, {
  91817. key: "mArray",
  91818. value: function mArray() {
  91819. var offset = this.bb.__offset(this.bb_pos, 10);
  91820. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91821. }
  91822. }, {
  91823. key: "t",
  91824. value: function t(index) {
  91825. var offset = this.bb.__offset(this.bb_pos, 12);
  91826. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  91827. }
  91828. }, {
  91829. key: "tLength",
  91830. value: function tLength() {
  91831. var offset = this.bb.__offset(this.bb_pos, 12);
  91832. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91833. }
  91834. }, {
  91835. key: "tArray",
  91836. value: function tArray() {
  91837. var offset = this.bb.__offset(this.bb_pos, 12);
  91838. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91839. }
  91840. }, {
  91841. key: "tm",
  91842. value: function tm(index) {
  91843. var offset = this.bb.__offset(this.bb_pos, 14);
  91844. return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
  91845. }
  91846. }, {
  91847. key: "tmLength",
  91848. value: function tmLength() {
  91849. var offset = this.bb.__offset(this.bb_pos, 14);
  91850. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91851. }
  91852. }, {
  91853. key: "type",
  91854. value: function type() {
  91855. var offset = this.bb.__offset(this.bb_pos, 16);
  91856. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  91857. }
  91858. }, {
  91859. key: "parts",
  91860. value: function parts(index, obj) {
  91861. var offset = this.bb.__offset(this.bb_pos, 18);
  91862. return offset ? (obj || new Geometry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  91863. }
  91864. }, {
  91865. key: "partsLength",
  91866. value: function partsLength() {
  91867. var offset = this.bb.__offset(this.bb_pos, 18);
  91868. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91869. }
  91870. }], [{
  91871. key: "getRootAsGeometry",
  91872. value: function getRootAsGeometry(bb, obj) {
  91873. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91874. }
  91875. }, {
  91876. key: "getSizePrefixedRootAsGeometry",
  91877. value: function getSizePrefixedRootAsGeometry(bb, obj) {
  91878. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  91879. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91880. }
  91881. }, {
  91882. key: "startGeometry",
  91883. value: function startGeometry(builder) {
  91884. builder.startObject(8);
  91885. }
  91886. }, {
  91887. key: "addEnds",
  91888. value: function addEnds(builder, endsOffset) {
  91889. builder.addFieldOffset(0, endsOffset, 0);
  91890. }
  91891. }, {
  91892. key: "createEndsVector",
  91893. value: function createEndsVector(builder, data) {
  91894. builder.startVector(4, data.length, 4);
  91895. for (var i = data.length - 1; i >= 0; i--) {
  91896. builder.addInt32(data[i]);
  91897. }
  91898. return builder.endVector();
  91899. }
  91900. }, {
  91901. key: "startEndsVector",
  91902. value: function startEndsVector(builder, numElems) {
  91903. builder.startVector(4, numElems, 4);
  91904. }
  91905. }, {
  91906. key: "addXy",
  91907. value: function addXy(builder, xyOffset) {
  91908. builder.addFieldOffset(1, xyOffset, 0);
  91909. }
  91910. }, {
  91911. key: "createXyVector",
  91912. value: function createXyVector(builder, data) {
  91913. builder.startVector(8, data.length, 8);
  91914. for (var i = data.length - 1; i >= 0; i--) {
  91915. builder.addFloat64(data[i]);
  91916. }
  91917. return builder.endVector();
  91918. }
  91919. }, {
  91920. key: "startXyVector",
  91921. value: function startXyVector(builder, numElems) {
  91922. builder.startVector(8, numElems, 8);
  91923. }
  91924. }, {
  91925. key: "addZ",
  91926. value: function addZ(builder, zOffset) {
  91927. builder.addFieldOffset(2, zOffset, 0);
  91928. }
  91929. }, {
  91930. key: "createZVector",
  91931. value: function createZVector(builder, data) {
  91932. builder.startVector(8, data.length, 8);
  91933. for (var i = data.length - 1; i >= 0; i--) {
  91934. builder.addFloat64(data[i]);
  91935. }
  91936. return builder.endVector();
  91937. }
  91938. }, {
  91939. key: "startZVector",
  91940. value: function startZVector(builder, numElems) {
  91941. builder.startVector(8, numElems, 8);
  91942. }
  91943. }, {
  91944. key: "addM",
  91945. value: function addM(builder, mOffset) {
  91946. builder.addFieldOffset(3, mOffset, 0);
  91947. }
  91948. }, {
  91949. key: "createMVector",
  91950. value: function createMVector(builder, data) {
  91951. builder.startVector(8, data.length, 8);
  91952. for (var i = data.length - 1; i >= 0; i--) {
  91953. builder.addFloat64(data[i]);
  91954. }
  91955. return builder.endVector();
  91956. }
  91957. }, {
  91958. key: "startMVector",
  91959. value: function startMVector(builder, numElems) {
  91960. builder.startVector(8, numElems, 8);
  91961. }
  91962. }, {
  91963. key: "addT",
  91964. value: function addT(builder, tOffset) {
  91965. builder.addFieldOffset(4, tOffset, 0);
  91966. }
  91967. }, {
  91968. key: "createTVector",
  91969. value: function createTVector(builder, data) {
  91970. builder.startVector(8, data.length, 8);
  91971. for (var i = data.length - 1; i >= 0; i--) {
  91972. builder.addFloat64(data[i]);
  91973. }
  91974. return builder.endVector();
  91975. }
  91976. }, {
  91977. key: "startTVector",
  91978. value: function startTVector(builder, numElems) {
  91979. builder.startVector(8, numElems, 8);
  91980. }
  91981. }, {
  91982. key: "addTm",
  91983. value: function addTm(builder, tmOffset) {
  91984. builder.addFieldOffset(5, tmOffset, 0);
  91985. }
  91986. }, {
  91987. key: "createTmVector",
  91988. value: function createTmVector(builder, data) {
  91989. builder.startVector(8, data.length, 8);
  91990. for (var i = data.length - 1; i >= 0; i--) {
  91991. builder.addInt64(data[i]);
  91992. }
  91993. return builder.endVector();
  91994. }
  91995. }, {
  91996. key: "startTmVector",
  91997. value: function startTmVector(builder, numElems) {
  91998. builder.startVector(8, numElems, 8);
  91999. }
  92000. }, {
  92001. key: "addType",
  92002. value: function addType(builder, type) {
  92003. builder.addFieldInt8(6, type, geometry_type_GeometryType.Unknown);
  92004. }
  92005. }, {
  92006. key: "addParts",
  92007. value: function addParts(builder, partsOffset) {
  92008. builder.addFieldOffset(7, partsOffset, 0);
  92009. }
  92010. }, {
  92011. key: "createPartsVector",
  92012. value: function createPartsVector(builder, data) {
  92013. builder.startVector(4, data.length, 4);
  92014. for (var i = data.length - 1; i >= 0; i--) {
  92015. builder.addOffset(data[i]);
  92016. }
  92017. return builder.endVector();
  92018. }
  92019. }, {
  92020. key: "startPartsVector",
  92021. value: function startPartsVector(builder, numElems) {
  92022. builder.startVector(4, numElems, 4);
  92023. }
  92024. }, {
  92025. key: "endGeometry",
  92026. value: function endGeometry(builder) {
  92027. var offset = builder.endObject();
  92028. return offset;
  92029. }
  92030. }, {
  92031. key: "createGeometry",
  92032. value: function createGeometry(builder, endsOffset, xyOffset, zOffset, mOffset, tOffset, tmOffset, type, partsOffset) {
  92033. Geometry.startGeometry(builder);
  92034. Geometry.addEnds(builder, endsOffset);
  92035. Geometry.addXy(builder, xyOffset);
  92036. Geometry.addZ(builder, zOffset);
  92037. Geometry.addM(builder, mOffset);
  92038. Geometry.addT(builder, tOffset);
  92039. Geometry.addTm(builder, tmOffset);
  92040. Geometry.addType(builder, type);
  92041. Geometry.addParts(builder, partsOffset);
  92042. return Geometry.endGeometry(builder);
  92043. }
  92044. }]);
  92045. return Geometry;
  92046. }();
  92047. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/geometry.js
  92048. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  92049. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  92050. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  92051. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  92052. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  92053. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  92054. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  92055. function geometry_buildGeometry(builder, parsedGeometry) {
  92056. var xy = parsedGeometry.xy,
  92057. z = parsedGeometry.z,
  92058. ends = parsedGeometry.ends,
  92059. parts = parsedGeometry.parts,
  92060. type = parsedGeometry.type;
  92061. if (parts) {
  92062. var partOffsets = parts.map(function (part) {
  92063. return geometry_buildGeometry(builder, part);
  92064. });
  92065. var partsOffset = Geometry.createPartsVector(builder, partOffsets);
  92066. Geometry.startGeometry(builder);
  92067. Geometry.addParts(builder, partsOffset);
  92068. Geometry.addType(builder, type);
  92069. return Geometry.endGeometry(builder);
  92070. }
  92071. var xyOffset = Geometry.createXyVector(builder, xy);
  92072. var zOffset;
  92073. if (z) zOffset = Geometry.createZVector(builder, z);
  92074. var endsOffset;
  92075. if (ends) endsOffset = Geometry.createEndsVector(builder, ends);
  92076. Geometry.startGeometry(builder);
  92077. if (endsOffset) Geometry.addEnds(builder, endsOffset);
  92078. Geometry.addXy(builder, xyOffset);
  92079. if (zOffset) Geometry.addZ(builder, zOffset);
  92080. Geometry.addType(builder, type);
  92081. return Geometry.endGeometry(builder);
  92082. }
  92083. function geometry_flat(a, xy, z) {
  92084. if (a.length === 0) return;
  92085. if (Array.isArray(a[0])) {
  92086. var _iterator = _createForOfIteratorHelper(a),
  92087. _step;
  92088. try {
  92089. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  92090. var sa = _step.value;
  92091. geometry_flat(sa, xy, z);
  92092. }
  92093. } catch (err) {
  92094. _iterator.e(err);
  92095. } finally {
  92096. _iterator.f();
  92097. }
  92098. } else {
  92099. if (a.length === 2) xy.push.apply(xy, _toConsumableArray(a));else {
  92100. xy.push(a[0], a[1]);
  92101. z.push(a[2]);
  92102. }
  92103. }
  92104. }
  92105. function geometry_parseGeometry(geometry, headerGeomType) {
  92106. var xy;
  92107. var ends;
  92108. var parts;
  92109. var type = headerGeomType;
  92110. if (type === GeometryType.Unknown) {
  92111. type = geometry_toGeometryType(geometry.getType());
  92112. }
  92113. if (type === GeometryType.MultiLineString) {
  92114. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  92115. var mlsEnds = geometry.getEnds();
  92116. if (mlsEnds.length > 1) ends = mlsEnds.map(function (e) {
  92117. return e >> 1;
  92118. });
  92119. } else if (type === GeometryType.Polygon) {
  92120. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  92121. var pEnds = geometry.getEnds();
  92122. if (pEnds.length > 1) ends = pEnds.map(function (e) {
  92123. return e >> 1;
  92124. });
  92125. } else if (type === GeometryType.MultiPolygon) {
  92126. var mp = geometry;
  92127. parts = mp.getPolygons().map(function (p) {
  92128. return geometry_parseGeometry(p, GeometryType.Polygon);
  92129. });
  92130. } else {
  92131. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  92132. }
  92133. return {
  92134. xy: xy,
  92135. ends: ends,
  92136. type: type,
  92137. parts: parts
  92138. };
  92139. }
  92140. function pairFlatCoordinates(xy, z) {
  92141. var newArray = [];
  92142. for (var i = 0; i < xy.length; i += 2) {
  92143. var a = [xy[i], xy[i + 1]];
  92144. if (z) a.push(z[i >> 1]);
  92145. newArray.push(a);
  92146. }
  92147. return newArray;
  92148. }
  92149. function geometry_toGeometryType(name) {
  92150. if (!name) return GeometryType.Unknown;
  92151. var type = GeometryType[name];
  92152. return type;
  92153. }
  92154. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/geometry.js
  92155. function geojson_geometry_parseGeometry(geometry) {
  92156. var cs = geometry.coordinates;
  92157. var xy = [];
  92158. var z = [];
  92159. var ends;
  92160. var parts;
  92161. var type = toGeometryType(geometry.type);
  92162. var end = 0;
  92163. switch (geometry.type) {
  92164. case 'Point':
  92165. flat(cs, xy, z);
  92166. break;
  92167. case 'MultiPoint':
  92168. case 'LineString':
  92169. flat(cs, xy, z);
  92170. break;
  92171. case 'MultiLineString':
  92172. case 'Polygon':
  92173. {
  92174. var css = cs;
  92175. flat(css, xy, z);
  92176. if (css.length > 1) ends = css.map(function (c) {
  92177. return end += c.length;
  92178. });
  92179. break;
  92180. }
  92181. case 'MultiPolygon':
  92182. {
  92183. var csss = cs;
  92184. var geometries = csss.map(function (coordinates) {
  92185. return {
  92186. type: 'Polygon',
  92187. coordinates: coordinates
  92188. };
  92189. });
  92190. parts = geometries.map(geojson_geometry_parseGeometry);
  92191. break;
  92192. }
  92193. }
  92194. return {
  92195. xy: xy,
  92196. z: z.length > 0 ? z : undefined,
  92197. ends: ends,
  92198. type: type,
  92199. parts: parts
  92200. };
  92201. }
  92202. function geometry_parseGC(geometry) {
  92203. var type = toGeometryType(geometry.type);
  92204. var parts = [];
  92205. for (var i = 0; i < geometry.geometries.length; i++) {
  92206. var g = geometry.geometries[i];
  92207. if (g.type === 'GeometryCollection') parts.push(geometry_parseGC(g));else parts.push(geojson_geometry_parseGeometry(g));
  92208. }
  92209. return {
  92210. type: type,
  92211. parts: parts
  92212. };
  92213. }
  92214. function extractParts(xy, z, ends) {
  92215. if (!ends || ends.length === 0) return [pairFlatCoordinates(xy, z)];
  92216. var s = 0;
  92217. var xySlices = Array.from(ends).map(function (e) {
  92218. return xy.slice(s, s = e << 1);
  92219. });
  92220. var zSlices;
  92221. if (z) {
  92222. s = 0;
  92223. zSlices = Array.from(ends).map(function (e) {
  92224. return z.slice(s, s = e);
  92225. });
  92226. }
  92227. return xySlices.map(function (xy, i) {
  92228. return pairFlatCoordinates(xy, zSlices ? zSlices[i] : undefined);
  92229. });
  92230. }
  92231. function toGeoJsonCoordinates(geometry, type) {
  92232. var xy = geometry.xyArray();
  92233. var z = geometry.zArray();
  92234. switch (type) {
  92235. case geometry_type_GeometryType.Point:
  92236. {
  92237. var a = Array.from(xy);
  92238. if (z) a.push(z[0]);
  92239. return a;
  92240. }
  92241. case geometry_type_GeometryType.MultiPoint:
  92242. case geometry_type_GeometryType.LineString:
  92243. return pairFlatCoordinates(xy, z);
  92244. case geometry_type_GeometryType.MultiLineString:
  92245. return extractParts(xy, z, geometry.endsArray());
  92246. case geometry_type_GeometryType.Polygon:
  92247. return extractParts(xy, z, geometry.endsArray());
  92248. }
  92249. }
  92250. function fromGeometry(geometry, headerType) {
  92251. var type = headerType;
  92252. if (type === geometry_type_GeometryType.Unknown) {
  92253. type = geometry.type();
  92254. }
  92255. if (type === geometry_type_GeometryType.GeometryCollection) {
  92256. var geometries = [];
  92257. for (var i = 0; i < geometry.partsLength(); i++) {
  92258. var part = geometry.parts(i);
  92259. var partType = part.type();
  92260. geometries.push(fromGeometry(part, partType));
  92261. }
  92262. return {
  92263. type: geometry_type_GeometryType[type],
  92264. geometries: geometries
  92265. };
  92266. } else if (type === geometry_type_GeometryType.MultiPolygon) {
  92267. var _geometries = [];
  92268. for (var _i2 = 0; _i2 < geometry.partsLength(); _i2++) _geometries.push(fromGeometry(geometry.parts(_i2), geometry_type_GeometryType.Polygon));
  92269. return {
  92270. type: geometry_type_GeometryType[type],
  92271. coordinates: _geometries.map(function (g) {
  92272. return g.coordinates;
  92273. })
  92274. };
  92275. }
  92276. var coordinates = toGeoJsonCoordinates(geometry, type);
  92277. return {
  92278. type: geometry_type_GeometryType[type],
  92279. coordinates: coordinates
  92280. };
  92281. }
  92282. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column-type.js
  92283. var column_type_ColumnType;
  92284. (function (ColumnType) {
  92285. ColumnType[ColumnType["Byte"] = 0] = "Byte";
  92286. ColumnType[ColumnType["UByte"] = 1] = "UByte";
  92287. ColumnType[ColumnType["Bool"] = 2] = "Bool";
  92288. ColumnType[ColumnType["Short"] = 3] = "Short";
  92289. ColumnType[ColumnType["UShort"] = 4] = "UShort";
  92290. ColumnType[ColumnType["Int"] = 5] = "Int";
  92291. ColumnType[ColumnType["UInt"] = 6] = "UInt";
  92292. ColumnType[ColumnType["Long"] = 7] = "Long";
  92293. ColumnType[ColumnType["ULong"] = 8] = "ULong";
  92294. ColumnType[ColumnType["Float"] = 9] = "Float";
  92295. ColumnType[ColumnType["Double"] = 10] = "Double";
  92296. ColumnType[ColumnType["String"] = 11] = "String";
  92297. ColumnType[ColumnType["Json"] = 12] = "Json";
  92298. ColumnType[ColumnType["DateTime"] = 13] = "DateTime";
  92299. ColumnType[ColumnType["Binary"] = 14] = "Binary";
  92300. })(column_type_ColumnType || (column_type_ColumnType = {}));
  92301. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column.js
  92302. function column_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92303. function column_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92304. function column_createClass(Constructor, protoProps, staticProps) { if (protoProps) column_defineProperties(Constructor.prototype, protoProps); if (staticProps) column_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92305. var column_Column = /*#__PURE__*/function () {
  92306. function Column() {
  92307. column_classCallCheck(this, Column);
  92308. this.bb = null;
  92309. this.bb_pos = 0;
  92310. }
  92311. column_createClass(Column, [{
  92312. key: "__init",
  92313. value: function __init(i, bb) {
  92314. this.bb_pos = i;
  92315. this.bb = bb;
  92316. return this;
  92317. }
  92318. }, {
  92319. key: "name",
  92320. value: function name(optionalEncoding) {
  92321. var offset = this.bb.__offset(this.bb_pos, 4);
  92322. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92323. }
  92324. }, {
  92325. key: "type",
  92326. value: function type() {
  92327. var offset = this.bb.__offset(this.bb_pos, 6);
  92328. return offset ? this.bb.readUint8(this.bb_pos + offset) : column_type_ColumnType.Byte;
  92329. }
  92330. }, {
  92331. key: "title",
  92332. value: function title(optionalEncoding) {
  92333. var offset = this.bb.__offset(this.bb_pos, 8);
  92334. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92335. }
  92336. }, {
  92337. key: "description",
  92338. value: function description(optionalEncoding) {
  92339. var offset = this.bb.__offset(this.bb_pos, 10);
  92340. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92341. }
  92342. }, {
  92343. key: "width",
  92344. value: function width() {
  92345. var offset = this.bb.__offset(this.bb_pos, 12);
  92346. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  92347. }
  92348. }, {
  92349. key: "precision",
  92350. value: function precision() {
  92351. var offset = this.bb.__offset(this.bb_pos, 14);
  92352. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  92353. }
  92354. }, {
  92355. key: "scale",
  92356. value: function scale() {
  92357. var offset = this.bb.__offset(this.bb_pos, 16);
  92358. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  92359. }
  92360. }, {
  92361. key: "nullable",
  92362. value: function nullable() {
  92363. var offset = this.bb.__offset(this.bb_pos, 18);
  92364. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : true;
  92365. }
  92366. }, {
  92367. key: "unique",
  92368. value: function unique() {
  92369. var offset = this.bb.__offset(this.bb_pos, 20);
  92370. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  92371. }
  92372. }, {
  92373. key: "primaryKey",
  92374. value: function primaryKey() {
  92375. var offset = this.bb.__offset(this.bb_pos, 22);
  92376. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  92377. }
  92378. }, {
  92379. key: "metadata",
  92380. value: function metadata(optionalEncoding) {
  92381. var offset = this.bb.__offset(this.bb_pos, 24);
  92382. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92383. }
  92384. }], [{
  92385. key: "getRootAsColumn",
  92386. value: function getRootAsColumn(bb, obj) {
  92387. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92388. }
  92389. }, {
  92390. key: "getSizePrefixedRootAsColumn",
  92391. value: function getSizePrefixedRootAsColumn(bb, obj) {
  92392. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  92393. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92394. }
  92395. }, {
  92396. key: "startColumn",
  92397. value: function startColumn(builder) {
  92398. builder.startObject(11);
  92399. }
  92400. }, {
  92401. key: "addName",
  92402. value: function addName(builder, nameOffset) {
  92403. builder.addFieldOffset(0, nameOffset, 0);
  92404. }
  92405. }, {
  92406. key: "addType",
  92407. value: function addType(builder, type) {
  92408. builder.addFieldInt8(1, type, column_type_ColumnType.Byte);
  92409. }
  92410. }, {
  92411. key: "addTitle",
  92412. value: function addTitle(builder, titleOffset) {
  92413. builder.addFieldOffset(2, titleOffset, 0);
  92414. }
  92415. }, {
  92416. key: "addDescription",
  92417. value: function addDescription(builder, descriptionOffset) {
  92418. builder.addFieldOffset(3, descriptionOffset, 0);
  92419. }
  92420. }, {
  92421. key: "addWidth",
  92422. value: function addWidth(builder, width) {
  92423. builder.addFieldInt32(4, width, -1);
  92424. }
  92425. }, {
  92426. key: "addPrecision",
  92427. value: function addPrecision(builder, precision) {
  92428. builder.addFieldInt32(5, precision, -1);
  92429. }
  92430. }, {
  92431. key: "addScale",
  92432. value: function addScale(builder, scale) {
  92433. builder.addFieldInt32(6, scale, -1);
  92434. }
  92435. }, {
  92436. key: "addNullable",
  92437. value: function addNullable(builder, nullable) {
  92438. builder.addFieldInt8(7, +nullable, +true);
  92439. }
  92440. }, {
  92441. key: "addUnique",
  92442. value: function addUnique(builder, unique) {
  92443. builder.addFieldInt8(8, +unique, +false);
  92444. }
  92445. }, {
  92446. key: "addPrimaryKey",
  92447. value: function addPrimaryKey(builder, primaryKey) {
  92448. builder.addFieldInt8(9, +primaryKey, +false);
  92449. }
  92450. }, {
  92451. key: "addMetadata",
  92452. value: function addMetadata(builder, metadataOffset) {
  92453. builder.addFieldOffset(10, metadataOffset, 0);
  92454. }
  92455. }, {
  92456. key: "endColumn",
  92457. value: function endColumn(builder) {
  92458. var offset = builder.endObject();
  92459. builder.requiredField(offset, 4);
  92460. return offset;
  92461. }
  92462. }, {
  92463. key: "createColumn",
  92464. value: function createColumn(builder, nameOffset, type, titleOffset, descriptionOffset, width, precision, scale, nullable, unique, primaryKey, metadataOffset) {
  92465. Column.startColumn(builder);
  92466. Column.addName(builder, nameOffset);
  92467. Column.addType(builder, type);
  92468. Column.addTitle(builder, titleOffset);
  92469. Column.addDescription(builder, descriptionOffset);
  92470. Column.addWidth(builder, width);
  92471. Column.addPrecision(builder, precision);
  92472. Column.addScale(builder, scale);
  92473. Column.addNullable(builder, nullable);
  92474. Column.addUnique(builder, unique);
  92475. Column.addPrimaryKey(builder, primaryKey);
  92476. Column.addMetadata(builder, metadataOffset);
  92477. return Column.endColumn(builder);
  92478. }
  92479. }]);
  92480. return Column;
  92481. }();
  92482. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/feature.js
  92483. function feature_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92484. function feature_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92485. function feature_createClass(Constructor, protoProps, staticProps) { if (protoProps) feature_defineProperties(Constructor.prototype, protoProps); if (staticProps) feature_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92486. var feature_Feature = /*#__PURE__*/function () {
  92487. function Feature() {
  92488. feature_classCallCheck(this, Feature);
  92489. this.bb = null;
  92490. this.bb_pos = 0;
  92491. }
  92492. feature_createClass(Feature, [{
  92493. key: "__init",
  92494. value: function __init(i, bb) {
  92495. this.bb_pos = i;
  92496. this.bb = bb;
  92497. return this;
  92498. }
  92499. }, {
  92500. key: "geometry",
  92501. value: function geometry(obj) {
  92502. var offset = this.bb.__offset(this.bb_pos, 4);
  92503. return offset ? (obj || new geometry_Geometry()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  92504. }
  92505. }, {
  92506. key: "properties",
  92507. value: function properties(index) {
  92508. var offset = this.bb.__offset(this.bb_pos, 6);
  92509. return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
  92510. }
  92511. }, {
  92512. key: "propertiesLength",
  92513. value: function propertiesLength() {
  92514. var offset = this.bb.__offset(this.bb_pos, 6);
  92515. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  92516. }
  92517. }, {
  92518. key: "propertiesArray",
  92519. value: function propertiesArray() {
  92520. var offset = this.bb.__offset(this.bb_pos, 6);
  92521. return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  92522. }
  92523. }, {
  92524. key: "columns",
  92525. value: function columns(index, obj) {
  92526. var offset = this.bb.__offset(this.bb_pos, 8);
  92527. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  92528. }
  92529. }, {
  92530. key: "columnsLength",
  92531. value: function columnsLength() {
  92532. var offset = this.bb.__offset(this.bb_pos, 8);
  92533. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  92534. }
  92535. }], [{
  92536. key: "getRootAsFeature",
  92537. value: function getRootAsFeature(bb, obj) {
  92538. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92539. }
  92540. }, {
  92541. key: "getSizePrefixedRootAsFeature",
  92542. value: function getSizePrefixedRootAsFeature(bb, obj) {
  92543. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  92544. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92545. }
  92546. }, {
  92547. key: "startFeature",
  92548. value: function startFeature(builder) {
  92549. builder.startObject(3);
  92550. }
  92551. }, {
  92552. key: "addGeometry",
  92553. value: function addGeometry(builder, geometryOffset) {
  92554. builder.addFieldOffset(0, geometryOffset, 0);
  92555. }
  92556. }, {
  92557. key: "addProperties",
  92558. value: function addProperties(builder, propertiesOffset) {
  92559. builder.addFieldOffset(1, propertiesOffset, 0);
  92560. }
  92561. }, {
  92562. key: "createPropertiesVector",
  92563. value: function createPropertiesVector(builder, data) {
  92564. builder.startVector(1, data.length, 1);
  92565. for (var i = data.length - 1; i >= 0; i--) {
  92566. builder.addInt8(data[i]);
  92567. }
  92568. return builder.endVector();
  92569. }
  92570. }, {
  92571. key: "startPropertiesVector",
  92572. value: function startPropertiesVector(builder, numElems) {
  92573. builder.startVector(1, numElems, 1);
  92574. }
  92575. }, {
  92576. key: "addColumns",
  92577. value: function addColumns(builder, columnsOffset) {
  92578. builder.addFieldOffset(2, columnsOffset, 0);
  92579. }
  92580. }, {
  92581. key: "createColumnsVector",
  92582. value: function createColumnsVector(builder, data) {
  92583. builder.startVector(4, data.length, 4);
  92584. for (var i = data.length - 1; i >= 0; i--) {
  92585. builder.addOffset(data[i]);
  92586. }
  92587. return builder.endVector();
  92588. }
  92589. }, {
  92590. key: "startColumnsVector",
  92591. value: function startColumnsVector(builder, numElems) {
  92592. builder.startVector(4, numElems, 4);
  92593. }
  92594. }, {
  92595. key: "endFeature",
  92596. value: function endFeature(builder) {
  92597. var offset = builder.endObject();
  92598. return offset;
  92599. }
  92600. }, {
  92601. key: "finishFeatureBuffer",
  92602. value: function finishFeatureBuffer(builder, offset) {
  92603. builder.finish(offset);
  92604. }
  92605. }, {
  92606. key: "finishSizePrefixedFeatureBuffer",
  92607. value: function finishSizePrefixedFeatureBuffer(builder, offset) {
  92608. builder.finish(offset, undefined, true);
  92609. }
  92610. }, {
  92611. key: "createFeature",
  92612. value: function createFeature(builder, geometryOffset, propertiesOffset, columnsOffset) {
  92613. Feature.startFeature(builder);
  92614. Feature.addGeometry(builder, geometryOffset);
  92615. Feature.addProperties(builder, propertiesOffset);
  92616. Feature.addColumns(builder, columnsOffset);
  92617. return Feature.endFeature(builder);
  92618. }
  92619. }]);
  92620. return Feature;
  92621. }();
  92622. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/feature.js
  92623. var textEncoder = new TextEncoder();
  92624. var textDecoder = new TextDecoder();
  92625. function fromFeature(feature, header, createGeometry, createFeature) {
  92626. var columns = header.columns;
  92627. var geometry = feature.geometry();
  92628. var simpleGeometry = createGeometry(geometry, header.geometryType);
  92629. var properties = parseProperties(feature, columns);
  92630. return createFeature(simpleGeometry, properties);
  92631. }
  92632. function feature_buildFeature(geometry, properties, header) {
  92633. var columns = header.columns;
  92634. var builder = new flatbuffers.Builder();
  92635. var offset = 0;
  92636. var capacity = 1024;
  92637. var bytes = new Uint8Array(capacity);
  92638. var view = new DataView(bytes.buffer);
  92639. var prep = function prep(size) {
  92640. if (offset + size < capacity) return;
  92641. capacity = Math.max(capacity + size, capacity * 2);
  92642. var newBytes = new Uint8Array(capacity);
  92643. newBytes.set(bytes);
  92644. bytes = newBytes;
  92645. view = new DataView(bytes.buffer);
  92646. };
  92647. if (columns) {
  92648. for (var i = 0; i < columns.length; i++) {
  92649. var column = columns[i];
  92650. var value = properties[column.name];
  92651. if (value === null) continue;
  92652. prep(2);
  92653. view.setUint16(offset, i, true);
  92654. offset += 2;
  92655. switch (column.type) {
  92656. case ColumnType.Bool:
  92657. prep(1);
  92658. view.setUint8(offset, value);
  92659. offset += 1;
  92660. break;
  92661. case ColumnType.Short:
  92662. prep(2);
  92663. view.setInt16(offset, value, true);
  92664. offset += 2;
  92665. break;
  92666. case ColumnType.UShort:
  92667. prep(2);
  92668. view.setUint16(offset, value, true);
  92669. offset += 2;
  92670. break;
  92671. case ColumnType.Int:
  92672. prep(4);
  92673. view.setInt32(offset, value, true);
  92674. offset += 4;
  92675. break;
  92676. case ColumnType.UInt:
  92677. prep(4);
  92678. view.setUint32(offset, value, true);
  92679. offset += 4;
  92680. break;
  92681. case ColumnType.Long:
  92682. prep(8);
  92683. view.setBigInt64(offset, BigInt(value), true);
  92684. offset += 8;
  92685. break;
  92686. case ColumnType.Float:
  92687. prep(4);
  92688. view.setFloat32(offset, value, true);
  92689. offset += 4;
  92690. break;
  92691. case ColumnType.Double:
  92692. prep(8);
  92693. view.setFloat64(offset, value, true);
  92694. offset += 8;
  92695. break;
  92696. case ColumnType.DateTime:
  92697. case ColumnType.String:
  92698. {
  92699. var str = textEncoder.encode(value);
  92700. prep(4);
  92701. view.setUint32(offset, str.length, true);
  92702. offset += 4;
  92703. prep(str.length);
  92704. bytes.set(str, offset);
  92705. offset += str.length;
  92706. break;
  92707. }
  92708. case ColumnType.Json:
  92709. {
  92710. var _str = textEncoder.encode(JSON.stringify(value));
  92711. prep(4);
  92712. view.setUint32(offset, _str.length, true);
  92713. offset += 4;
  92714. prep(_str.length);
  92715. bytes.set(_str, offset);
  92716. offset += _str.length;
  92717. break;
  92718. }
  92719. default:
  92720. throw new Error('Unknown type ' + column.type);
  92721. }
  92722. }
  92723. }
  92724. var propertiesOffset = null;
  92725. if (offset > 0) propertiesOffset = Feature.createPropertiesVector(builder, bytes.slice(0, offset));
  92726. var geometryOffset = buildGeometry(builder, geometry);
  92727. Feature.startFeature(builder);
  92728. Feature.addGeometry(builder, geometryOffset);
  92729. if (propertiesOffset) Feature.addProperties(builder, propertiesOffset);
  92730. var featureOffset = Feature.endFeature(builder);
  92731. builder.finishSizePrefixed(featureOffset);
  92732. return builder.asUint8Array();
  92733. }
  92734. function parseProperties(feature, columns) {
  92735. var properties = {};
  92736. if (!columns || columns.length === 0) return properties;
  92737. var array = feature.propertiesArray();
  92738. if (!array) return properties;
  92739. var view = new DataView(array.buffer, array.byteOffset);
  92740. var length = feature.propertiesLength();
  92741. var offset = 0;
  92742. while (offset < length) {
  92743. var i = view.getUint16(offset, true);
  92744. offset += 2;
  92745. var column = columns[i];
  92746. var name = column.name;
  92747. switch (column.type) {
  92748. case column_type_ColumnType.Bool:
  92749. {
  92750. properties[name] = !!view.getUint8(offset);
  92751. offset += 1;
  92752. break;
  92753. }
  92754. case column_type_ColumnType.Byte:
  92755. {
  92756. properties[name] = view.getInt8(offset);
  92757. offset += 1;
  92758. break;
  92759. }
  92760. case column_type_ColumnType.UByte:
  92761. {
  92762. properties[name] = view.getUint8(offset);
  92763. offset += 1;
  92764. break;
  92765. }
  92766. case column_type_ColumnType.Short:
  92767. {
  92768. properties[name] = view.getInt16(offset, true);
  92769. offset += 2;
  92770. break;
  92771. }
  92772. case column_type_ColumnType.UShort:
  92773. {
  92774. properties[name] = view.getUint16(offset, true);
  92775. offset += 2;
  92776. break;
  92777. }
  92778. case column_type_ColumnType.Int:
  92779. {
  92780. properties[name] = view.getInt32(offset, true);
  92781. offset += 4;
  92782. break;
  92783. }
  92784. case column_type_ColumnType.UInt:
  92785. {
  92786. properties[name] = view.getUint32(offset, true);
  92787. offset += 4;
  92788. break;
  92789. }
  92790. case column_type_ColumnType.Long:
  92791. {
  92792. properties[name] = Number(view.getBigInt64(offset, true));
  92793. offset += 8;
  92794. break;
  92795. }
  92796. case column_type_ColumnType.ULong:
  92797. {
  92798. properties[name] = Number(view.getBigUint64(offset, true));
  92799. offset += 8;
  92800. break;
  92801. }
  92802. case column_type_ColumnType.Float:
  92803. {
  92804. properties[name] = view.getFloat32(offset, true);
  92805. offset += 4;
  92806. break;
  92807. }
  92808. case column_type_ColumnType.Double:
  92809. {
  92810. properties[name] = view.getFloat64(offset, true);
  92811. offset += 8;
  92812. break;
  92813. }
  92814. case column_type_ColumnType.DateTime:
  92815. case column_type_ColumnType.String:
  92816. {
  92817. var _length = view.getUint32(offset, true);
  92818. offset += 4;
  92819. properties[name] = textDecoder.decode(array.subarray(offset, offset + _length));
  92820. offset += _length;
  92821. break;
  92822. }
  92823. case column_type_ColumnType.Json:
  92824. {
  92825. var _length2 = view.getUint32(offset, true);
  92826. offset += 4;
  92827. var str = textDecoder.decode(array.subarray(offset, offset + _length2));
  92828. properties[name] = JSON.parse(str);
  92829. offset += _length2;
  92830. break;
  92831. }
  92832. default:
  92833. throw new Error('Unknown type ' + column.type);
  92834. }
  92835. }
  92836. return properties;
  92837. }
  92838. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/feature.js
  92839. function feature_fromFeature(feature, header) {
  92840. var columns = header.columns;
  92841. var geometry = fromGeometry(feature.geometry(), header.geometryType);
  92842. var geoJsonfeature = {
  92843. type: 'Feature',
  92844. geometry: geometry,
  92845. properties: parseProperties(feature, columns)
  92846. };
  92847. return geoJsonfeature;
  92848. }
  92849. // EXTERNAL MODULE: ./node_modules/slice-source/dist/slice-source.js
  92850. var slice_source = __webpack_require__(901);
  92851. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/crs.js
  92852. function crs_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92853. function crs_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92854. function crs_createClass(Constructor, protoProps, staticProps) { if (protoProps) crs_defineProperties(Constructor.prototype, protoProps); if (staticProps) crs_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92855. var Crs = /*#__PURE__*/function () {
  92856. function Crs() {
  92857. crs_classCallCheck(this, Crs);
  92858. this.bb = null;
  92859. this.bb_pos = 0;
  92860. }
  92861. crs_createClass(Crs, [{
  92862. key: "__init",
  92863. value: function __init(i, bb) {
  92864. this.bb_pos = i;
  92865. this.bb = bb;
  92866. return this;
  92867. }
  92868. }, {
  92869. key: "org",
  92870. value: function org(optionalEncoding) {
  92871. var offset = this.bb.__offset(this.bb_pos, 4);
  92872. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92873. }
  92874. }, {
  92875. key: "code",
  92876. value: function code() {
  92877. var offset = this.bb.__offset(this.bb_pos, 6);
  92878. return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
  92879. }
  92880. }, {
  92881. key: "name",
  92882. value: function name(optionalEncoding) {
  92883. var offset = this.bb.__offset(this.bb_pos, 8);
  92884. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92885. }
  92886. }, {
  92887. key: "description",
  92888. value: function description(optionalEncoding) {
  92889. var offset = this.bb.__offset(this.bb_pos, 10);
  92890. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92891. }
  92892. }, {
  92893. key: "wkt",
  92894. value: function wkt(optionalEncoding) {
  92895. var offset = this.bb.__offset(this.bb_pos, 12);
  92896. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92897. }
  92898. }, {
  92899. key: "codeString",
  92900. value: function codeString(optionalEncoding) {
  92901. var offset = this.bb.__offset(this.bb_pos, 14);
  92902. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92903. }
  92904. }], [{
  92905. key: "getRootAsCrs",
  92906. value: function getRootAsCrs(bb, obj) {
  92907. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92908. }
  92909. }, {
  92910. key: "getSizePrefixedRootAsCrs",
  92911. value: function getSizePrefixedRootAsCrs(bb, obj) {
  92912. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  92913. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  92914. }
  92915. }, {
  92916. key: "startCrs",
  92917. value: function startCrs(builder) {
  92918. builder.startObject(6);
  92919. }
  92920. }, {
  92921. key: "addOrg",
  92922. value: function addOrg(builder, orgOffset) {
  92923. builder.addFieldOffset(0, orgOffset, 0);
  92924. }
  92925. }, {
  92926. key: "addCode",
  92927. value: function addCode(builder, code) {
  92928. builder.addFieldInt32(1, code, 0);
  92929. }
  92930. }, {
  92931. key: "addName",
  92932. value: function addName(builder, nameOffset) {
  92933. builder.addFieldOffset(2, nameOffset, 0);
  92934. }
  92935. }, {
  92936. key: "addDescription",
  92937. value: function addDescription(builder, descriptionOffset) {
  92938. builder.addFieldOffset(3, descriptionOffset, 0);
  92939. }
  92940. }, {
  92941. key: "addWkt",
  92942. value: function addWkt(builder, wktOffset) {
  92943. builder.addFieldOffset(4, wktOffset, 0);
  92944. }
  92945. }, {
  92946. key: "addCodeString",
  92947. value: function addCodeString(builder, codeStringOffset) {
  92948. builder.addFieldOffset(5, codeStringOffset, 0);
  92949. }
  92950. }, {
  92951. key: "endCrs",
  92952. value: function endCrs(builder) {
  92953. var offset = builder.endObject();
  92954. return offset;
  92955. }
  92956. }, {
  92957. key: "createCrs",
  92958. value: function createCrs(builder, orgOffset, code, nameOffset, descriptionOffset, wktOffset, codeStringOffset) {
  92959. Crs.startCrs(builder);
  92960. Crs.addOrg(builder, orgOffset);
  92961. Crs.addCode(builder, code);
  92962. Crs.addName(builder, nameOffset);
  92963. Crs.addDescription(builder, descriptionOffset);
  92964. Crs.addWkt(builder, wktOffset);
  92965. Crs.addCodeString(builder, codeStringOffset);
  92966. return Crs.endCrs(builder);
  92967. }
  92968. }]);
  92969. return Crs;
  92970. }();
  92971. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/header.js
  92972. function header_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92973. function header_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92974. function header_createClass(Constructor, protoProps, staticProps) { if (protoProps) header_defineProperties(Constructor.prototype, protoProps); if (staticProps) header_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92975. var header_Header = /*#__PURE__*/function () {
  92976. function Header() {
  92977. header_classCallCheck(this, Header);
  92978. this.bb = null;
  92979. this.bb_pos = 0;
  92980. }
  92981. header_createClass(Header, [{
  92982. key: "__init",
  92983. value: function __init(i, bb) {
  92984. this.bb_pos = i;
  92985. this.bb = bb;
  92986. return this;
  92987. }
  92988. }, {
  92989. key: "name",
  92990. value: function name(optionalEncoding) {
  92991. var offset = this.bb.__offset(this.bb_pos, 4);
  92992. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  92993. }
  92994. }, {
  92995. key: "envelope",
  92996. value: function envelope(index) {
  92997. var offset = this.bb.__offset(this.bb_pos, 6);
  92998. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  92999. }
  93000. }, {
  93001. key: "envelopeLength",
  93002. value: function envelopeLength() {
  93003. var offset = this.bb.__offset(this.bb_pos, 6);
  93004. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  93005. }
  93006. }, {
  93007. key: "envelopeArray",
  93008. value: function envelopeArray() {
  93009. var offset = this.bb.__offset(this.bb_pos, 6);
  93010. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  93011. }
  93012. }, {
  93013. key: "geometryType",
  93014. value: function geometryType() {
  93015. var offset = this.bb.__offset(this.bb_pos, 8);
  93016. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  93017. }
  93018. }, {
  93019. key: "hasZ",
  93020. value: function hasZ() {
  93021. var offset = this.bb.__offset(this.bb_pos, 10);
  93022. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  93023. }
  93024. }, {
  93025. key: "hasM",
  93026. value: function hasM() {
  93027. var offset = this.bb.__offset(this.bb_pos, 12);
  93028. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  93029. }
  93030. }, {
  93031. key: "hasT",
  93032. value: function hasT() {
  93033. var offset = this.bb.__offset(this.bb_pos, 14);
  93034. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  93035. }
  93036. }, {
  93037. key: "hasTm",
  93038. value: function hasTm() {
  93039. var offset = this.bb.__offset(this.bb_pos, 16);
  93040. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  93041. }
  93042. }, {
  93043. key: "columns",
  93044. value: function columns(index, obj) {
  93045. var offset = this.bb.__offset(this.bb_pos, 18);
  93046. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  93047. }
  93048. }, {
  93049. key: "columnsLength",
  93050. value: function columnsLength() {
  93051. var offset = this.bb.__offset(this.bb_pos, 18);
  93052. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  93053. }
  93054. }, {
  93055. key: "featuresCount",
  93056. value: function featuresCount() {
  93057. var offset = this.bb.__offset(this.bb_pos, 20);
  93058. return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
  93059. }
  93060. }, {
  93061. key: "indexNodeSize",
  93062. value: function indexNodeSize() {
  93063. var offset = this.bb.__offset(this.bb_pos, 22);
  93064. return offset ? this.bb.readUint16(this.bb_pos + offset) : 16;
  93065. }
  93066. }, {
  93067. key: "crs",
  93068. value: function crs(obj) {
  93069. var offset = this.bb.__offset(this.bb_pos, 24);
  93070. return offset ? (obj || new Crs()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  93071. }
  93072. }, {
  93073. key: "title",
  93074. value: function title(optionalEncoding) {
  93075. var offset = this.bb.__offset(this.bb_pos, 26);
  93076. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  93077. }
  93078. }, {
  93079. key: "description",
  93080. value: function description(optionalEncoding) {
  93081. var offset = this.bb.__offset(this.bb_pos, 28);
  93082. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  93083. }
  93084. }, {
  93085. key: "metadata",
  93086. value: function metadata(optionalEncoding) {
  93087. var offset = this.bb.__offset(this.bb_pos, 30);
  93088. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  93089. }
  93090. }], [{
  93091. key: "getRootAsHeader",
  93092. value: function getRootAsHeader(bb, obj) {
  93093. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  93094. }
  93095. }, {
  93096. key: "getSizePrefixedRootAsHeader",
  93097. value: function getSizePrefixedRootAsHeader(bb, obj) {
  93098. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  93099. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  93100. }
  93101. }, {
  93102. key: "startHeader",
  93103. value: function startHeader(builder) {
  93104. builder.startObject(14);
  93105. }
  93106. }, {
  93107. key: "addName",
  93108. value: function addName(builder, nameOffset) {
  93109. builder.addFieldOffset(0, nameOffset, 0);
  93110. }
  93111. }, {
  93112. key: "addEnvelope",
  93113. value: function addEnvelope(builder, envelopeOffset) {
  93114. builder.addFieldOffset(1, envelopeOffset, 0);
  93115. }
  93116. }, {
  93117. key: "createEnvelopeVector",
  93118. value: function createEnvelopeVector(builder, data) {
  93119. builder.startVector(8, data.length, 8);
  93120. for (var i = data.length - 1; i >= 0; i--) {
  93121. builder.addFloat64(data[i]);
  93122. }
  93123. return builder.endVector();
  93124. }
  93125. }, {
  93126. key: "startEnvelopeVector",
  93127. value: function startEnvelopeVector(builder, numElems) {
  93128. builder.startVector(8, numElems, 8);
  93129. }
  93130. }, {
  93131. key: "addGeometryType",
  93132. value: function addGeometryType(builder, geometryType) {
  93133. builder.addFieldInt8(2, geometryType, geometry_type_GeometryType.Unknown);
  93134. }
  93135. }, {
  93136. key: "addHasZ",
  93137. value: function addHasZ(builder, hasZ) {
  93138. builder.addFieldInt8(3, +hasZ, +false);
  93139. }
  93140. }, {
  93141. key: "addHasM",
  93142. value: function addHasM(builder, hasM) {
  93143. builder.addFieldInt8(4, +hasM, +false);
  93144. }
  93145. }, {
  93146. key: "addHasT",
  93147. value: function addHasT(builder, hasT) {
  93148. builder.addFieldInt8(5, +hasT, +false);
  93149. }
  93150. }, {
  93151. key: "addHasTm",
  93152. value: function addHasTm(builder, hasTm) {
  93153. builder.addFieldInt8(6, +hasTm, +false);
  93154. }
  93155. }, {
  93156. key: "addColumns",
  93157. value: function addColumns(builder, columnsOffset) {
  93158. builder.addFieldOffset(7, columnsOffset, 0);
  93159. }
  93160. }, {
  93161. key: "createColumnsVector",
  93162. value: function createColumnsVector(builder, data) {
  93163. builder.startVector(4, data.length, 4);
  93164. for (var i = data.length - 1; i >= 0; i--) {
  93165. builder.addOffset(data[i]);
  93166. }
  93167. return builder.endVector();
  93168. }
  93169. }, {
  93170. key: "startColumnsVector",
  93171. value: function startColumnsVector(builder, numElems) {
  93172. builder.startVector(4, numElems, 4);
  93173. }
  93174. }, {
  93175. key: "addFeaturesCount",
  93176. value: function addFeaturesCount(builder, featuresCount) {
  93177. builder.addFieldInt64(8, featuresCount, BigInt('0'));
  93178. }
  93179. }, {
  93180. key: "addIndexNodeSize",
  93181. value: function addIndexNodeSize(builder, indexNodeSize) {
  93182. builder.addFieldInt16(9, indexNodeSize, 16);
  93183. }
  93184. }, {
  93185. key: "addCrs",
  93186. value: function addCrs(builder, crsOffset) {
  93187. builder.addFieldOffset(10, crsOffset, 0);
  93188. }
  93189. }, {
  93190. key: "addTitle",
  93191. value: function addTitle(builder, titleOffset) {
  93192. builder.addFieldOffset(11, titleOffset, 0);
  93193. }
  93194. }, {
  93195. key: "addDescription",
  93196. value: function addDescription(builder, descriptionOffset) {
  93197. builder.addFieldOffset(12, descriptionOffset, 0);
  93198. }
  93199. }, {
  93200. key: "addMetadata",
  93201. value: function addMetadata(builder, metadataOffset) {
  93202. builder.addFieldOffset(13, metadataOffset, 0);
  93203. }
  93204. }, {
  93205. key: "endHeader",
  93206. value: function endHeader(builder) {
  93207. var offset = builder.endObject();
  93208. return offset;
  93209. }
  93210. }, {
  93211. key: "finishHeaderBuffer",
  93212. value: function finishHeaderBuffer(builder, offset) {
  93213. builder.finish(offset);
  93214. }
  93215. }, {
  93216. key: "finishSizePrefixedHeaderBuffer",
  93217. value: function finishSizePrefixedHeaderBuffer(builder, offset) {
  93218. builder.finish(offset, undefined, true);
  93219. }
  93220. }]);
  93221. return Header;
  93222. }();
  93223. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/header-meta.js
  93224. function fromByteBuffer(bb) {
  93225. var header = header_Header.getRootAsHeader(bb);
  93226. var featuresCount = header.featuresCount();
  93227. var indexNodeSize = header.indexNodeSize();
  93228. var columns = [];
  93229. for (var j = 0; j < header.columnsLength(); j++) {
  93230. var column = header.columns(j);
  93231. if (!column) throw new Error('Column unexpectedly missing');
  93232. if (!column.name()) throw new Error('Column name unexpectedly missing');
  93233. columns.push({
  93234. name: column.name(),
  93235. type: column.type(),
  93236. title: column.title(),
  93237. description: column.description(),
  93238. width: column.width(),
  93239. precision: column.precision(),
  93240. scale: column.scale(),
  93241. nullable: column.nullable(),
  93242. unique: column.unique(),
  93243. primary_key: column.primaryKey()
  93244. });
  93245. }
  93246. var crs = header.crs();
  93247. var crsMeta = crs ? {
  93248. org: crs.org(),
  93249. code: crs.code(),
  93250. name: crs.name(),
  93251. description: crs.description(),
  93252. wkt: crs.wkt(),
  93253. code_string: crs.codeString()
  93254. } : null;
  93255. var headerMeta = {
  93256. geometryType: header.geometryType(),
  93257. columns: columns,
  93258. envelope: null,
  93259. featuresCount: Number(featuresCount),
  93260. indexNodeSize: indexNodeSize,
  93261. crs: crsMeta,
  93262. title: header.title(),
  93263. description: header.description(),
  93264. metadata: header.metadata()
  93265. };
  93266. return headerMeta;
  93267. }
  93268. // EXTERNAL MODULE: ./node_modules/@repeaterjs/repeater/cjs/repeater.js
  93269. var repeater = __webpack_require__(982);
  93270. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/config.js
  93271. function config_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  93272. function config_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  93273. function config_createClass(Constructor, protoProps, staticProps) { if (protoProps) config_defineProperties(Constructor.prototype, protoProps); if (staticProps) config_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  93274. var config_Config = /*#__PURE__*/function () {
  93275. function Config() {
  93276. config_classCallCheck(this, Config);
  93277. this._extraRequestThreshold = 256 * 1024;
  93278. }
  93279. config_createClass(Config, [{
  93280. key: "extraRequestThreshold",
  93281. value: function extraRequestThreshold() {
  93282. return this._extraRequestThreshold;
  93283. }
  93284. }, {
  93285. key: "setExtraRequestThreshold",
  93286. value: function setExtraRequestThreshold(bytes) {
  93287. if (bytes < 0) {
  93288. throw new Error('extraRequestThreshold cannot be negative');
  93289. }
  93290. this._extraRequestThreshold = bytes;
  93291. }
  93292. }]);
  93293. return Config;
  93294. }();
  93295. config_Config.global = new config_Config();
  93296. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/logger.js
  93297. function logger_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  93298. function logger_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  93299. function logger_createClass(Constructor, protoProps, staticProps) { if (protoProps) logger_defineProperties(Constructor.prototype, protoProps); if (staticProps) logger_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  93300. var LogLevel;
  93301. (function (LogLevel) {
  93302. LogLevel[LogLevel["Debug"] = 0] = "Debug";
  93303. LogLevel[LogLevel["Info"] = 1] = "Info";
  93304. LogLevel[LogLevel["Warn"] = 2] = "Warn";
  93305. LogLevel[LogLevel["Error"] = 3] = "Error";
  93306. })(LogLevel || (LogLevel = {}));
  93307. var Logger = /*#__PURE__*/function () {
  93308. function Logger() {
  93309. logger_classCallCheck(this, Logger);
  93310. }
  93311. logger_createClass(Logger, null, [{
  93312. key: "debug",
  93313. value: function debug() {
  93314. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  93315. args[_key] = arguments[_key];
  93316. }
  93317. this.log.apply(this, [LogLevel.Debug].concat(args));
  93318. }
  93319. }, {
  93320. key: "info",
  93321. value: function info() {
  93322. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  93323. args[_key2] = arguments[_key2];
  93324. }
  93325. this.log.apply(this, [LogLevel.Info].concat(args));
  93326. }
  93327. }, {
  93328. key: "warn",
  93329. value: function warn() {
  93330. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  93331. args[_key3] = arguments[_key3];
  93332. }
  93333. this.log.apply(this, [LogLevel.Warn].concat(args));
  93334. }
  93335. }, {
  93336. key: "error",
  93337. value: function error() {
  93338. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  93339. args[_key4] = arguments[_key4];
  93340. }
  93341. this.log.apply(this, [LogLevel.Error].concat(args));
  93342. }
  93343. }, {
  93344. key: "log",
  93345. value: function log(level) {
  93346. if (this.logLevel > level) {
  93347. return;
  93348. }
  93349. for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
  93350. args[_key5 - 1] = arguments[_key5];
  93351. }
  93352. switch (level) {
  93353. case LogLevel.Debug:
  93354. {
  93355. var _console;
  93356. (_console = console).debug.apply(_console, args);
  93357. break;
  93358. }
  93359. case LogLevel.Info:
  93360. {
  93361. var _console2;
  93362. (_console2 = console).info.apply(_console2, args);
  93363. break;
  93364. }
  93365. case LogLevel.Warn:
  93366. {
  93367. var _console3;
  93368. (_console3 = console).warn.apply(_console3, args);
  93369. break;
  93370. }
  93371. case LogLevel.Error:
  93372. {
  93373. var _console4;
  93374. (_console4 = console).error.apply(_console4, args);
  93375. break;
  93376. }
  93377. }
  93378. }
  93379. }]);
  93380. return Logger;
  93381. }();
  93382. Logger.logLevel = LogLevel.Info;
  93383. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/packedrtree.js
  93384. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  93385. function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  93386. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || packedrtree_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  93387. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  93388. function packedrtree_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return packedrtree_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return packedrtree_arrayLikeToArray(o, minLen); }
  93389. function packedrtree_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  93390. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  93391. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  93392. function packedrtree_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  93393. function packedrtree_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  93394. function packedrtree_createClass(Constructor, protoProps, staticProps) { if (protoProps) packedrtree_defineProperties(Constructor.prototype, protoProps); if (staticProps) packedrtree_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  93395. function _awaitAsyncGenerator(value) { return new _OverloadYield(value, 0); }
  93396. function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; }
  93397. function _AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof _OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  93398. _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, _AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, _AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, _AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  93399. function _OverloadYield(value, kind) { this.v = value, this.k = kind; }
  93400. var NODE_ITEM_LEN = 8 * 4 + 8;
  93401. var DEFAULT_NODE_SIZE = 16;
  93402. function calcTreeSize(numItems, nodeSize) {
  93403. nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
  93404. var n = numItems;
  93405. var numNodes = n;
  93406. do {
  93407. n = Math.ceil(n / nodeSize);
  93408. numNodes += n;
  93409. } while (n !== 1);
  93410. return numNodes * NODE_ITEM_LEN;
  93411. }
  93412. function generateLevelBounds(numItems, nodeSize) {
  93413. if (nodeSize < 2) throw new Error('Node size must be at least 2');
  93414. if (numItems === 0) throw new Error('Number of items must be greater than 0');
  93415. var n = numItems;
  93416. var numNodes = n;
  93417. var levelNumNodes = [n];
  93418. do {
  93419. n = Math.ceil(n / nodeSize);
  93420. numNodes += n;
  93421. levelNumNodes.push(n);
  93422. } while (n !== 1);
  93423. var levelOffsets = [];
  93424. n = numNodes;
  93425. for (var _i = 0, _levelNumNodes = levelNumNodes; _i < _levelNumNodes.length; _i++) {
  93426. var size = _levelNumNodes[_i];
  93427. levelOffsets.push(n - size);
  93428. n -= size;
  93429. }
  93430. levelOffsets.reverse();
  93431. levelNumNodes.reverse();
  93432. var levelBounds = [];
  93433. for (var i = 0; i < levelNumNodes.length; i++) levelBounds.push([levelOffsets[i], levelOffsets[i] + levelNumNodes[i]]);
  93434. levelBounds.reverse();
  93435. return levelBounds;
  93436. }
  93437. function streamSearch(_x, _x2, _x3, _x4) {
  93438. return _streamSearch.apply(this, arguments);
  93439. }
  93440. function _streamSearch() {
  93441. _streamSearch = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(numItems, nodeSize, rect, readNode) {
  93442. var NodeRange, minX, minY, maxX, maxY, levelBounds, leafNodesOffset, rootNodeRange, queue, _loop;
  93443. return _regeneratorRuntime().wrap(function _callee$(_context3) {
  93444. while (1) switch (_context3.prev = _context3.next) {
  93445. case 0:
  93446. NodeRange = /*#__PURE__*/function () {
  93447. function NodeRange(nodes, level) {
  93448. packedrtree_classCallCheck(this, NodeRange);
  93449. this._level = level;
  93450. this.nodes = nodes;
  93451. }
  93452. packedrtree_createClass(NodeRange, [{
  93453. key: "level",
  93454. value: function level() {
  93455. return this._level;
  93456. }
  93457. }, {
  93458. key: "startNode",
  93459. value: function startNode() {
  93460. return this.nodes[0];
  93461. }
  93462. }, {
  93463. key: "endNode",
  93464. value: function endNode() {
  93465. return this.nodes[1];
  93466. }
  93467. }, {
  93468. key: "extendEndNodeToNewOffset",
  93469. value: function extendEndNodeToNewOffset(newOffset) {
  93470. console.assert(newOffset > this.nodes[1]);
  93471. this.nodes[1] = newOffset;
  93472. }
  93473. }, {
  93474. key: "toString",
  93475. value: function toString() {
  93476. return "[NodeRange level: ".concat(this._level, ", nodes: ").concat(this.nodes[0], "-").concat(this.nodes[1], "]");
  93477. }
  93478. }]);
  93479. return NodeRange;
  93480. }();
  93481. minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY;
  93482. Logger.info("tree items: ".concat(numItems, ", nodeSize: ").concat(nodeSize));
  93483. levelBounds = generateLevelBounds(numItems, nodeSize);
  93484. leafNodesOffset = levelBounds[0][0];
  93485. rootNodeRange = function () {
  93486. var range = [0, 1];
  93487. var level = levelBounds.length - 1;
  93488. return new NodeRange(range, level);
  93489. }();
  93490. queue = [rootNodeRange];
  93491. Logger.debug("starting stream search with queue: ".concat(queue, ", numItems: ").concat(numItems, ", nodeSize: ").concat(nodeSize, ", levelBounds: ").concat(levelBounds));
  93492. _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
  93493. var nodeRange, nodeIndex, isLeafNode, _levelBounds$nodeRang, levelBound, end, length, buffer, float64Array, uint32Array, _loop2, _ret, pos;
  93494. return _regeneratorRuntime().wrap(function _loop$(_context2) {
  93495. while (1) switch (_context2.prev = _context2.next) {
  93496. case 0:
  93497. nodeRange = queue.shift();
  93498. Logger.debug("popped node: ".concat(nodeRange, ", queueLength: ").concat(queue.length));
  93499. nodeIndex = nodeRange.startNode();
  93500. isLeafNode = nodeIndex >= leafNodesOffset;
  93501. _levelBounds$nodeRang = _slicedToArray(levelBounds[nodeRange.level()], 2), levelBound = _levelBounds$nodeRang[1];
  93502. end = Math.min(nodeRange.endNode() + nodeSize, levelBound);
  93503. length = end - nodeIndex;
  93504. _context2.next = 9;
  93505. return _awaitAsyncGenerator(readNode(nodeIndex * NODE_ITEM_LEN, length * NODE_ITEM_LEN));
  93506. case 9:
  93507. buffer = _context2.sent;
  93508. float64Array = new Float64Array(buffer);
  93509. uint32Array = new Uint32Array(buffer);
  93510. _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(pos) {
  93511. var nodePos, low32Offset, high32Offset, offset, featureLength, extraRequestThresholdNodes, nearestNodeRange, newNodeRange;
  93512. return _regeneratorRuntime().wrap(function _loop2$(_context) {
  93513. while (1) switch (_context.prev = _context.next) {
  93514. case 0:
  93515. nodePos = (pos - nodeIndex) * 5;
  93516. if (!(maxX < float64Array[nodePos + 0])) {
  93517. _context.next = 3;
  93518. break;
  93519. }
  93520. return _context.abrupt("return", 0);
  93521. case 3:
  93522. if (!(maxY < float64Array[nodePos + 1])) {
  93523. _context.next = 5;
  93524. break;
  93525. }
  93526. return _context.abrupt("return", 0);
  93527. case 5:
  93528. if (!(minX > float64Array[nodePos + 2])) {
  93529. _context.next = 7;
  93530. break;
  93531. }
  93532. return _context.abrupt("return", 0);
  93533. case 7:
  93534. if (!(minY > float64Array[nodePos + 3])) {
  93535. _context.next = 9;
  93536. break;
  93537. }
  93538. return _context.abrupt("return", 0);
  93539. case 9:
  93540. low32Offset = uint32Array[(nodePos << 1) + 8];
  93541. high32Offset = uint32Array[(nodePos << 1) + 9];
  93542. offset = readUint52(high32Offset, low32Offset);
  93543. if (!isLeafNode) {
  93544. _context.next = 17;
  93545. break;
  93546. }
  93547. featureLength = function () {
  93548. if (pos < numItems - 1) {
  93549. var nextPos = (pos - nodeIndex + 1) * 5;
  93550. var _low32Offset = uint32Array[(nextPos << 1) + 8];
  93551. var _high32Offset = uint32Array[(nextPos << 1) + 9];
  93552. var nextOffset = readUint52(_high32Offset, _low32Offset);
  93553. return nextOffset - offset;
  93554. } else {
  93555. return null;
  93556. }
  93557. }();
  93558. _context.next = 16;
  93559. return [offset, pos - leafNodesOffset, featureLength];
  93560. case 16:
  93561. return _context.abrupt("return", 0);
  93562. case 17:
  93563. extraRequestThresholdNodes = config_Config.global.extraRequestThreshold() / NODE_ITEM_LEN;
  93564. nearestNodeRange = queue[queue.length - 1];
  93565. if (!(nearestNodeRange !== undefined && nearestNodeRange.level() == nodeRange.level() - 1 && offset < nearestNodeRange.endNode() + extraRequestThresholdNodes)) {
  93566. _context.next = 23;
  93567. break;
  93568. }
  93569. Logger.debug("Merging \"nodeRange\" request into existing range: ".concat(nearestNodeRange, ", newOffset: ").concat(nearestNodeRange.endNode(), " -> ").concat(offset));
  93570. nearestNodeRange.extendEndNodeToNewOffset(offset);
  93571. return _context.abrupt("return", 0);
  93572. case 23:
  93573. newNodeRange = function () {
  93574. var level = nodeRange.level() - 1;
  93575. var range = [offset, offset + 1];
  93576. return new NodeRange(range, level);
  93577. }();
  93578. if (nearestNodeRange !== undefined && nearestNodeRange.level() == newNodeRange.level()) {
  93579. Logger.info("Same level, but too far away. Pushing new request at offset: ".concat(offset, " rather than merging with distant ").concat(nearestNodeRange));
  93580. } else {
  93581. Logger.info("Pushing new level for ".concat(newNodeRange, " onto queue with nearestNodeRange: ").concat(nearestNodeRange, " since there's not already a range for this level."));
  93582. }
  93583. queue.push(newNodeRange);
  93584. case 26:
  93585. case "end":
  93586. return _context.stop();
  93587. }
  93588. }, _loop2);
  93589. });
  93590. pos = nodeIndex;
  93591. case 14:
  93592. if (!(pos < end)) {
  93593. _context2.next = 22;
  93594. break;
  93595. }
  93596. return _context2.delegateYield(_loop2(pos), "t0", 16);
  93597. case 16:
  93598. _ret = _context2.t0;
  93599. if (!(_ret === 0)) {
  93600. _context2.next = 19;
  93601. break;
  93602. }
  93603. return _context2.abrupt("continue", 19);
  93604. case 19:
  93605. pos++;
  93606. _context2.next = 14;
  93607. break;
  93608. case 22:
  93609. case "end":
  93610. return _context2.stop();
  93611. }
  93612. }, _loop);
  93613. });
  93614. case 9:
  93615. if (!(queue.length != 0)) {
  93616. _context3.next = 13;
  93617. break;
  93618. }
  93619. return _context3.delegateYield(_loop(), "t0", 11);
  93620. case 11:
  93621. _context3.next = 9;
  93622. break;
  93623. case 13:
  93624. case "end":
  93625. return _context3.stop();
  93626. }
  93627. }, _callee);
  93628. }));
  93629. return _streamSearch.apply(this, arguments);
  93630. }
  93631. function readUint52(high32Bits, low32Bits) {
  93632. if ((high32Bits & 0xfff00000) != 0) {
  93633. throw Error('integer is too large to be safely represented');
  93634. }
  93635. var result = low32Bits + high32Bits * Math.pow(2, 32);
  93636. return result;
  93637. }
  93638. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/constants.js
  93639. var constants_magicbytes = new Uint8Array([0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x00]);
  93640. var SIZE_PREFIX_LEN = 4;
  93641. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/http-reader.js
  93642. function http_reader_typeof(obj) { "@babel/helpers - typeof"; return http_reader_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, http_reader_typeof(obj); }
  93643. function http_reader_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = http_reader_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  93644. function http_reader_slicedToArray(arr, i) { return http_reader_arrayWithHoles(arr) || http_reader_iterableToArrayLimit(arr, i) || http_reader_unsupportedIterableToArray(arr, i) || http_reader_nonIterableRest(); }
  93645. function http_reader_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  93646. function http_reader_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return http_reader_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return http_reader_arrayLikeToArray(o, minLen); }
  93647. function http_reader_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  93648. function http_reader_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  93649. function http_reader_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  93650. function http_reader_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ http_reader_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == http_reader_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  93651. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  93652. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  93653. function http_reader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  93654. function http_reader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  93655. function http_reader_createClass(Constructor, protoProps, staticProps) { if (protoProps) http_reader_defineProperties(Constructor.prototype, protoProps); if (staticProps) http_reader_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  93656. function http_reader_wrapAsyncGenerator(fn) { return function () { return new http_reader_AsyncGenerator(fn.apply(this, arguments)); }; }
  93657. function http_reader_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof http_reader_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  93658. http_reader_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, http_reader_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, http_reader_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, http_reader_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  93659. function http_reader_awaitAsyncGenerator(value) { return new http_reader_OverloadYield(value, 0); }
  93660. function _asyncGeneratorDelegate(inner) { var iter = {}, waiting = !1; function pump(key, value) { return waiting = !0, value = new Promise(function (resolve) { resolve(inner[key](value)); }), { done: !1, value: new http_reader_OverloadYield(value, 1) }; } return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { return this; }, iter.next = function (value) { return waiting ? (waiting = !1, value) : pump("next", value); }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { if (waiting) throw waiting = !1, value; return pump("throw", value); }), "function" == typeof inner["return"] && (iter["return"] = function (value) { return waiting ? (waiting = !1, value) : pump("return", value); }), iter; }
  93661. function http_reader_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  93662. function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  93663. function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
  93664. var HttpReader = /*#__PURE__*/function () {
  93665. function HttpReader(headerClient, header, headerLength, indexLength) {
  93666. http_reader_classCallCheck(this, HttpReader);
  93667. this.headerClient = headerClient;
  93668. this.header = header;
  93669. this.headerLength = headerLength;
  93670. this.indexLength = indexLength;
  93671. }
  93672. http_reader_createClass(HttpReader, [{
  93673. key: "selectBbox",
  93674. value: function selectBbox(rect) {
  93675. var _this = this;
  93676. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee2() {
  93677. var lengthBeforeTree, bufferedClient, readNode, batches, currentBatch, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, searchResult, _searchResult2, featureOffset, _searchResult4, featureLength, guessLength, prevFeature, gap, promises;
  93678. return http_reader_regeneratorRuntime().wrap(function _callee2$(_context2) {
  93679. while (1) switch (_context2.prev = _context2.next) {
  93680. case 0:
  93681. lengthBeforeTree = _this.lengthBeforeTree();
  93682. bufferedClient = _this.headerClient;
  93683. readNode = /*#__PURE__*/function () {
  93684. var _ref = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee(offsetIntoTree, size) {
  93685. var minReqLength;
  93686. return http_reader_regeneratorRuntime().wrap(function _callee$(_context) {
  93687. while (1) switch (_context.prev = _context.next) {
  93688. case 0:
  93689. minReqLength = 0;
  93690. return _context.abrupt("return", bufferedClient.getRange(lengthBeforeTree + offsetIntoTree, size, minReqLength, 'index'));
  93691. case 2:
  93692. case "end":
  93693. return _context.stop();
  93694. }
  93695. }, _callee);
  93696. }));
  93697. return function readNode(_x, _x2) {
  93698. return _ref.apply(this, arguments);
  93699. };
  93700. }();
  93701. batches = [];
  93702. currentBatch = [];
  93703. _iteratorAbruptCompletion = false;
  93704. _didIteratorError = false;
  93705. _context2.prev = 7;
  93706. _iterator = _asyncIterator(streamSearch(_this.header.featuresCount, _this.header.indexNodeSize, rect, readNode));
  93707. case 9:
  93708. _context2.next = 11;
  93709. return http_reader_awaitAsyncGenerator(_iterator.next());
  93710. case 11:
  93711. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  93712. _context2.next = 26;
  93713. break;
  93714. }
  93715. searchResult = _step.value;
  93716. _searchResult2 = http_reader_slicedToArray(searchResult, 2), featureOffset = _searchResult2[0];
  93717. _searchResult4 = http_reader_slicedToArray(searchResult, 3), featureLength = _searchResult4[2];
  93718. if (!featureLength) {
  93719. Logger.info('final feature');
  93720. guessLength = config_Config.global.extraRequestThreshold();
  93721. featureLength = guessLength;
  93722. }
  93723. if (!(currentBatch.length == 0)) {
  93724. _context2.next = 19;
  93725. break;
  93726. }
  93727. currentBatch.push([featureOffset, featureLength]);
  93728. return _context2.abrupt("continue", 23);
  93729. case 19:
  93730. prevFeature = currentBatch[currentBatch.length - 1];
  93731. gap = featureOffset - (prevFeature[0] + prevFeature[1]);
  93732. if (gap > config_Config.global.extraRequestThreshold()) {
  93733. Logger.info("Pushing new feature batch, since gap ".concat(gap, " was too large"));
  93734. batches.push(currentBatch);
  93735. currentBatch = [];
  93736. }
  93737. currentBatch.push([featureOffset, featureLength]);
  93738. case 23:
  93739. _iteratorAbruptCompletion = false;
  93740. _context2.next = 9;
  93741. break;
  93742. case 26:
  93743. _context2.next = 32;
  93744. break;
  93745. case 28:
  93746. _context2.prev = 28;
  93747. _context2.t0 = _context2["catch"](7);
  93748. _didIteratorError = true;
  93749. _iteratorError = _context2.t0;
  93750. case 32:
  93751. _context2.prev = 32;
  93752. _context2.prev = 33;
  93753. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  93754. _context2.next = 37;
  93755. break;
  93756. }
  93757. _context2.next = 37;
  93758. return http_reader_awaitAsyncGenerator(_iterator["return"]());
  93759. case 37:
  93760. _context2.prev = 37;
  93761. if (!_didIteratorError) {
  93762. _context2.next = 40;
  93763. break;
  93764. }
  93765. throw _iteratorError;
  93766. case 40:
  93767. return _context2.finish(37);
  93768. case 41:
  93769. return _context2.finish(32);
  93770. case 42:
  93771. _this.headerClient.logUsage('header+index');
  93772. if (currentBatch.length > 0) {
  93773. batches.push(currentBatch);
  93774. }
  93775. promises = batches.flatMap(function (batch) {
  93776. return _this.readFeatureBatch(batch);
  93777. });
  93778. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(repeater/* Repeater */.ZN.merge(promises)), http_reader_awaitAsyncGenerator), "t1", 46);
  93779. case 46:
  93780. case "end":
  93781. return _context2.stop();
  93782. }
  93783. }, _callee2, null, [[7, 28, 32, 42], [33,, 37, 41]]);
  93784. }))();
  93785. }
  93786. }, {
  93787. key: "lengthBeforeTree",
  93788. value: function lengthBeforeTree() {
  93789. return constants_magicbytes.length + SIZE_PREFIX_LEN + this.headerLength;
  93790. }
  93791. }, {
  93792. key: "lengthBeforeFeatures",
  93793. value: function lengthBeforeFeatures() {
  93794. return this.lengthBeforeTree() + this.indexLength;
  93795. }
  93796. }, {
  93797. key: "buildFeatureClient",
  93798. value: function buildFeatureClient() {
  93799. return new BufferedHttpRangeClient(this.headerClient.httpClient);
  93800. }
  93801. }, {
  93802. key: "readFeatureBatch",
  93803. value: function readFeatureBatch(batch) {
  93804. var _this2 = this;
  93805. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee3() {
  93806. var _batch$, firstFeatureOffset, _batch, lastFeatureOffset, lastFeatureLength, batchStart, batchEnd, batchSize, featureClient, _iterator2, _step2, _step2$value2, featureOffset;
  93807. return http_reader_regeneratorRuntime().wrap(function _callee3$(_context3) {
  93808. while (1) switch (_context3.prev = _context3.next) {
  93809. case 0:
  93810. _batch$ = http_reader_slicedToArray(batch[0], 1), firstFeatureOffset = _batch$[0];
  93811. _batch = http_reader_slicedToArray(batch[batch.length - 1], 2), lastFeatureOffset = _batch[0], lastFeatureLength = _batch[1];
  93812. batchStart = firstFeatureOffset;
  93813. batchEnd = lastFeatureOffset + lastFeatureLength;
  93814. batchSize = batchEnd - batchStart;
  93815. featureClient = _this2.buildFeatureClient();
  93816. _iterator2 = http_reader_createForOfIteratorHelper(batch);
  93817. _context3.prev = 7;
  93818. _iterator2.s();
  93819. case 9:
  93820. if ((_step2 = _iterator2.n()).done) {
  93821. _context3.next = 17;
  93822. break;
  93823. }
  93824. _step2$value2 = http_reader_slicedToArray(_step2.value, 1), featureOffset = _step2$value2[0];
  93825. _context3.next = 13;
  93826. return http_reader_awaitAsyncGenerator(_this2.readFeature(featureClient, featureOffset, batchSize));
  93827. case 13:
  93828. _context3.next = 15;
  93829. return _context3.sent;
  93830. case 15:
  93831. _context3.next = 9;
  93832. break;
  93833. case 17:
  93834. _context3.next = 22;
  93835. break;
  93836. case 19:
  93837. _context3.prev = 19;
  93838. _context3.t0 = _context3["catch"](7);
  93839. _iterator2.e(_context3.t0);
  93840. case 22:
  93841. _context3.prev = 22;
  93842. _iterator2.f();
  93843. return _context3.finish(22);
  93844. case 25:
  93845. featureClient.logUsage('feature');
  93846. case 26:
  93847. case "end":
  93848. return _context3.stop();
  93849. }
  93850. }, _callee3, null, [[7, 19, 22, 25]]);
  93851. }))();
  93852. }
  93853. }, {
  93854. key: "readFeature",
  93855. value: function () {
  93856. var _readFeature = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee4(featureClient, featureOffset, minFeatureReqLength) {
  93857. var offset, featureLength, _bytes, byteBuffer, bytes, bytesAligned, bb;
  93858. return http_reader_regeneratorRuntime().wrap(function _callee4$(_context4) {
  93859. while (1) switch (_context4.prev = _context4.next) {
  93860. case 0:
  93861. offset = featureOffset + this.lengthBeforeFeatures();
  93862. _context4.next = 3;
  93863. return featureClient.getRange(offset, 4, minFeatureReqLength, 'feature length');
  93864. case 3:
  93865. _bytes = _context4.sent;
  93866. featureLength = new DataView(_bytes).getUint32(0, true);
  93867. _context4.next = 7;
  93868. return featureClient.getRange(offset + 4, featureLength, minFeatureReqLength, 'feature data');
  93869. case 7:
  93870. byteBuffer = _context4.sent;
  93871. bytes = new Uint8Array(byteBuffer);
  93872. bytesAligned = new Uint8Array(featureLength + SIZE_PREFIX_LEN);
  93873. bytesAligned.set(bytes, SIZE_PREFIX_LEN);
  93874. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  93875. bb.setPosition(SIZE_PREFIX_LEN);
  93876. return _context4.abrupt("return", feature_Feature.getRootAsFeature(bb));
  93877. case 14:
  93878. case "end":
  93879. return _context4.stop();
  93880. }
  93881. }, _callee4, this);
  93882. }));
  93883. function readFeature(_x3, _x4, _x5) {
  93884. return _readFeature.apply(this, arguments);
  93885. }
  93886. return readFeature;
  93887. }()
  93888. }], [{
  93889. key: "open",
  93890. value: function () {
  93891. var _open = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee5(url) {
  93892. var assumedHeaderLength, headerClient, assumedIndexLength, minReqLength, _bytes2, headerLength, _bytes3, HEADER_MAX_BUFFER_SIZE, bytes, bb, header, indexLength;
  93893. return http_reader_regeneratorRuntime().wrap(function _callee5$(_context5) {
  93894. while (1) switch (_context5.prev = _context5.next) {
  93895. case 0:
  93896. assumedHeaderLength = 2024;
  93897. headerClient = new BufferedHttpRangeClient(url);
  93898. assumedIndexLength = function () {
  93899. var assumedBranchingFactor = DEFAULT_NODE_SIZE;
  93900. var prefetchedLayers = 3;
  93901. var result = 0;
  93902. var i;
  93903. for (i = 0; i < prefetchedLayers; i++) {
  93904. var layer_width = Math.pow(assumedBranchingFactor, i) * NODE_ITEM_LEN;
  93905. result += layer_width;
  93906. }
  93907. return result;
  93908. }();
  93909. minReqLength = assumedHeaderLength + assumedIndexLength;
  93910. Logger.debug("fetching header. minReqLength: ".concat(minReqLength, " (assumedHeaderLength: ").concat(assumedHeaderLength, ", assumedIndexLength: ").concat(assumedIndexLength, ")"));
  93911. _context5.t0 = Uint8Array;
  93912. _context5.next = 8;
  93913. return headerClient.getRange(0, 8, minReqLength, 'header');
  93914. case 8:
  93915. _context5.t1 = _context5.sent;
  93916. _bytes2 = new _context5.t0(_context5.t1);
  93917. if (_bytes2.subarray(0, 3).every(function (v, i) {
  93918. return constants_magicbytes[i] === v;
  93919. })) {
  93920. _context5.next = 13;
  93921. break;
  93922. }
  93923. Logger.error("bytes: ".concat(_bytes2, " != ").concat(constants_magicbytes));
  93924. throw new Error('Not a FlatGeobuf file');
  93925. case 13:
  93926. Logger.debug('magic bytes look good');
  93927. _context5.next = 16;
  93928. return headerClient.getRange(8, 4, minReqLength, 'header');
  93929. case 16:
  93930. _bytes3 = _context5.sent;
  93931. headerLength = new DataView(_bytes3).getUint32(0, true);
  93932. HEADER_MAX_BUFFER_SIZE = 1048576 * 10;
  93933. if (!(headerLength > HEADER_MAX_BUFFER_SIZE || headerLength < 8)) {
  93934. _context5.next = 21;
  93935. break;
  93936. }
  93937. throw new Error('Invalid header size');
  93938. case 21:
  93939. Logger.debug("headerLength: ".concat(headerLength));
  93940. _context5.next = 24;
  93941. return headerClient.getRange(12, headerLength, minReqLength, 'header');
  93942. case 24:
  93943. bytes = _context5.sent;
  93944. bb = new js_flatbuffers/* ByteBuffer */.cZ(new Uint8Array(bytes));
  93945. header = fromByteBuffer(bb);
  93946. indexLength = calcTreeSize(header.featuresCount, header.indexNodeSize);
  93947. Logger.debug('completed: opening http reader');
  93948. return _context5.abrupt("return", new HttpReader(headerClient, header, headerLength, indexLength));
  93949. case 30:
  93950. case "end":
  93951. return _context5.stop();
  93952. }
  93953. }, _callee5);
  93954. }));
  93955. function open(_x6) {
  93956. return _open.apply(this, arguments);
  93957. }
  93958. return open;
  93959. }()
  93960. }]);
  93961. return HttpReader;
  93962. }();
  93963. var BufferedHttpRangeClient = /*#__PURE__*/function () {
  93964. function BufferedHttpRangeClient(source) {
  93965. http_reader_classCallCheck(this, BufferedHttpRangeClient);
  93966. this.bytesEverUsed = 0;
  93967. this.bytesEverFetched = 0;
  93968. this.buffer = new ArrayBuffer(0);
  93969. this.head = 0;
  93970. if (typeof source === 'string') {
  93971. this.httpClient = new HttpRangeClient(source);
  93972. } else {
  93973. this.httpClient = source;
  93974. }
  93975. }
  93976. http_reader_createClass(BufferedHttpRangeClient, [{
  93977. key: "getRange",
  93978. value: function () {
  93979. var _getRange = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee6(start, length, minReqLength, purpose) {
  93980. var start_i, end_i, lengthToFetch;
  93981. return http_reader_regeneratorRuntime().wrap(function _callee6$(_context6) {
  93982. while (1) switch (_context6.prev = _context6.next) {
  93983. case 0:
  93984. this.bytesEverUsed += length;
  93985. start_i = start - this.head;
  93986. end_i = start_i + length;
  93987. if (!(start_i >= 0 && end_i <= this.buffer.byteLength)) {
  93988. _context6.next = 5;
  93989. break;
  93990. }
  93991. return _context6.abrupt("return", this.buffer.slice(start_i, end_i));
  93992. case 5:
  93993. lengthToFetch = Math.max(length, minReqLength);
  93994. this.bytesEverFetched += lengthToFetch;
  93995. Logger.debug("requesting for new Range: ".concat(start, "-").concat(start + length - 1));
  93996. _context6.next = 10;
  93997. return this.httpClient.getRange(start, lengthToFetch, purpose);
  93998. case 10:
  93999. this.buffer = _context6.sent;
  94000. this.head = start;
  94001. return _context6.abrupt("return", this.buffer.slice(0, length));
  94002. case 13:
  94003. case "end":
  94004. return _context6.stop();
  94005. }
  94006. }, _callee6, this);
  94007. }));
  94008. function getRange(_x7, _x8, _x9, _x10) {
  94009. return _getRange.apply(this, arguments);
  94010. }
  94011. return getRange;
  94012. }()
  94013. }, {
  94014. key: "logUsage",
  94015. value: function logUsage(purpose) {
  94016. var category = purpose.split(' ')[0];
  94017. var used = this.bytesEverUsed;
  94018. var requested = this.bytesEverFetched;
  94019. var efficiency = (100.0 * used / requested).toFixed(2);
  94020. Logger.info("".concat(category, " bytes used/requested: ").concat(used, " / ").concat(requested, " = ").concat(efficiency, "%"));
  94021. }
  94022. }]);
  94023. return BufferedHttpRangeClient;
  94024. }();
  94025. var HttpRangeClient = /*#__PURE__*/function () {
  94026. function HttpRangeClient(url) {
  94027. http_reader_classCallCheck(this, HttpRangeClient);
  94028. this.requestsEverMade = 0;
  94029. this.bytesEverRequested = 0;
  94030. this.url = url;
  94031. }
  94032. http_reader_createClass(HttpRangeClient, [{
  94033. key: "getRange",
  94034. value: function () {
  94035. var _getRange2 = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee7(begin, length, purpose) {
  94036. var range, response;
  94037. return http_reader_regeneratorRuntime().wrap(function _callee7$(_context7) {
  94038. while (1) switch (_context7.prev = _context7.next) {
  94039. case 0:
  94040. this.requestsEverMade += 1;
  94041. this.bytesEverRequested += length;
  94042. range = "bytes=".concat(begin, "-").concat(begin + length - 1);
  94043. Logger.info("request: #".concat(this.requestsEverMade, ", purpose: ").concat(purpose, "), bytes: (this_request: ").concat(length, ", ever: ").concat(this.bytesEverRequested, "), Range: ").concat(range));
  94044. _context7.next = 6;
  94045. return fetch(this.url, {
  94046. headers: {
  94047. Range: range
  94048. }
  94049. });
  94050. case 6:
  94051. response = _context7.sent;
  94052. return _context7.abrupt("return", response.arrayBuffer());
  94053. case 8:
  94054. case "end":
  94055. return _context7.stop();
  94056. }
  94057. }, _callee7, this);
  94058. }));
  94059. function getRange(_x11, _x12, _x13) {
  94060. return _getRange2.apply(this, arguments);
  94061. }
  94062. return getRange;
  94063. }()
  94064. }]);
  94065. return HttpRangeClient;
  94066. }();
  94067. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/header.js
  94068. function header_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = header_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  94069. function header_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return header_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return header_arrayLikeToArray(o, minLen); }
  94070. function header_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  94071. function featureGeomType(feature) {
  94072. if (feature.getGeometry) {
  94073. return toGeometryType(feature.getGeometry().getType());
  94074. } else {
  94075. return toGeometryType(feature.geometry.type);
  94076. }
  94077. }
  94078. function header_inferGeometryType(features) {
  94079. var geometryType = undefined;
  94080. var _iterator = header_createForOfIteratorHelper(features),
  94081. _step;
  94082. try {
  94083. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  94084. var f = _step.value;
  94085. if (geometryType === GeometryType.Unknown) {
  94086. break;
  94087. }
  94088. var gtype = featureGeomType(f);
  94089. if (geometryType === undefined) {
  94090. geometryType = gtype;
  94091. } else if (geometryType !== gtype) {
  94092. geometryType = GeometryType.Unknown;
  94093. }
  94094. }
  94095. } catch (err) {
  94096. _iterator.e(err);
  94097. } finally {
  94098. _iterator.f();
  94099. }
  94100. if (geometryType === undefined) {
  94101. throw new Error('Could not infer geometry type for collection of features.');
  94102. }
  94103. return geometryType;
  94104. }
  94105. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/featurecollection.js
  94106. function featurecollection_typeof(obj) { "@babel/helpers - typeof"; return featurecollection_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, featurecollection_typeof(obj); }
  94107. function featurecollection_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ featurecollection_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == featurecollection_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  94108. function featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  94109. function featurecollection_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  94110. function featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  94111. function featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return featurecollection_arrayLikeToArray(o, minLen); }
  94112. function featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  94113. function featurecollection_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new featurecollection_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  94114. function featurecollection_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return featurecollection_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, featurecollection_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new featurecollection_AsyncFromSyncIterator(s); }
  94115. function featurecollection_awaitAsyncGenerator(value) { return new featurecollection_OverloadYield(value, 0); }
  94116. function featurecollection_wrapAsyncGenerator(fn) { return function () { return new featurecollection_AsyncGenerator(fn.apply(this, arguments)); }; }
  94117. function featurecollection_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof featurecollection_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  94118. featurecollection_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, featurecollection_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, featurecollection_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, featurecollection_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  94119. function featurecollection_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  94120. function serialize(features) {
  94121. var headerMeta = introspectHeaderMeta(features);
  94122. var header = featurecollection_buildHeader(headerMeta);
  94123. var featureBuffers = features.map(function (f) {
  94124. if (!f.getGeometry) throw new Error('Missing getGeometry implementation');
  94125. if (!f.getProperties) throw new Error('Missing getProperties implementation');
  94126. return buildFeature(parseGeometry(f.getGeometry(), headerMeta.geometryType), f.getProperties(), headerMeta);
  94127. });
  94128. var featuresLength = featureBuffers.map(function (f) {
  94129. return f.length;
  94130. }).reduce(function (a, b) {
  94131. return a + b;
  94132. });
  94133. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  94134. uint8.set(header, magicbytes.length);
  94135. var offset = magicbytes.length + header.length;
  94136. var _iterator2 = featurecollection_createForOfIteratorHelper(featureBuffers),
  94137. _step2;
  94138. try {
  94139. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  94140. var feature = _step2.value;
  94141. uint8.set(feature, offset);
  94142. offset += feature.length;
  94143. }
  94144. } catch (err) {
  94145. _iterator2.e(err);
  94146. } finally {
  94147. _iterator2.f();
  94148. }
  94149. uint8.set(magicbytes);
  94150. return uint8;
  94151. }
  94152. function deserialize(bytes, fromFeature, headerMetaFn) {
  94153. if (!bytes.subarray(0, 3).every(function (v, i) {
  94154. return constants_magicbytes[i] === v;
  94155. })) throw new Error('Not a FlatGeobuf file');
  94156. var bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  94157. var headerLength = bb.readUint32(constants_magicbytes.length);
  94158. bb.setPosition(constants_magicbytes.length + SIZE_PREFIX_LEN);
  94159. var headerMeta = fromByteBuffer(bb);
  94160. if (headerMetaFn) headerMetaFn(headerMeta);
  94161. var offset = constants_magicbytes.length + SIZE_PREFIX_LEN + headerLength;
  94162. var indexNodeSize = headerMeta.indexNodeSize,
  94163. featuresCount = headerMeta.featuresCount;
  94164. if (indexNodeSize > 0) offset += calcTreeSize(featuresCount, indexNodeSize);
  94165. var features = [];
  94166. while (offset < bb.capacity()) {
  94167. var featureLength = bb.readUint32(offset);
  94168. bb.setPosition(offset + SIZE_PREFIX_LEN);
  94169. var feature = feature_Feature.getRootAsFeature(bb);
  94170. features.push(fromFeature(feature, headerMeta));
  94171. offset += SIZE_PREFIX_LEN + featureLength;
  94172. }
  94173. return features;
  94174. }
  94175. function deserializeStream(_x, _x2, _x3) {
  94176. return _deserializeStream.apply(this, arguments);
  94177. }
  94178. function _deserializeStream() {
  94179. _deserializeStream = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee2(stream, fromFeature, headerMetaFn) {
  94180. var reader, read, bytes, bb, headerLength, headerMeta, indexNodeSize, featuresCount, treeSize, feature;
  94181. return featurecollection_regeneratorRuntime().wrap(function _callee2$(_context2) {
  94182. while (1) switch (_context2.prev = _context2.next) {
  94183. case 0:
  94184. reader = slice_source(stream);
  94185. read = /*#__PURE__*/function () {
  94186. var _ref = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee(size) {
  94187. return featurecollection_regeneratorRuntime().wrap(function _callee$(_context) {
  94188. while (1) switch (_context.prev = _context.next) {
  94189. case 0:
  94190. _context.next = 2;
  94191. return reader.slice(size);
  94192. case 2:
  94193. return _context.abrupt("return", _context.sent);
  94194. case 3:
  94195. case "end":
  94196. return _context.stop();
  94197. }
  94198. }, _callee);
  94199. }));
  94200. return function read(_x8) {
  94201. return _ref.apply(this, arguments);
  94202. };
  94203. }();
  94204. _context2.t0 = Uint8Array;
  94205. _context2.next = 5;
  94206. return featurecollection_awaitAsyncGenerator(read(8, 'magic bytes'));
  94207. case 5:
  94208. _context2.t1 = _context2.sent;
  94209. bytes = new _context2.t0(_context2.t1);
  94210. if (bytes.subarray(0, 3).every(function (v, i) {
  94211. return constants_magicbytes[i] === v;
  94212. })) {
  94213. _context2.next = 9;
  94214. break;
  94215. }
  94216. throw new Error('Not a FlatGeobuf file');
  94217. case 9:
  94218. _context2.t2 = Uint8Array;
  94219. _context2.next = 12;
  94220. return featurecollection_awaitAsyncGenerator(read(4, 'header length'));
  94221. case 12:
  94222. _context2.t3 = _context2.sent;
  94223. bytes = new _context2.t2(_context2.t3);
  94224. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  94225. headerLength = bb.readUint32(0);
  94226. _context2.t4 = Uint8Array;
  94227. _context2.next = 19;
  94228. return featurecollection_awaitAsyncGenerator(read(headerLength, 'header data'));
  94229. case 19:
  94230. _context2.t5 = _context2.sent;
  94231. bytes = new _context2.t4(_context2.t5);
  94232. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  94233. headerMeta = fromByteBuffer(bb);
  94234. if (headerMetaFn) headerMetaFn(headerMeta);
  94235. indexNodeSize = headerMeta.indexNodeSize, featuresCount = headerMeta.featuresCount;
  94236. if (!(indexNodeSize > 0)) {
  94237. _context2.next = 29;
  94238. break;
  94239. }
  94240. treeSize = calcTreeSize(featuresCount, indexNodeSize);
  94241. _context2.next = 29;
  94242. return featurecollection_awaitAsyncGenerator(read(treeSize, 'entire index, w/o rect'));
  94243. case 29:
  94244. _context2.next = 31;
  94245. return featurecollection_awaitAsyncGenerator(readFeature(read, headerMeta, fromFeature));
  94246. case 31:
  94247. if (!(feature = _context2.sent)) {
  94248. _context2.next = 36;
  94249. break;
  94250. }
  94251. _context2.next = 34;
  94252. return feature;
  94253. case 34:
  94254. _context2.next = 29;
  94255. break;
  94256. case 36:
  94257. case "end":
  94258. return _context2.stop();
  94259. }
  94260. }, _callee2);
  94261. }));
  94262. return _deserializeStream.apply(this, arguments);
  94263. }
  94264. function deserializeFiltered(_x4, _x5, _x6, _x7) {
  94265. return _deserializeFiltered.apply(this, arguments);
  94266. }
  94267. function _deserializeFiltered() {
  94268. _deserializeFiltered = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee3(url, rect, fromFeature, headerMetaFn) {
  94269. var reader, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  94270. return featurecollection_regeneratorRuntime().wrap(function _callee3$(_context3) {
  94271. while (1) switch (_context3.prev = _context3.next) {
  94272. case 0:
  94273. _context3.next = 2;
  94274. return featurecollection_awaitAsyncGenerator(HttpReader.open(url));
  94275. case 2:
  94276. reader = _context3.sent;
  94277. Logger.debug('opened reader');
  94278. if (headerMetaFn) headerMetaFn(reader.header);
  94279. _iteratorAbruptCompletion = false;
  94280. _didIteratorError = false;
  94281. _context3.prev = 7;
  94282. _iterator = featurecollection_asyncIterator(reader.selectBbox(rect));
  94283. case 9:
  94284. _context3.next = 11;
  94285. return featurecollection_awaitAsyncGenerator(_iterator.next());
  94286. case 11:
  94287. if (!(_iteratorAbruptCompletion = !(_step = _context3.sent).done)) {
  94288. _context3.next = 18;
  94289. break;
  94290. }
  94291. feature = _step.value;
  94292. _context3.next = 15;
  94293. return fromFeature(feature, reader.header);
  94294. case 15:
  94295. _iteratorAbruptCompletion = false;
  94296. _context3.next = 9;
  94297. break;
  94298. case 18:
  94299. _context3.next = 24;
  94300. break;
  94301. case 20:
  94302. _context3.prev = 20;
  94303. _context3.t0 = _context3["catch"](7);
  94304. _didIteratorError = true;
  94305. _iteratorError = _context3.t0;
  94306. case 24:
  94307. _context3.prev = 24;
  94308. _context3.prev = 25;
  94309. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  94310. _context3.next = 29;
  94311. break;
  94312. }
  94313. _context3.next = 29;
  94314. return featurecollection_awaitAsyncGenerator(_iterator["return"]());
  94315. case 29:
  94316. _context3.prev = 29;
  94317. if (!_didIteratorError) {
  94318. _context3.next = 32;
  94319. break;
  94320. }
  94321. throw _iteratorError;
  94322. case 32:
  94323. return _context3.finish(29);
  94324. case 33:
  94325. return _context3.finish(24);
  94326. case 34:
  94327. case "end":
  94328. return _context3.stop();
  94329. }
  94330. }, _callee3, null, [[7, 20, 24, 34], [25,, 29, 33]]);
  94331. }));
  94332. return _deserializeFiltered.apply(this, arguments);
  94333. }
  94334. function readFeature(_x9, _x10, _x11) {
  94335. return _readFeature.apply(this, arguments);
  94336. }
  94337. function _readFeature() {
  94338. _readFeature = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee4(read, headerMeta, fromFeature) {
  94339. var bytes, bb, featureLength, bytesAligned, feature;
  94340. return featurecollection_regeneratorRuntime().wrap(function _callee4$(_context4) {
  94341. while (1) switch (_context4.prev = _context4.next) {
  94342. case 0:
  94343. _context4.t0 = Uint8Array;
  94344. _context4.next = 3;
  94345. return read(4, 'feature length');
  94346. case 3:
  94347. _context4.t1 = _context4.sent;
  94348. bytes = new _context4.t0(_context4.t1);
  94349. if (!(bytes.byteLength === 0)) {
  94350. _context4.next = 7;
  94351. break;
  94352. }
  94353. return _context4.abrupt("return");
  94354. case 7:
  94355. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  94356. featureLength = bb.readUint32(0);
  94357. _context4.t2 = Uint8Array;
  94358. _context4.next = 12;
  94359. return read(featureLength, 'feature data');
  94360. case 12:
  94361. _context4.t3 = _context4.sent;
  94362. bytes = new _context4.t2(_context4.t3);
  94363. bytesAligned = new Uint8Array(featureLength + 4);
  94364. bytesAligned.set(bytes, 4);
  94365. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  94366. bb.setPosition(SIZE_PREFIX_LEN);
  94367. feature = feature_Feature.getRootAsFeature(bb);
  94368. return _context4.abrupt("return", fromFeature(feature, headerMeta));
  94369. case 20:
  94370. case "end":
  94371. return _context4.stop();
  94372. }
  94373. }, _callee4);
  94374. }));
  94375. return _readFeature.apply(this, arguments);
  94376. }
  94377. function buildColumn(builder, column) {
  94378. var nameOffset = builder.createString(column.name);
  94379. Column.startColumn(builder);
  94380. Column.addName(builder, nameOffset);
  94381. Column.addType(builder, column.type);
  94382. return Column.endColumn(builder);
  94383. }
  94384. function featurecollection_buildHeader(header) {
  94385. var builder = new flatbuffers.Builder();
  94386. var columnOffsets = null;
  94387. if (header.columns) columnOffsets = Header.createColumnsVector(builder, header.columns.map(function (c) {
  94388. return buildColumn(builder, c);
  94389. }));
  94390. var nameOffset = builder.createString('L1');
  94391. Header.startHeader(builder);
  94392. Header.addFeaturesCount(builder, BigInt(header.featuresCount));
  94393. Header.addGeometryType(builder, header.geometryType);
  94394. Header.addIndexNodeSize(builder, 0);
  94395. if (columnOffsets) Header.addColumns(builder, columnOffsets);
  94396. Header.addName(builder, nameOffset);
  94397. var offset = Header.endHeader(builder);
  94398. builder.finishSizePrefixed(offset);
  94399. return builder.asUint8Array();
  94400. }
  94401. function valueToType(value) {
  94402. if (typeof value === 'boolean') return ColumnType.Bool;else if (typeof value === 'number') {
  94403. if (value % 1 === 0) return ColumnType.Int;else return ColumnType.Double;
  94404. } else if (typeof value === 'string') return ColumnType.String;else if (value === null) return ColumnType.String;else if (featurecollection_typeof(value) === 'object') return ColumnType.Json;else throw new Error("Unknown type (value '".concat(value, "')"));
  94405. }
  94406. function featurecollection_mapColumn(properties, k) {
  94407. return {
  94408. name: k,
  94409. type: valueToType(properties[k]),
  94410. title: null,
  94411. description: null,
  94412. width: -1,
  94413. precision: -1,
  94414. scale: -1,
  94415. nullable: true,
  94416. unique: false,
  94417. primary_key: false
  94418. };
  94419. }
  94420. function introspectHeaderMeta(features) {
  94421. var sampleFeature = features[0];
  94422. var properties = sampleFeature.getProperties ? sampleFeature.getProperties() : {};
  94423. var columns = null;
  94424. if (properties) columns = Object.keys(properties).filter(function (key) {
  94425. return key !== 'geometry';
  94426. }).map(function (k) {
  94427. return featurecollection_mapColumn(properties, k);
  94428. });
  94429. var geometryType = inferGeometryType(features);
  94430. var headerMeta = {
  94431. geometryType: geometryType,
  94432. columns: columns,
  94433. envelope: null,
  94434. featuresCount: features.length,
  94435. indexNodeSize: 0,
  94436. crs: null,
  94437. title: null,
  94438. description: null,
  94439. metadata: null
  94440. };
  94441. return headerMeta;
  94442. }
  94443. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/featurecollection.js
  94444. function geojson_featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = geojson_featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  94445. function geojson_featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return geojson_featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return geojson_featurecollection_arrayLikeToArray(o, minLen); }
  94446. function geojson_featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  94447. function featurecollection_serialize(featurecollection) {
  94448. var headerMeta = featurecollection_introspectHeaderMeta(featurecollection);
  94449. var header = buildHeader(headerMeta);
  94450. var features = featurecollection.features.map(function (f) {
  94451. return buildFeature(f.geometry.type === 'GeometryCollection' ? parseGC(f.geometry) : parseGeometry(f.geometry), f.properties, headerMeta);
  94452. });
  94453. var featuresLength = features.map(function (f) {
  94454. return f.length;
  94455. }).reduce(function (a, b) {
  94456. return a + b;
  94457. });
  94458. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  94459. uint8.set(header, magicbytes.length);
  94460. var offset = magicbytes.length + header.length;
  94461. var _iterator = geojson_featurecollection_createForOfIteratorHelper(features),
  94462. _step;
  94463. try {
  94464. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  94465. var feature = _step.value;
  94466. uint8.set(feature, offset);
  94467. offset += feature.length;
  94468. }
  94469. } catch (err) {
  94470. _iterator.e(err);
  94471. } finally {
  94472. _iterator.f();
  94473. }
  94474. uint8.set(magicbytes);
  94475. return uint8;
  94476. }
  94477. function featurecollection_deserialize(bytes, headerMetaFn) {
  94478. var features = deserialize(bytes, feature_fromFeature, headerMetaFn);
  94479. return {
  94480. type: 'FeatureCollection',
  94481. features: features
  94482. };
  94483. }
  94484. function featurecollection_deserializeStream(stream, headerMetaFn) {
  94485. return deserializeStream(stream, feature_fromFeature, headerMetaFn);
  94486. }
  94487. function featurecollection_deserializeFiltered(url, rect, headerMetaFn) {
  94488. return deserializeFiltered(url, rect, feature_fromFeature, headerMetaFn);
  94489. }
  94490. function featurecollection_introspectHeaderMeta(featurecollection) {
  94491. var feature = featurecollection.features[0];
  94492. var properties = feature.properties;
  94493. var columns = null;
  94494. if (properties) columns = Object.keys(properties).map(function (k) {
  94495. return mapColumn(properties, k);
  94496. });
  94497. var geometryType = inferGeometryType(featurecollection.features);
  94498. var headerMeta = {
  94499. geometryType: geometryType,
  94500. columns: columns,
  94501. envelope: null,
  94502. featuresCount: featurecollection.features.length,
  94503. indexNodeSize: 0,
  94504. crs: null,
  94505. title: null,
  94506. description: null,
  94507. metadata: null
  94508. };
  94509. return headerMeta;
  94510. }
  94511. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson.js
  94512. function geojson_serialize(geojson) {
  94513. var bytes = fcSerialize(geojson);
  94514. return bytes;
  94515. }
  94516. function geojson_deserialize(input, rect, headerMetaFn) {
  94517. if (input instanceof Uint8Array) return featurecollection_deserialize(input, headerMetaFn);else if (input instanceof ReadableStream) return featurecollection_deserializeStream(input, headerMetaFn);else return featurecollection_deserializeFiltered(input, rect, headerMetaFn);
  94518. }
  94519. ;// CONCATENATED MODULE: ./src/leaflet/overlay/FGBLayer.js
  94520. function FGBLayer_typeof(obj) { "@babel/helpers - typeof"; return FGBLayer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, FGBLayer_typeof(obj); }
  94521. function FGBLayer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGBLayer_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == FGBLayer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  94522. function FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  94523. function FGBLayer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  94524. function FGBLayer_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new FGBLayer_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  94525. function FGBLayer_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return FGBLayer_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, FGBLayer_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new FGBLayer_AsyncFromSyncIterator(s); }
  94526. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94527. * This program are made available under the terms of the Apache License, Version 2.0
  94528. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94529. /**
  94530. * @class FGBLayer
  94531. * @deprecatedclassinstance L.supermap.FGBLayer
  94532. * @classdesc FGB 图层类。该图层把 {@link FlatGeobuf} 格式解析为点线面要素。
  94533. * @version 11.1.0
  94534. * @category Visualization FGB
  94535. * @modulecategory Overlay
  94536. * @extends {L.LayerGroup}
  94537. * @param {string} url - FGB 服务地址,例如:http://localhost:8090/iserver/services/xxx/rest/data/featureResults/newResourceId.fgb。
  94538. * @param {Object} options - 参数。
  94539. * @param {function} [options.pointToLayer] - 定义点要素如何绘制在地图上。
  94540. * @param {function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。
  94541. * @param {string} [options.strategy='bbox'] - all为全量加载,要素会以流的方式渲染到地图。 bbox为当前可见范围加载,当地图范围改变时会重新加载要素,此时可以通过idField 参数来标识已被加载过的要素,被标识的要素无需再次加载。idField 参数无效时会清空要素,重新加载。
  94542. * @param {Array} [options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  94543. * @param {boolean} [options.idField='SmID'] - 是否指定要素字段作为唯一id,当 strategy 为 bbox 时生效。
  94544. * @param {function} [options.featureLoader] - 要素自定义方法。
  94545. * @param {function} [options.onEachFeature] - 要素创建时调用
  94546. * @usage
  94547. * ```
  94548. * // 浏览器
  94549. * <script type="text/javascript" src="{cdn}"></script>
  94550. * <script>
  94551. * new {namespace}.FGBLayer(url, options);
  94552. *
  94553. * </script>
  94554. *
  94555. * // ES6 Import
  94556. * import { FGBLayer } from '{npm}';
  94557. *
  94558. * new FGBLayer(url, options);
  94559. *
  94560. * ```
  94561. */
  94562. var FGBLayer = external_L_default().LayerGroup.extend({
  94563. initialize: function initialize(url, options) {
  94564. this.options = options || {};
  94565. this.strategy = this.options.strategy || 'bbox';
  94566. this._layers = {};
  94567. this.url = url;
  94568. this.previousLayer = null;
  94569. this.loadedExtentsRtree_ = new (rbush_default())();
  94570. this.extent = this.options.extent;
  94571. this._cacheIds = [];
  94572. this._validatedId = false;
  94573. this._checked = false;
  94574. this.idField = this.options.idField || 'SmID';
  94575. this._updateFeaturesFn = this._updateFeatures.bind(this);
  94576. external_L_default().Util.setOptions(this, options);
  94577. },
  94578. onAdd: function onAdd(map) {
  94579. this.map = map;
  94580. var extent = [];
  94581. if (this.strategy === 'bbox') {
  94582. var bounds = map.getBounds();
  94583. extent = [bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth()];
  94584. map.on('moveend', this._updateFeaturesFn);
  94585. }
  94586. if (this.extent) {
  94587. var intersectExtent = getIntersection(this.extent, extent);
  94588. extent = intersectExtent && intersectExtent.length ? intersectExtent : this.extent;
  94589. }
  94590. this._handleFeatures(extent);
  94591. },
  94592. onRemove: function onRemove(map) {
  94593. this.loadedExtentsRtree_.clear();
  94594. this.loadedExtentsRtree_ = null;
  94595. if (this.strategy === 'bbox') {
  94596. map.off('moveend', this._updateFeaturesFn);
  94597. this._cacheIds = [];
  94598. }
  94599. },
  94600. _updateFeatures: function () {
  94601. var _updateFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee(e) {
  94602. var _this = this;
  94603. var map, extent, extentToLoad, alreadyLoaded;
  94604. return FGBLayer_regeneratorRuntime().wrap(function _callee$(_context) {
  94605. while (1) switch (_context.prev = _context.next) {
  94606. case 0:
  94607. map = e.target;
  94608. extent = [map.getBounds().getSouthWest(), map.getBounds().getNorthEast()];
  94609. extentToLoad = [extent[0].lng, extent[0].lat, extent[1].lng, extent[1].lat];
  94610. alreadyLoaded = this._forEachInExtent(extentToLoad, function (object) {
  94611. return _this._containsExtent(object.extent, extentToLoad);
  94612. });
  94613. if (!alreadyLoaded) {
  94614. this._handleFeatures(extentToLoad);
  94615. }
  94616. case 5:
  94617. case "end":
  94618. return _context.stop();
  94619. }
  94620. }, _callee, this);
  94621. }));
  94622. function _updateFeatures(_x) {
  94623. return _updateFeatures2.apply(this, arguments);
  94624. }
  94625. return _updateFeatures;
  94626. }(),
  94627. _handleFeatures: function () {
  94628. var _handleFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee2(extent) {
  94629. var fgbStream, rect, fgb, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature, id;
  94630. return FGBLayer_regeneratorRuntime().wrap(function _callee2$(_context2) {
  94631. while (1) switch (_context2.prev = _context2.next) {
  94632. case 0:
  94633. rect = {
  94634. minX: extent[0],
  94635. minY: extent[1],
  94636. maxX: extent[2],
  94637. maxY: extent[3]
  94638. };
  94639. if (extent.length) {
  94640. _context2.next = 7;
  94641. break;
  94642. }
  94643. _context2.next = 4;
  94644. return this._getStream(this.url);
  94645. case 4:
  94646. fgbStream = _context2.sent;
  94647. _context2.next = 9;
  94648. break;
  94649. case 7:
  94650. rect.value = {
  94651. extent: extent.slice()
  94652. };
  94653. this.loadedExtentsRtree_.insert(rect);
  94654. case 9:
  94655. fgb = geojson_deserialize(fgbStream && fgbStream.body || this.url, rect);
  94656. if (!this._validatedId) {
  94657. this.curLayer = external_L_default().geoJSON(null, this.options);
  94658. this.previousLayer && this.removeLayer(this.previousLayer);
  94659. this.previousLayer = this.curLayer;
  94660. this.curLayer.addTo(this);
  94661. }
  94662. _iteratorAbruptCompletion = false;
  94663. _didIteratorError = false;
  94664. _context2.prev = 13;
  94665. _iterator = FGBLayer_asyncIterator(fgb);
  94666. case 15:
  94667. _context2.next = 17;
  94668. return _iterator.next();
  94669. case 17:
  94670. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  94671. _context2.next = 31;
  94672. break;
  94673. }
  94674. feature = _step.value;
  94675. if (!(this.strategy === 'bbox')) {
  94676. _context2.next = 26;
  94677. break;
  94678. }
  94679. id = feature.properties[this.idField];
  94680. if (id && !this._validatedId) {
  94681. this._validatedId = true;
  94682. this._checked = true;
  94683. }
  94684. if (!(id && this._checked)) {
  94685. _context2.next = 26;
  94686. break;
  94687. }
  94688. if (!this._cacheIds.includes(id)) {
  94689. _context2.next = 25;
  94690. break;
  94691. }
  94692. return _context2.abrupt("continue", 28);
  94693. case 25:
  94694. this._cacheIds.push(id);
  94695. case 26:
  94696. if (this.options.featureLoader && typeof this.options.featureLoader === 'function') {
  94697. feature = this.options.featureLoader(feature);
  94698. }
  94699. this.curLayer.addData(feature);
  94700. case 28:
  94701. _iteratorAbruptCompletion = false;
  94702. _context2.next = 15;
  94703. break;
  94704. case 31:
  94705. _context2.next = 37;
  94706. break;
  94707. case 33:
  94708. _context2.prev = 33;
  94709. _context2.t0 = _context2["catch"](13);
  94710. _didIteratorError = true;
  94711. _iteratorError = _context2.t0;
  94712. case 37:
  94713. _context2.prev = 37;
  94714. _context2.prev = 38;
  94715. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  94716. _context2.next = 42;
  94717. break;
  94718. }
  94719. _context2.next = 42;
  94720. return _iterator["return"]();
  94721. case 42:
  94722. _context2.prev = 42;
  94723. if (!_didIteratorError) {
  94724. _context2.next = 45;
  94725. break;
  94726. }
  94727. throw _iteratorError;
  94728. case 45:
  94729. return _context2.finish(42);
  94730. case 46:
  94731. return _context2.finish(37);
  94732. case 47:
  94733. case "end":
  94734. return _context2.stop();
  94735. }
  94736. }, _callee2, this, [[13, 33, 37, 47], [38,, 42, 46]]);
  94737. }));
  94738. function _handleFeatures(_x2) {
  94739. return _handleFeatures2.apply(this, arguments);
  94740. }
  94741. return _handleFeatures;
  94742. }(),
  94743. _getStream: function _getStream(url) {
  94744. return FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee3() {
  94745. return FGBLayer_regeneratorRuntime().wrap(function _callee3$(_context3) {
  94746. while (1) switch (_context3.prev = _context3.next) {
  94747. case 0:
  94748. _context3.next = 2;
  94749. return FetchRequest.get(url, {}, {
  94750. withoutFormatSuffix: true
  94751. }).then(function (response) {
  94752. return response;
  94753. });
  94754. case 2:
  94755. return _context3.abrupt("return", _context3.sent);
  94756. case 3:
  94757. case "end":
  94758. return _context3.stop();
  94759. }
  94760. }, _callee3);
  94761. }))();
  94762. },
  94763. _containsExtent: function _containsExtent(extent1, extent2) {
  94764. return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
  94765. },
  94766. _getInExtent: function _getInExtent(extent) {
  94767. var bbox = {
  94768. minX: extent[0],
  94769. minY: extent[1],
  94770. maxX: extent[2],
  94771. maxY: extent[3]
  94772. };
  94773. var items = this.loadedExtentsRtree_.search(bbox);
  94774. return items.map(function (item) {
  94775. return item.value;
  94776. });
  94777. },
  94778. _forEachInExtent: function _forEachInExtent(extent, callback) {
  94779. return this._forEach(this._getInExtent(extent), callback);
  94780. },
  94781. _forEach: function _forEach(values, callback) {
  94782. var result;
  94783. for (var i = 0, l = values.length; i < l; i++) {
  94784. result = callback(values[i]);
  94785. if (result) {
  94786. return result;
  94787. }
  94788. }
  94789. return result;
  94790. }
  94791. });
  94792. var fgbLayer = function fgbLayer(url, options) {
  94793. return new FGBLayer(url, options);
  94794. };
  94795. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/index.js
  94796. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94797. * This program are made available under the terms of the Apache License, Version 2.0
  94798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94799. ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/index.js
  94800. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94801. * This program are made available under the terms of the Apache License, Version 2.0
  94802. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94803. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/index.js
  94804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94805. * This program are made available under the terms of the Apache License, Version 2.0
  94806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94807. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/index.js
  94808. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94809. * This program are made available under the terms of the Apache License, Version 2.0
  94810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94811. ;// CONCATENATED MODULE: ./src/leaflet/services/KnowledgeGraphService.js
  94812. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94813. * This program are made available under the terms of the Apache License, Version 2.0
  94814. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94815. /**
  94816. * @class KnowledgeGraphService
  94817. * @category iServer KnowledgeGraph
  94818. * @classdesc 知识图谱服务类。
  94819. * @version 11.1.0
  94820. * @example
  94821. * new KnowledgeGraphService(url)
  94822. * .query(param,function(result){
  94823. * //doSomething
  94824. * })
  94825. * @extends {ServiceBase}
  94826. * @param {string} url - 服务地址。
  94827. * @param {Object} options -参数。
  94828. * @param {string} [options.proxy] - 服务代理地址。
  94829. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94830. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94831. * @param {Object} [options.headers] - 请求头。
  94832. * @usage
  94833. */
  94834. var KnowledgeGraphService_KnowledgeGraphService = ServiceBase.extend({
  94835. initialize: function (url, options) {
  94836. ServiceBase.prototype.initialize.call(this, url, options);
  94837. this._knowledgeGraphService = new KnowledgeGraphService(this.url, options);
  94838. },
  94839. /**
  94840. * @function KnowledgeGraphService.prototype.query
  94841. * @description 通过查询语句查询知识图谱数据。
  94842. * @param {string} cypherQuery - 查询条件。
  94843. * @param {RequestCallback} callback - 回调函数。
  94844. */
  94845. query(cypherQuery, callback) {
  94846. this._knowledgeGraphService.query(cypherQuery, callback);
  94847. },
  94848. // /**
  94849. // * @function KnowledgeGraphService.prototype.getMetaData
  94850. // * @description 获取元信息(展示所有实体类型和关系类型)。
  94851. // * @param {RequestCallback} callback 回调函数。
  94852. // */
  94853. // getMetaData(callback) {
  94854. // this._knowledgeGraphService.getMetaData(callback);
  94855. // },
  94856. /**
  94857. * @function KnowledgeGraphService.prototype.getGraphMaps
  94858. * @description 获取图谱列表。
  94859. * @param {RequestCallback} callback 回调函数。
  94860. */
  94861. getGraphMaps(callback) {
  94862. this._knowledgeGraphService.getGraphMaps(callback);
  94863. },
  94864. /**
  94865. * @function KnowledgeGraphService.prototype.getGraphMap
  94866. * @description 获取图谱图序列化数据。
  94867. * @param {string} params 图谱名称。
  94868. * @param {RequestCallback} callback 回调函数。
  94869. */
  94870. getGraphMap(params, callback) {
  94871. this._knowledgeGraphService.getGraphMap(params, callback);
  94872. },
  94873. /**
  94874. * @function KnowledgeGraphService.prototype.getGraphMapData
  94875. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  94876. * @param {string} graphMapName - 图谱名称。
  94877. * @returns {Promise} Promise 对象。
  94878. */
  94879. async getGraphMapData(graphMapName) {
  94880. const res = await this._knowledgeGraphService.getGraphMapData(graphMapName);
  94881. return res;
  94882. }
  94883. });
  94884. var knowledgeGraphService = function (url, options) {
  94885. return new KnowledgeGraphService_KnowledgeGraphService(url, options);
  94886. };
  94887. ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphMap.js
  94888. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94889. * This program are made available under the terms of the Apache License, Version 2.0
  94890. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94891. /**
  94892. * @class GraphMap
  94893. * @classdesc 对接 iServer GraphMap。
  94894. * @category iServer KnowledgeGraph
  94895. * @version 11.1.0
  94896. * @extends {L.Evented}
  94897. * @param {string} serverUrl - GraphMap服务地址, 例如:http://{iserver}/services/{knowledgeGraph-provider}/restjsr/graph/graphmaps/{graphmap}。
  94898. * @param {Object} [options] - 参数。
  94899. * @param {KnowledgeGraph.Config} [options.config] - KnowledgeGraph的配置项。
  94900. * @param {string} [options.proxy] - 服务代理地址。
  94901. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94902. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94903. * @param {Object} [options.headers] - 请求头。
  94904. * @fires GraphMap#loaded
  94905. * @extends {L.Evented}
  94906. * @usage
  94907. */
  94908. class GraphMap extends (external_L_default()).Evented {
  94909. initialize(serverUrl, options) {
  94910. if (!serverUrl) {
  94911. return;
  94912. }
  94913. /**
  94914. * @member GraphMap.prototype.graph
  94915. * @description KnowledgeGraph的实例.
  94916. *
  94917. */
  94918. this.graph = null;
  94919. /**
  94920. * @member GraphMap.prototype.EVENT_TYPES
  94921. * @description 监听一个自定义事件可用如下方式:
  94922. *
  94923. * 支持的事件如下:
  94924. * loaded - 渲染完成时触发。
  94925. */
  94926. this.EVENT_TYPES = ['loaded'];
  94927. const graphMapName = serverUrl.split('/').pop();
  94928. this.url = serverUrl.replace(`/graphmaps/${graphMapName}`, '');
  94929. this.createGraphMap(graphMapName, options);
  94930. }
  94931. /**
  94932. * @private
  94933. * @function GraphMap.prototype.createGraphMap
  94934. * @description 创建图谱。
  94935. * @param {string} graphMapName - 图谱名称
  94936. * @param {Object} options - 配置项
  94937. * @param {string} [options.proxy] - 服务代理地址
  94938. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie
  94939. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求
  94940. * @param {Object} [options.headers] - 请求头。
  94941. * @param {KnowledgeGraph.Config} [options.config] - knowledgegrah配置项。
  94942. */
  94943. async createGraphMap(graphMapName, options) {
  94944. this.knowledgeGraphService = this.createKnowledgeGraphService(this.url, options);
  94945. const res = await this.knowledgeGraphService.getGraphMapData(graphMapName);
  94946. const result = KnowledgeGraph.dataFromGraphMap(res.data, res.graphMap);
  94947. this.graph = new KnowledgeGraph(options && options.config);
  94948. this.graph.on('beforelayout', () => {
  94949. /**
  94950. * @event GraphMap#loaded
  94951. * @description 渲染完成时触发。
  94952. */
  94953. this.fire(this.EVENT_TYPES[0]);
  94954. });
  94955. this.graph.setData(result);
  94956. this.graph.handleNodeStatus(transformExpandCollapseHiddenData(res.graphMap));
  94957. }
  94958. /**
  94959. * @private
  94960. * @function GraphMap.prototype.createKnowledgeGraphService
  94961. * @description 创建KnowledgeGraphService实例。
  94962. * @param {string} serverUrl - GraphMap服务地址, 例如:http://{iserver}/services/knowledgeGraph-test/restjsr/graph
  94963. * @param {Object} options - 参数。
  94964. * @param {string} [options.proxy] - 服务代理地址。
  94965. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94966. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94967. * @param {Object} [options.headers] - 请求头。
  94968. */
  94969. createKnowledgeGraphService(serverUrl, options) {
  94970. return new KnowledgeGraphService_KnowledgeGraphService(serverUrl, options);
  94971. }
  94972. }
  94973. ;// CONCATENATED MODULE: ./src/leaflet/overlay/index.js
  94974. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94975. * This program are made available under the terms of the Apache License, Version 2.0
  94976. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94977. ;// CONCATENATED MODULE: ./src/leaflet/services/AddressMatchService.js
  94978. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94979. * This program are made available under the terms of the Apache License, Version 2.0
  94980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94981. /**
  94982. * @class AddressMatchService
  94983. * @deprecatedclassinstance L.supermap.addressMatchService
  94984. * @constructs AddressMatchService
  94985. * @classdesc 地址匹配服务类。
  94986. * @category iServer AddressMatch
  94987. * @modulecategory Services
  94988. * @extends {ServiceBase}
  94989. * @example
  94990. * new AddressMatchService(url,options)
  94991. * .code(function(result){
  94992. * //doSomething
  94993. * })
  94994. * @param {string} url - 服务地址。
  94995. * @param {Object} options - 参数。
  94996. * @param {string} [options.proxy] - 服务代理地址。
  94997. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94998. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94999. * @param {Object} [options.headers] - 请求头。
  95000. * @usage
  95001. */
  95002. var AddressMatchService_AddressMatchService = ServiceBase.extend({
  95003. initialize: function (url, options) {
  95004. ServiceBase.prototype.initialize.call(this, url, options);
  95005. var me = this;
  95006. this._addressMatchService = new AddressMatchService(this.url, {
  95007. proxy: me.options.proxy,
  95008. withCredentials: me.options.withCredentials,
  95009. crossOrigin: me.options.crossOrigin,
  95010. headers: me.options.headers
  95011. });
  95012. },
  95013. /**
  95014. * @function AddressMatchService.prototype.code
  95015. * @description 获取正向地址匹配结果。
  95016. * @param {GeoCodingParameter} params - 正向匹配参数。
  95017. * @param {RequestCallback} callback - 回调函数。
  95018. */
  95019. code: function (params, callback) {
  95020. this._addressMatchService.code(Util_Util.urlPathAppend(this.url, 'geocoding'), params, callback);
  95021. },
  95022. /**
  95023. * @function AddressMatchService.prototype.decode
  95024. * @description 获取反向地址匹配结果。
  95025. * @param {GeoDecodingParameter} params - 反向匹配参数。
  95026. * @param {RequestCallback} callback - 回调函数。
  95027. */
  95028. decode: function (params, callback) {
  95029. this._addressMatchService.decode(Util_Util.urlPathAppend(this.url, 'geodecoding'), params, callback);
  95030. }
  95031. });
  95032. var addressMatchService = function (url, options) {
  95033. return new AddressMatchService_AddressMatchService(url, options);
  95034. };
  95035. ;// CONCATENATED MODULE: ./src/common/iServer/ChartService.js
  95036. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95037. * This program are made available under the terms of the Apache License, Version 2.0
  95038. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95039. /**
  95040. * @class ChartService
  95041. * @category iServer Map Chart
  95042. * @classdesc 海图服务。
  95043. * @extends {ServiceBase}
  95044. * @example
  95045. * new ChartService(url).queryChart(param,function(result){
  95046. * //doSomething
  95047. * })
  95048. * @param {string} url - 服务地址。
  95049. * @param {Object} options - 参数。
  95050. * @param {string} [options.proxy] - 服务代理地址。
  95051. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95052. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95053. * @param {Object} [options.headers] - 请求头。
  95054. * @usage
  95055. */
  95056. class ChartService {
  95057. constructor(url, options) {
  95058. this.url = url;
  95059. this.options = options || {};
  95060. }
  95061. /**
  95062. * @function ChartService.prototype.queryChart
  95063. * @description 查询海图服务。
  95064. * @param {ChartQueryParameters} params - 海图查询所需参数类。
  95065. * @param {RequestCallback} callback - 回调函数。
  95066. * @param {DataFormat} resultFormat - 返回结果类型。
  95067. */
  95068. queryChart(params, callback, resultFormat) {
  95069. var me = this,
  95070. param = params,
  95071. format = me._processFormat(resultFormat);
  95072. var chartQueryService = new ChartQueryService(me.url, {
  95073. proxy: me.options.proxy,
  95074. withCredentials: me.options.withCredentials,
  95075. crossOrigin: me.options.crossOrigin,
  95076. headers: me.options.headers,
  95077. eventListeners: {
  95078. scope: me,
  95079. processCompleted: callback,
  95080. processFailed: callback
  95081. },
  95082. format: format
  95083. });
  95084. chartQueryService.processAsync(param);
  95085. }
  95086. /**
  95087. * @function ChartService.prototype.getChartFeatureInfo
  95088. * @description 获取海图物标信息服务。
  95089. * @param {RequestCallback} callback 回调函数。
  95090. */
  95091. getChartFeatureInfo(callback) {
  95092. var me = this;
  95093. var url = Util_Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs');
  95094. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  95095. proxy: me.options.proxy,
  95096. withCredentials: me.options.withCredentials,
  95097. crossOrigin: me.options.crossOrigin,
  95098. headers: me.options.headers,
  95099. eventListeners: {
  95100. scope: me,
  95101. processCompleted: callback,
  95102. processFailed: callback
  95103. }
  95104. });
  95105. chartFeatureInfoSpecsService.processAsync();
  95106. }
  95107. _processFormat(resultFormat) {
  95108. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  95109. }
  95110. }
  95111. ;// CONCATENATED MODULE: ./src/leaflet/services/ChartService.js
  95112. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95113. * This program are made available under the terms of the Apache License, Version 2.0
  95114. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95115. /**
  95116. * @class ChartService
  95117. * @deprecatedclassinstance L.supermap.chartService
  95118. * @classdesc 海图服务。
  95119. * @category iServer Map Chart
  95120. * @modulecategory Services
  95121. * @extends {ServiceBase}
  95122. * @example
  95123. * new ChartService(url)
  95124. * .queryChart(param,function(result){
  95125. * //doSomething
  95126. * })
  95127. * @param {string} url - 服务地址。
  95128. * @param {Object} options - 参数。
  95129. * @param {string} [options.proxy] - 服务代理地址。
  95130. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95131. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95132. * @param {Object} [options.headers] - 请求头。
  95133. * @usage
  95134. */
  95135. var ChartService_ChartService = ServiceBase.extend({
  95136. initialize: function (url, options) {
  95137. ServiceBase.prototype.initialize.call(this, url, options);
  95138. this._chartServiceBase = new ChartService(url, options);
  95139. },
  95140. /**
  95141. * @function ChartService.prototype.queryChart
  95142. * @description 查询海图服务。
  95143. * @param {ChartQueryParameters} params - 海图查询参数类。
  95144. * @param {RequestCallback} callback - 回调函数。
  95145. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95146. */
  95147. queryChart: function (params, callback, resultFormat) {
  95148. params = this._processParams(params);
  95149. this._chartServiceBase.queryChart(params, callback, resultFormat);
  95150. },
  95151. /**
  95152. * @function ChartService.prototype.getChartFeatureInfo
  95153. * @description 获取海图物标信息。
  95154. * @param {RequestCallback} callback - 回调函数。
  95155. */
  95156. getChartFeatureInfo: function (callback) {
  95157. this._chartServiceBase.getChartFeatureInfo(callback);
  95158. },
  95159. _processParams: function (params) {
  95160. if (!params) {
  95161. return {};
  95162. }
  95163. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  95164. if (params.chartQueryFilterParameters && !external_L_default().Util.isArray(params.chartQueryFilterParameters)) {
  95165. params.chartQueryFilterParameters = [params.chartQueryFilterParameters];
  95166. }
  95167. if (params.bounds) {
  95168. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  95169. }
  95170. },
  95171. _processFormat: function (resultFormat) {
  95172. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  95173. }
  95174. });
  95175. var chartService = function (url, options) {
  95176. return new ChartService_ChartService(url, options);
  95177. };
  95178. ;// CONCATENATED MODULE: ./src/leaflet/services/DatasetService.js
  95179. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95180. * This program are made available under the terms of the Apache License, Version 2.0
  95181. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95182. /**
  95183. * @class DatasetService
  95184. * @deprecatedclassinstance L.supermap.datasetService
  95185. * @classdesc 数据集信息服务类。
  95186. * @category iServer Data Dataset
  95187. * @modulecategory Services
  95188. * @extends {ServiceBase}
  95189. * @param {string} url - 服务地址。
  95190. * @param {Object} options - 参数。
  95191. * @param {string} [options.proxy] - 服务代理地址。
  95192. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95193. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95194. * @param {Object} [options.headers] - 请求头。
  95195. * @usage
  95196. */
  95197. var DatasetService_DatasetService = ServiceBase.extend({
  95198. initialize: function (url,options) {
  95199. ServiceBase.prototype.initialize.call(this, url,options);
  95200. this._datasetService = new DatasetService(this.url, {
  95201. proxy: this.options.proxy,
  95202. withCredentials: this.options.withCredentials,
  95203. crossOrigin: this.options.crossOrigin,
  95204. headers: this.options.headers
  95205. });
  95206. },
  95207. /**
  95208. * @function DatasetService.prototype.getDatasets
  95209. * @description 数据集查询服务。
  95210. * @example
  95211. * new DatasetService(url).getDatasets(datasourceName,function(result){
  95212. * //doSomething
  95213. * });
  95214. * @param {string} datasourceName - 数据源名称。
  95215. * @param {RequestCallback} callback - 回调函数。
  95216. */
  95217. getDatasets: function (datasourceName, callback) {
  95218. if (!datasourceName) {
  95219. return;
  95220. }
  95221. this._datasetService.getDatasetsService(datasourceName, callback);
  95222. },
  95223. /**
  95224. * @function DatasetService.prototype.getDataset
  95225. * @description 数据集信息查询服务。
  95226. * @example
  95227. * new DatasetService(url).getDataset(datasourceName, datasetName, function(result){
  95228. * //doSomething
  95229. * });
  95230. * @param {string} datasourceName - 数据源名称。
  95231. * @param {string} datasetName - 数据集名称。
  95232. * @param {RequestCallback} callback - 回调函数。
  95233. */
  95234. getDataset: function (datasourceName, datasetName, callback) {
  95235. if (!datasourceName || !datasetName) {
  95236. return;
  95237. }
  95238. this._datasetService.getDatasetService(datasourceName, datasetName, callback);
  95239. },
  95240. /**
  95241. * @function DatasetService.prototype.setDataset
  95242. * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
  95243. * @example
  95244. * new DatasetService(url).setDataset(params, function(result){
  95245. * //doSomething
  95246. * });
  95247. * @param {CreateDatasetParameters | UpdateDatasetParameters } params - 数据集创建参数类(当前数据源下的数据集不存在时,新建数据集) || 数据集信息更改参数类(当前数据源下的数据集存在时,更改数据集信息)
  95248. * @param {RequestCallback} callback - 回调函数。
  95249. */
  95250. setDataset(params, callback) {
  95251. if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
  95252. return;
  95253. }else if (params instanceof CreateDatasetParameters) {
  95254. var datasetParams = {
  95255. "datasetType": params.datasetType,
  95256. "datasourceName": params.datasourceName,
  95257. "datasetName": params.datasetName
  95258. }
  95259. }else if(params instanceof UpdateDatasetParameters){
  95260. datasetParams = {
  95261. "datasetName": params.datasetName,
  95262. "datasourceName": params.datasourceName,
  95263. "isFileCache": params.isFileCache,
  95264. "description": params.description,
  95265. "prjCoordSys": params.prjCoordSys,
  95266. "charset": params.charset
  95267. }
  95268. }
  95269. this._datasetService.setDatasetService(datasetParams, callback);
  95270. },
  95271. /**
  95272. * @function DatasetService.prototype.deleteDataset
  95273. * @description 指定数据源下的数据集删除服务。
  95274. * @example
  95275. * new DatasetService(url).deleteDataset(datasourceName, datasetName, function(result){
  95276. * //doSomething
  95277. * });
  95278. * @param {string} datasourceName - 数据源名称。
  95279. * @param {string} datasetName - 数据集名称。
  95280. * @param {RequestCallback} callback - 回调函数。
  95281. */
  95282. deleteDataset: function (datasourceName, datasetName, callback) {
  95283. this._datasetService.deleteDatasetService(datasourceName, datasetName, callback);
  95284. }
  95285. });
  95286. var datasetService = function (url, options) {
  95287. return new DatasetService_DatasetService(url, options);
  95288. };
  95289. ;// CONCATENATED MODULE: ./src/leaflet/services/DatasourceService.js
  95290. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95291. * This program are made available under the terms of the Apache License, Version 2.0
  95292. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95293. /**
  95294. * @class DatasourceService
  95295. * @deprecatedclassinstance L.supermap.datasourceService
  95296. * @classdesc 数据源服务类。
  95297. * @category iServer Data Datasource
  95298. * @modulecategory Services
  95299. * @extends {ServiceBase}
  95300. * @param {string} url - 服务地址。
  95301. * @param {Object} options - 参数。
  95302. * @param {string} [options.proxy] - 服务代理地址。
  95303. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95304. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95305. * @param {Object} [options.headers] - 请求头。
  95306. * @usage
  95307. */
  95308. var DatasourceService_DatasourceService = ServiceBase.extend({
  95309. initialize: function (url,options) {
  95310. ServiceBase.prototype.initialize.call(this, url, options);
  95311. this._datasourceService = new DatasourceService(this.url, {
  95312. proxy: this.proxy,
  95313. withCredentials: this.withCredentials,
  95314. crossOrigin: this.crossOrigin,
  95315. headers: this.headers
  95316. });
  95317. },
  95318. /**
  95319. * @function DatasourceService.prototype.getDatasources
  95320. * @description 数据源集查询服务。
  95321. * @example
  95322. * new DatasourceService(url).getDatasources(function(result){
  95323. * //doSomething
  95324. * });
  95325. * @param {RequestCallback} callback - 回调函数。
  95326. */
  95327. getDatasources: function (callback) {
  95328. this._datasourceService.getDatasourcesService(callback);
  95329. },
  95330. /**
  95331. * @function DatasourceService.prototype.getDatasource
  95332. * @description 数据源信息查询服务。
  95333. * @example
  95334. * new DatasourceService(url).getDatasource(datasourceName,function(result){
  95335. * //doSomething
  95336. * });
  95337. * @param datasourceName - 数据源名称。
  95338. * @param {RequestCallback} callback - 回调函数。
  95339. */
  95340. getDatasource: function (datasourceName, callback) {
  95341. if (!datasourceName) {
  95342. return;
  95343. }
  95344. this._datasourceService.getDatasourceService(datasourceName, callback);
  95345. },
  95346. /**
  95347. * @function DatasourceService.prototype.setDatasource
  95348. * @description 数据源信息设置服务。可实现更改当前数据源信息。
  95349. * @example
  95350. * new DatasourceService(url).setDatasource(params, function(result){
  95351. * //doSomething
  95352. * });
  95353. * @param {SetDatasourceParameters} params - 数据源信息设置参数类。
  95354. * @param {RequestCallback} callback - 回调函数。
  95355. */
  95356. setDatasource: function(params, callback) {
  95357. if (!(params instanceof SetDatasourceParameters)) {
  95358. return;
  95359. }
  95360. const datasourceParams = {
  95361. description: params.description,
  95362. coordUnit: params.coordUnit,
  95363. distanceUnit: params.distanceUnit,
  95364. datasourceName: params.datasourceName
  95365. };
  95366. this._datasourceService.setDatasourceService(datasourceParams, callback);
  95367. }
  95368. });
  95369. var datasourceService = function (url, options) {
  95370. return new DatasourceService_DatasourceService(url, options);
  95371. };
  95372. ;// CONCATENATED MODULE: ./src/common/iServer/FieldService.js
  95373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95374. * This program are made available under the terms of the Apache License, Version 2.0
  95375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95376. /**
  95377. * @class FieldService
  95378. * @category iServer Data Field
  95379. * @classdesc 字段服务类。
  95380. * @example
  95381. * new FieldService(url).getFields(function(result){
  95382. * //doSomething
  95383. * });
  95384. * @param {string} url - 服务地址。
  95385. * @param {Object} options - 参数。
  95386. * @param {string} [options.proxy] - 服务代理地址。
  95387. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95388. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95389. * @param {Object} [options.headers] - 请求头。
  95390. * @extends {ServiceBase}
  95391. * @usage
  95392. */
  95393. class FieldService {
  95394. constructor(url, options) {
  95395. this.url = url;
  95396. this.options = options || {};
  95397. }
  95398. /**
  95399. * @function FieldService.prototype.getFields
  95400. * @description 字段查询服务。
  95401. * @param {FieldParameters} params - 字段信息查询参数类。
  95402. * @param {RequestCallback} callback 回调函数。
  95403. */
  95404. getFields(params, callback) {
  95405. var me = this;
  95406. var getFieldsService = new GetFieldsService(me.url, {
  95407. proxy: me.options.proxy,
  95408. withCredentials: me.options.withCredentials,
  95409. crossOrigin: me.options.crossOrigin,
  95410. headers: me.options.headers,
  95411. eventListeners: {
  95412. scope: me,
  95413. processCompleted: callback,
  95414. processFailed: callback
  95415. },
  95416. datasource: params.datasource,
  95417. dataset: params.dataset
  95418. });
  95419. getFieldsService.processAsync();
  95420. }
  95421. /**
  95422. * @function FieldService.prototype.getFieldStatisticsInfo
  95423. * @description 字段统计服务。
  95424. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  95425. * @param {RequestCallback} callback 回调函数。
  95426. */
  95427. getFieldStatisticsInfo(params, callback) {
  95428. if (!(params instanceof FieldStatisticsParameters)) {
  95429. return;
  95430. }
  95431. var me = this,
  95432. fieldName = params.fieldName,
  95433. modes = params.statisticMode;
  95434. if (modes && !Array.isArray(modes)) {
  95435. modes = [modes];
  95436. }
  95437. me.currentStatisticResult = {fieldName: fieldName};
  95438. me._statisticsCallback = callback;
  95439. //针对每种统计方式分别进行请求
  95440. modes.forEach(mode => {
  95441. me.currentStatisticResult[mode] = null;
  95442. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  95443. })
  95444. }
  95445. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  95446. var me = this;
  95447. var statisticService = new FieldStatisticService(me.url, {
  95448. eventListeners: {
  95449. scope: me,
  95450. processCompleted: me._processCompleted.bind(me),
  95451. processFailed: me._statisticsCallback
  95452. },
  95453. datasource: datasource,
  95454. dataset: dataset,
  95455. field: fieldName,
  95456. statisticMode: statisticMode,
  95457. crossOrigin: me.options.crossOrigin,
  95458. headers: me.options.headers
  95459. });
  95460. statisticService.processAsync();
  95461. }
  95462. _processCompleted(fieldStatisticResult, options) {
  95463. var me = this;
  95464. var getAll = true,
  95465. result = fieldStatisticResult.result;
  95466. if (this.currentStatisticResult) {
  95467. if (null == me.currentStatisticResult[result.mode]) {
  95468. this.currentStatisticResult[result.mode] = result.result;
  95469. }
  95470. }
  95471. for (var mode in me.currentStatisticResult) {
  95472. if (null == me.currentStatisticResult[mode]) {
  95473. getAll = false;
  95474. break;
  95475. }
  95476. }
  95477. if (getAll) {
  95478. me._statisticsCallback({result: me.currentStatisticResult, options});
  95479. }
  95480. }
  95481. }
  95482. ;// CONCATENATED MODULE: ./src/leaflet/services/FieldService.js
  95483. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95484. * This program are made available under the terms of the Apache License, Version 2.0
  95485. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95486. /**
  95487. * @class FieldService
  95488. * @deprecatedclassinstance L.supermap.fieldService
  95489. * @classdesc 字段服务类。
  95490. * @category iServer Data Field
  95491. * @modulecategory Services
  95492. * @extends {ServiceBase}
  95493. * @example
  95494. * new FieldService(url).getFields(function(result){
  95495. * //doSomething
  95496. * });
  95497. * @param {string} url - 服务地址。
  95498. * @param {Object} options - 参数。
  95499. * @param {string} [options.proxy] - 服务代理地址。
  95500. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95501. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95502. * @param {Object} [options.headers] - 请求头。
  95503. * @usage
  95504. */
  95505. var FieldService_FieldService = ServiceBase.extend({
  95506. initialize: function (url,options) {
  95507. ServiceBase.prototype.initialize.call(this, url,options);
  95508. this._fieldService = new FieldService(url, options);
  95509. },
  95510. /**
  95511. * @function FieldService.prototype.getFields
  95512. * @description 字段查询服务。
  95513. * @param {FieldParameters} params - 字段信息查询参数类。
  95514. * @param {RequestCallback} callback - 回调函数。
  95515. */
  95516. getFields: function (params, callback) {
  95517. this._fieldService.getFields(params, callback);
  95518. },
  95519. /**
  95520. * @function FieldService.prototype.getFieldStatisticsInfo
  95521. * @description 字段统计服务。
  95522. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  95523. * @param {RequestCallback} callback - 回调函数。
  95524. */
  95525. getFieldStatisticsInfo: function (params, callback) {
  95526. this._fieldService.getFieldStatisticsInfo(params, callback);
  95527. }
  95528. });
  95529. var fieldService = function (url, options) {
  95530. return new FieldService_FieldService(url, options);
  95531. };
  95532. ;// CONCATENATED MODULE: ./src/leaflet/services/GridCellInfosService.js
  95533. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95534. * This program are made available under the terms of the Apache License, Version 2.0
  95535. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95536. /**
  95537. * @class GridCellInfosService
  95538. * @deprecatedclassinstance L.supermap.gridCellInfosService
  95539. * @classdesc 数据栅格查询服务类。
  95540. * @category iServer Data Grid
  95541. * @modulecategory Services
  95542. * @extends {ServiceBase}
  95543. * @example
  95544. * new GridCellInfosService(url)
  95545. * .getGridCellInfos(param,function(result){
  95546. * //doSomething
  95547. * })
  95548. * @param {string} url - 服务地址。
  95549. * @param {Object} options - 参数。
  95550. * @param {string} [options.proxy] - 服务代理地址。
  95551. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95552. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95553. * @param {Object} [options.headers] - 请求头。
  95554. * @usage
  95555. */
  95556. var GridCellInfosService = ServiceBase.extend({
  95557. initialize: function (url, options) {
  95558. ServiceBase.prototype.initialize.call(this, url, options);
  95559. this._gridCellQueryService = new GetGridCellInfosService(this.url, {
  95560. proxy: this.options.proxy,
  95561. withCredentials: this.options.withCredentials,
  95562. crossOrigin: this.options.crossOrigin,
  95563. headers: this.options.headers
  95564. });
  95565. },
  95566. /**
  95567. * @function GridCellInfosService.prototype.getGridCellInfos
  95568. * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
  95569. * @param {RequestCallback} callback - 回调函数。
  95570. */
  95571. getGridCellInfos: function (params, callback) {
  95572. if (!params) {
  95573. return null;
  95574. }
  95575. this._gridCellQueryService.processAsync(params, callback);
  95576. }
  95577. });
  95578. var gridCellInfosService = function (url, options) {
  95579. return new GridCellInfosService(url, options);
  95580. };
  95581. ;// CONCATENATED MODULE: ./src/leaflet/services/GeoprocessingService.js
  95582. /**
  95583. * @class GeoprocessingService
  95584. * @deprecatedclassinstance L.supermap.geoprocessingService
  95585. * @classdesc 处理自动化服务接口类。
  95586. * @version 10.1.0
  95587. * @category iServer ProcessingAutomationService
  95588. * @modulecategory Services
  95589. * @extends ServiceBase
  95590. * @example
  95591. * //为了安全访问受保护的处理自动化服务,必须通过传递 iserver 令牌( token ),才能正确访问相关资源。
  95592. * SecurityManager.registerToken(serviceUrl, token);
  95593. * var geoprocessingService = new GeoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  95594. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  95595. console.log(serverResult.result);
  95596. var jobID = serverResult.result.jobID;
  95597. var options = {
  95598. interval: 5000,
  95599. statusCallback: function(state) {
  95600. console.log("Job Status: ", state);
  95601. }
  95602. };
  95603. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  95604. console.log(serverResult);
  95605. })
  95606. })
  95607. *
  95608. * @param {string} url - 服务地址。
  95609. * @param {Object} options - 参数。
  95610. * @usage
  95611. */
  95612. const GeoprocessingService_GeoprocessingService = ServiceBase.extend({
  95613. initialize: function (url, options) {
  95614. options = options || {};
  95615. external_L_default().setOptions(this, options);
  95616. ServiceBase.prototype.initialize.call(this, url, options);
  95617. this.headers = {};
  95618. this.crossOrigin = true;
  95619. this.withCredentials = true;
  95620. this.proxy = true;
  95621. this._geoprocessingJobsService = new GeoprocessingService(this.url, {
  95622. proxy: this.options.proxy,
  95623. withCredentials: this.options.withCredentials,
  95624. crossOrigin: this.options.crossOrigin,
  95625. headers: this.options.headers
  95626. });
  95627. },
  95628. /**
  95629. * @function GeoprocessingService.prototype.getTools
  95630. * @description 获取处理自动化工具列表。
  95631. * @param {RequestCallback} callback - 回调函数。
  95632. */
  95633. getTools: function (callback) {
  95634. this._geoprocessingJobsService.getTools(callback);
  95635. },
  95636. /**
  95637. * @function GeoprocessingService.prototype.getTool
  95638. * @description 获取工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  95639. * @param {string} identifier - 处理自动化工具ID。
  95640. * @param {RequestCallback} callback - 回调函数。
  95641. */
  95642. getTool: function (identifier, callback) {
  95643. this._geoprocessingJobsService.getTool(identifier, callback);
  95644. },
  95645. /**
  95646. * @function GeoprocessingService.prototype.execute
  95647. * @description 同步执行处理自动化工具。
  95648. * @param {string} identifier - 处理自动化工具 ID。
  95649. * @param {Object} parameter - 处理自动化工具的输入参数。
  95650. * @param {Object} environment - 处理自动化工具的环境参数。
  95651. * @param {RequestCallback} callback - 回调函数。
  95652. */
  95653. execute: function (identifier, parameter, environment, callback) {
  95654. this._geoprocessingJobsService.execute(identifier, parameter, environment, callback);
  95655. },
  95656. /**
  95657. * @function GeoprocessingService.prototype.submitJob
  95658. * @description 异步执行处理自动化工具。
  95659. * @param {string} identifier - 处理自动化工具ID。
  95660. * @param {Object} parameter - 处理自动化工具的输入参数。
  95661. * @param {Object} environment - 处理自动化工具的环境参数。
  95662. * @param {RequestCallback} callback - 回调函数。
  95663. */
  95664. submitJob: function (identifier, parameter, environment, callback) {
  95665. this._geoprocessingJobsService.submitJob(identifier, parameter, environment, callback);
  95666. },
  95667. /**
  95668. * @function GeoprocessingService.prototype.waitForJobCompletion
  95669. * @description 获取处理自动化异步执行状态信息。
  95670. * @param {string} jobId - 处理自动化任务ID。
  95671. * @param {string} identifier - 处理自动化工具ID。
  95672. * @param {Object} options - 参数。
  95673. * @param {number} options.interval - 定时器时间间隔。
  95674. * @param {RequestCallback} options.statusCallback - 任务状态的回调函数。
  95675. * @param {function} callback 回调函数。
  95676. */
  95677. waitForJobCompletion: function (jobId, identifier, options, callback) {
  95678. this._geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options, callback);
  95679. },
  95680. /**
  95681. * @function GeoprocessingService.prototype.getJobInfo
  95682. * @description 获取处理自动化任务的执行信息。
  95683. * @param {string} identifier - 处理自动化工具 ID。
  95684. * @param {string} jobId - 处理自动化任务 ID。
  95685. * @param {RequestCallback} callback - 回调函数。
  95686. */
  95687. getJobInfo: function (identifier, jobId, callback) {
  95688. this._geoprocessingJobsService.getJobInfo(identifier, jobId, callback);
  95689. },
  95690. /**
  95691. * @function GeoprocessingService.prototype.cancelJob
  95692. * @description 取消处理自动化任务的异步执行。
  95693. * @param {string} identifier - 处理自动化工具 ID。
  95694. * @param {string} jobId - 处理自动化任务 ID。
  95695. * @param {RequestCallback} callback - 回调函数。
  95696. */
  95697. cancelJob: function (identifier, jobId, callback) {
  95698. this._geoprocessingJobsService.cancelJob(identifier, jobId, callback);
  95699. },
  95700. /**
  95701. * @function GeoprocessingService.prototype.getJobs
  95702. * @description 获取处理自动化服务任务列表。
  95703. * @param {string} identifier - 处理自动化工具 ID。(传参代表 identifier 算子的任务列表,不传参代表所有任务的列表)
  95704. * @param {RequestCallback} callback - 回调函数。
  95705. */
  95706. getJobs: function (identifier, callback) {
  95707. this._geoprocessingJobsService.getJobs(identifier, callback);
  95708. },
  95709. /**
  95710. * @function GeoprocessingService.prototype.getResults
  95711. * @description 处理自动化工具异步执行的结果,支持结果过滤。
  95712. * @param {string} identifier - 处理自动化工具 ID。
  95713. * @param {string} jobId - 处理自动化任务 ID。
  95714. * @param {string} filter - 输出异步结果的 ID。(可选,传入 filter 参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  95715. * @param {RequestCallback} callback - 回调函数。
  95716. */
  95717. getResults: function (identifier, jobId, filter, callback) {
  95718. this._geoprocessingJobsService.getResults(identifier, jobId, filter, callback);
  95719. }
  95720. });
  95721. const geoprocessingService = function (url, options) {
  95722. return new GeoprocessingService_GeoprocessingService(url, options);
  95723. };
  95724. ;// CONCATENATED MODULE: ./src/common/iServer/LayerInfoService.js
  95725. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95726. * This program are made available under the terms of the Apache License, Version 2.0
  95727. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95728. /**
  95729. * @class LayerInfoService
  95730. * @category iServer Map Layer
  95731. * @classdesc 图层信息服务类。
  95732. * @extends {ServiceBase}
  95733. * @example
  95734. * new LayerInfoService(url).getLayersInfo(function(result){
  95735. * //doSomething
  95736. * })
  95737. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  95738. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  95739. * @param {Object} options - 参数。
  95740. * @param {string} [options.proxy] - 服务代理地址。
  95741. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  95742. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95743. * @param {Object} [options.headers] - 请求头。
  95744. * @usage
  95745. */
  95746. class LayerInfoService {
  95747. constructor(url, options) {
  95748. this.url = url;
  95749. this.options = options || {};
  95750. }
  95751. /**
  95752. * @function LayerInfoService.prototype.getLayersInfo
  95753. * @description 获取图层信息服务。
  95754. * @param {RequestCallback} callback - 回调函数。
  95755. */
  95756. getLayersInfo(callback) {
  95757. var me = this;
  95758. var getLayersInfoService = new GetLayersInfoService(me.url, {
  95759. proxy: me.options.proxy,
  95760. withCredentials: me.options.withCredentials,
  95761. crossOrigin: me.options.crossOrigin,
  95762. headers: me.options.headers,
  95763. eventListeners: {
  95764. processCompleted: callback,
  95765. processFailed: callback
  95766. }
  95767. });
  95768. getLayersInfoService.processAsync();
  95769. }
  95770. /**
  95771. * @function LayerInfoService.prototype.setLayerInfo
  95772. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  95773. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  95774. * @param {RequestCallback} callback - 回调函数。
  95775. */
  95776. setLayerInfo(params, callback) {
  95777. if (!params) {
  95778. return;
  95779. }
  95780. var me = this,
  95781. resourceID = params.resourceID,
  95782. tempLayerName = params.tempLayerName,
  95783. layerInfoParams = params.layerInfo;
  95784. if (!resourceID || !tempLayerName) {
  95785. return;
  95786. }
  95787. var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  95788. var setLayerInfoService = new SetLayerInfoService(url, {
  95789. proxy: me.options.proxy,
  95790. withCredentials: me.options.withCredentials,
  95791. crossOrigin: me.options.crossOrigin,
  95792. headers: me.options.headers,
  95793. eventListeners: {
  95794. processCompleted: callback,
  95795. processFailed: callback
  95796. }
  95797. });
  95798. setLayerInfoService.processAsync(layerInfoParams);
  95799. }
  95800. /**
  95801. * @function LayerInfoService.prototype.setLayersInfo
  95802. * @description 设置图层信息服务。可以创建新的临时图层和修改现有的临时图层。
  95803. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  95804. * @param {RequestCallback} callback - 回调函数。
  95805. */
  95806. setLayersInfo(params, callback) {
  95807. if (!params) {
  95808. return;
  95809. }
  95810. var me = this,
  95811. resourceID = params.resourceID,
  95812. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  95813. layersInfo = params.layersInfo;
  95814. if ((isTempLayers && !resourceID) || !layersInfo) {
  95815. return;
  95816. }
  95817. var setLayersInfoService = new SetLayersInfoService(me.url, {
  95818. proxy: me.options.proxy,
  95819. withCredentials: me.options.withCredentials,
  95820. crossOrigin: me.options.crossOrigin,
  95821. headers: me.options.headers,
  95822. eventListeners: {
  95823. processCompleted: callback,
  95824. processFailed: callback
  95825. },
  95826. resourceID: resourceID,
  95827. isTempLayers: isTempLayers
  95828. });
  95829. setLayersInfoService.processAsync(layersInfo);
  95830. }
  95831. /**
  95832. * @function LayerInfoService.prototype.setLayerStatus
  95833. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  95834. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  95835. * @param {RequestCallback} callback - 回调函数。
  95836. */
  95837. setLayerStatus(params, callback) {
  95838. if (!params) {
  95839. return;
  95840. }
  95841. var me = this;
  95842. var setLayerStatusService = new SetLayerStatusService(me.url, {
  95843. proxy: me.options.proxy,
  95844. withCredentials: me.options.withCredentials,
  95845. crossOrigin: me.options.crossOrigin,
  95846. headers: me.options.headers,
  95847. eventListeners: {
  95848. processCompleted: callback,
  95849. processFailed: callback
  95850. }
  95851. });
  95852. setLayerStatusService.processAsync(params);
  95853. }
  95854. }
  95855. ;// CONCATENATED MODULE: ./src/leaflet/services/LayerInfoService.js
  95856. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95857. * This program are made available under the terms of the Apache License, Version 2.0
  95858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95859. /**
  95860. * @class LayerInfoService
  95861. * @deprecatedclassinstance L.supermap.layerInfoService
  95862. * @classdesc 图层信息类。
  95863. * @category iServer Map Layer
  95864. * @modulecategory Services
  95865. * @extends {ServiceBase}
  95866. * @example
  95867. * new LayerInfoService(url).getLayersInfo(function(result){
  95868. * //doSomething
  95869. * })
  95870. * @param {string} url - 服务地址。
  95871. * @param {Object} options - 参数。
  95872. * @param {string} [options.proxy] - 服务代理地址。
  95873. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95874. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95875. * @param {Object} [options.headers] - 请求头。
  95876. * @usage
  95877. */
  95878. var LayerInfoService_LayerInfoService = ServiceBase.extend({
  95879. initialize: function (url, options) {
  95880. ServiceBase.prototype.initialize.call(this, url, options);
  95881. this._layerInfoService = new LayerInfoService(url, options);
  95882. },
  95883. /**
  95884. * @function LayerInfoService.prototype.getLayersInfo
  95885. * @description 获取图层信息。
  95886. * @param {RequestCallback} callback - 回调函数。
  95887. */
  95888. getLayersInfo: function (callback) {
  95889. this._layerInfoService.getLayersInfo(callback);
  95890. },
  95891. /**
  95892. * @function LayerInfoService.prototype.setLayerInfo
  95893. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  95894. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  95895. * @param {RequestCallback} callback - 回调函数。
  95896. */
  95897. setLayerInfo: function (params, callback) {
  95898. this._layerInfoService.setLayerInfo(params, callback);
  95899. },
  95900. /**
  95901. * @function LayerInfoService.prototype.setLayersInfo
  95902. * @description 设置图层信息。可以实现创建新的临时图层和修改现有的临时图层。
  95903. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  95904. * @param {RequestCallback} callback - 回调函数。
  95905. */
  95906. setLayersInfo: function (params, callback) {
  95907. this._layerInfoService.setLayersInfo(params, callback);
  95908. },
  95909. /**
  95910. * @function LayerInfoService.prototype.setLayerStatus
  95911. * @description 负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  95912. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  95913. * @param {RequestCallback} callback - 回调函数。
  95914. */
  95915. setLayerStatus: function (params, callback) {
  95916. this._layerInfoService.setLayerStatus(params, callback);
  95917. }
  95918. });
  95919. var layerInfoService = function (url, options) {
  95920. return new LayerInfoService_LayerInfoService(url, options);
  95921. };
  95922. ;// CONCATENATED MODULE: ./src/leaflet/services/MeasureService.js
  95923. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95924. * This program are made available under the terms of the Apache License, Version 2.0
  95925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95926. /**
  95927. * @class MeasureService
  95928. * @deprecatedclassinstance L.supermap.measureService
  95929. * @classdesc 量算服务类。
  95930. * @category iServer Map Measure
  95931. * @modulecategory Services
  95932. * @example
  95933. * 用法:
  95934. * new MeasureService(url).measureDistance({
  95935. * geometry:xxx
  95936. * },function(result){
  95937. * //doSomething
  95938. * })
  95939. * @param {string} url - 服务地址。
  95940. * @param {Object} options - 参数。
  95941. * @param {string} [options.proxy] - 服务代理地址。
  95942. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95943. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95944. * @param {Object} [options.headers] - 请求头。
  95945. * @extends {ServiceBase}
  95946. * @usage
  95947. */
  95948. var MeasureService_MeasureService = ServiceBase.extend({
  95949. initialize: function (url, options) {
  95950. ServiceBase.prototype.initialize.call(this, url, options);
  95951. },
  95952. /**
  95953. * @function MeasureService.prototype.measureDistance
  95954. * @description 测距。
  95955. * @param {MeasureParameters} params - 量算参数类。
  95956. * @param {RequestCallback} callback - 回调函数。
  95957. */
  95958. measureDistance: function (params, callback) {
  95959. this.measure(MeasureMode.DISTANCE, params, callback);
  95960. return this;
  95961. },
  95962. /**
  95963. * @function MeasureService.prototype.measureArea
  95964. * @description 测面积。
  95965. * @param {MeasureParameters} params - 量算参数类。
  95966. * @param {RequestCallback} callback - 回调函数。
  95967. */
  95968. measureArea: function (params, callback) {
  95969. this.measure(MeasureMode.AREA, params, callback);
  95970. return this;
  95971. },
  95972. /**
  95973. * @function MeasureService.measure
  95974. * @param {MeasureMode} [type=MeasureMode.DISTANCE] - 量算模式。
  95975. * @param {MeasureParameters} params - 量算参数类。
  95976. * @param {RequestCallback} callback - 回调函数。
  95977. */
  95978. measure: function (type, params, callback) {
  95979. if (!(params instanceof MeasureParameters)) {
  95980. return;
  95981. }
  95982. var me = this;
  95983. if (params.geometry) {
  95984. params.geometry = Util_toSuperMapGeometry(params.geometry);
  95985. }
  95986. var measureService = new MeasureService(me.url, {
  95987. proxy: me.options.proxy,
  95988. withCredentials: me.options.withCredentials,
  95989. crossOrigin: me.options.crossOrigin,
  95990. headers: me.options.headers,
  95991. measureMode: type
  95992. });
  95993. measureService.processAsync(params, callback);
  95994. }
  95995. });
  95996. var measureService = function (url, options) {
  95997. return new MeasureService_MeasureService(url, options);
  95998. };
  95999. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalyst3DService.js
  96000. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96001. * This program are made available under the terms of the Apache License, Version 2.0
  96002. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96003. /**
  96004. * @class NetworkAnalyst3DService
  96005. * @category iServer FacilityAnalyst3D
  96006. * @classdesc 3D 网络分析服务类。
  96007. * @extends {ServiceBase}
  96008. * @example
  96009. * new NetworkAnalyst3DService(url).sinksFacilityAnalyst(params,function(result){
  96010. * //doSomething
  96011. * })
  96012. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  96013. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  96014. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  96015. * @param {Object} options - 参数。
  96016. * @param {string} [options.proxy] - 服务代理地址。
  96017. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  96018. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96019. * @param {Object} [options.headers] - 请求头。
  96020. * @usage
  96021. */
  96022. class NetworkAnalyst3DService {
  96023. constructor(url, options) {
  96024. this.url = url;
  96025. this.options = options || {};
  96026. }
  96027. /**
  96028. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  96029. * @description 汇查找服务
  96030. * @param {FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  96031. * @param {RequestCallback} callback - 回调函数。
  96032. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  96033. */
  96034. sinksFacilityAnalyst(params, callback) {
  96035. var me = this;
  96036. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  96037. proxy: me.options.proxy,
  96038. withCredentials: me.options.withCredentials,
  96039. crossOrigin: me.options.crossOrigin,
  96040. headers: me.options.headers,
  96041. eventListeners: {
  96042. scope: me,
  96043. processCompleted: callback,
  96044. processFailed: callback
  96045. }
  96046. });
  96047. facilityAnalystSinks3DService.processAsync(params);
  96048. }
  96049. /**
  96050. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  96051. * @description 源查找服务。
  96052. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  96053. * @param {RequestCallback} callback - 回调函数。
  96054. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  96055. */
  96056. sourcesFacilityAnalyst(params, callback) {
  96057. var me = this;
  96058. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  96059. proxy: me.options.proxy,
  96060. withCredentials: me.options.withCredentials,
  96061. crossOrigin: me.options.crossOrigin,
  96062. headers: me.options.headers,
  96063. eventListeners: {
  96064. scope: me,
  96065. processCompleted: callback,
  96066. processFailed: callback
  96067. }
  96068. });
  96069. facilityAnalystSources3DService.processAsync(params);
  96070. }
  96071. /**
  96072. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  96073. * @description 上游追踪资源服务。
  96074. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  96075. * @param {RequestCallback} callback - 回调函数。
  96076. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  96077. */
  96078. traceUpFacilityAnalyst(params, callback) {
  96079. var me = this;
  96080. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  96081. proxy: me.options.proxy,
  96082. withCredentials: me.options.withCredentials,
  96083. crossOrigin: me.options.crossOrigin,
  96084. headers: me.options.headers,
  96085. eventListeners: {
  96086. scope: me,
  96087. processCompleted: callback,
  96088. processFailed: callback
  96089. }
  96090. });
  96091. facilityAnalystTraceup3DService.processAsync(params);
  96092. }
  96093. /**
  96094. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  96095. * @description 下游追踪资源服务。
  96096. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  96097. * @param {RequestCallback} callback - 回调函数。
  96098. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  96099. */
  96100. traceDownFacilityAnalyst(params, callback) {
  96101. var me = this;
  96102. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  96103. proxy: me.options.proxy,
  96104. withCredentials: me.options.withCredentials,
  96105. crossOrigin: me.options.crossOrigin,
  96106. headers: me.options.headers,
  96107. eventListeners: {
  96108. scope: me,
  96109. processCompleted: callback,
  96110. processFailed: callback
  96111. }
  96112. });
  96113. facilityAnalystTracedown3DService.processAsync(params);
  96114. }
  96115. /**
  96116. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  96117. * @description 上游关键设施查找服务。
  96118. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  96119. * @param {RequestCallback} callback - 回调函数。
  96120. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  96121. */
  96122. upstreamFacilityAnalyst(params, callback) {
  96123. var me = this;
  96124. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  96125. proxy: me.options.proxy,
  96126. withCredentials: me.options.withCredentials,
  96127. crossOrigin: me.options.crossOrigin,
  96128. headers: me.options.headers,
  96129. eventListeners: {
  96130. scope: me,
  96131. processCompleted: callback,
  96132. processFailed: callback
  96133. }
  96134. });
  96135. facilityAnalystUpstream3DService.processAsync(params);
  96136. }
  96137. }
  96138. ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalyst3DService.js
  96139. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96140. * This program are made available under the terms of the Apache License, Version 2.0
  96141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96142. /**
  96143. * @class NetworkAnalyst3DService
  96144. * @deprecatedclassinstance L.supermap.networkAnalyst3DService
  96145. * @classdesc 3D 网络分析服务类。
  96146. * @category iServer FacilityAnalyst3D
  96147. * @modulecategory Services
  96148. * @extends {ServiceBase}
  96149. * @example
  96150. * new NetworkAnalyst3DService(url)
  96151. * .sinksFacilityAnalyst(params,function(result){
  96152. * //doSomething
  96153. * })
  96154. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  96155. * "http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  96156. * @param {Object} options - 参数。
  96157. * @param {string} [options.proxy] - 服务代理地址。
  96158. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  96159. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96160. * @param {Object} [options.headers] - 请求头。
  96161. * @usage
  96162. */
  96163. var NetworkAnalyst3DService_NetworkAnalyst3DService = ServiceBase.extend({
  96164. initialize: function (url, options) {
  96165. ServiceBase.prototype.initialize.call(this, url, options);
  96166. this._networkAnalyst3DService = new NetworkAnalyst3DService(url, options);
  96167. },
  96168. /**
  96169. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  96170. * @description 汇查找服务。
  96171. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  96172. * @param {RequestCallback} callback - 回调函数。
  96173. */
  96174. sinksFacilityAnalyst: function (params, callback) {
  96175. this._networkAnalyst3DService.sinksFacilityAnalyst(params, callback);
  96176. },
  96177. /**
  96178. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  96179. * @description 源查找服务。
  96180. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)。
  96181. * @param {RequestCallback} callback - 回调函数。
  96182. * @returns {NetworkAnalyst3DService} NetworkAnalyst3DService的实例对象。
  96183. */
  96184. sourcesFacilityAnalyst: function (params, callback) {
  96185. this._networkAnalyst3DService.sourcesFacilityAnalyst(params, callback);
  96186. },
  96187. /**
  96188. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  96189. * @description 上游追踪资源服务。
  96190. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  96191. * @param {RequestCallback} callback - 回调函数。
  96192. * @returns {NetworkAnalyst3DService} NetworkAnalyst3DService的实例对象。
  96193. */
  96194. traceUpFacilityAnalyst: function (params, callback) {
  96195. this._networkAnalyst3DService.traceUpFacilityAnalyst(params, callback);
  96196. },
  96197. /**
  96198. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  96199. * @description 下游追踪资源服务。
  96200. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  96201. * @param {RequestCallback} callback - 回调函数。
  96202. */
  96203. traceDownFacilityAnalyst: function (params, callback) {
  96204. this._networkAnalyst3DService.traceDownFacilityAnalyst(params, callback);
  96205. },
  96206. /**
  96207. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  96208. * @description 上游关键设施查找服务。
  96209. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类。
  96210. * @param {RequestCallback} callback - 回调函数。
  96211. */
  96212. upstreamFacilityAnalyst: function (params, callback) {
  96213. this._networkAnalyst3DService.upstreamFacilityAnalyst(params, callback);
  96214. }
  96215. });
  96216. var networkAnalyst3DService = function (url, options) {
  96217. return new NetworkAnalyst3DService_NetworkAnalyst3DService(url, options);
  96218. };
  96219. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystService.js
  96220. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96221. * This program are made available under the terms of the Apache License, Version 2.0
  96222. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96223. /**
  96224. * @class NetworkAnalystService
  96225. * @category iServer NetworkAnalyst
  96226. * @classdesc 网络分析服务类。
  96227. * @extends {ServiceBase}
  96228. * @example
  96229. * new NetworkAnalystService(url)
  96230. * .findPath(params,function(result){
  96231. * //doSomething
  96232. * })
  96233. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  96234. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  96235. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  96236. * @param {Object} options - 参数。
  96237. * @param {string} [options.proxy] - 服务代理地址。
  96238. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  96239. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96240. * @param {Object} [options.headers] - 请求头。
  96241. * @usage
  96242. */
  96243. class NetworkAnalystService {
  96244. constructor(url, options) {
  96245. this.url = url;
  96246. this.options = options || {};
  96247. }
  96248. /**
  96249. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  96250. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  96251. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  96252. * @param {RequestCallback} callback 回调函数。
  96253. */
  96254. burstPipelineAnalyst(params, callback) {
  96255. var me = this;
  96256. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  96257. proxy: me.options.proxy,
  96258. withCredentials: me.options.withCredentials,
  96259. crossOrigin: me.options.crossOrigin,
  96260. headers: me.options.headers,
  96261. eventListeners: {
  96262. scope: me,
  96263. processCompleted: callback,
  96264. processFailed: callback
  96265. }
  96266. });
  96267. burstPipelineAnalystService.processAsync(params);
  96268. }
  96269. /**
  96270. * @function NetworkAnalystService.prototype.computeWeightMatrix
  96271. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  96272. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  96273. * @param {RequestCallback} callback - 回调函数。
  96274. */
  96275. computeWeightMatrix(params, callback) {
  96276. var me = this;
  96277. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  96278. proxy: me.options.proxy,
  96279. withCredentials: me.options.withCredentials,
  96280. crossOrigin: me.options.crossOrigin,
  96281. headers: me.options.headers,
  96282. eventListeners: {
  96283. scope: me,
  96284. processCompleted: callback,
  96285. processFailed: callback
  96286. }
  96287. });
  96288. computeWeightMatrixService.processAsync(params);
  96289. }
  96290. /**
  96291. * @function NetworkAnalystService.prototype.findClosestFacilities
  96292. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  96293. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  96294. * @param {RequestCallback} callback 回调函数。
  96295. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96296. */
  96297. findClosestFacilities(params, callback, resultFormat) {
  96298. var me = this;
  96299. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  96300. proxy: me.options.proxy,
  96301. withCredentials: me.options.withCredentials,
  96302. crossOrigin: me.options.crossOrigin,
  96303. headers: me.options.headers,
  96304. eventListeners: {
  96305. scope: me,
  96306. processCompleted: callback,
  96307. processFailed: callback
  96308. },
  96309. format: me._processFormat(resultFormat)
  96310. });
  96311. findClosestFacilitiesService.processAsync(params);
  96312. }
  96313. /**
  96314. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  96315. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  96316. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  96317. * @param {RequestCallback} callback 回调函数。
  96318. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96319. */
  96320. streamFacilityAnalyst(params, callback, resultFormat) {
  96321. var me = this;
  96322. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  96323. proxy: me.options.proxy,
  96324. withCredentials: me.options.withCredentials,
  96325. crossOrigin: me.options.crossOrigin,
  96326. headers: me.options.headers,
  96327. eventListeners: {
  96328. scope: me,
  96329. processCompleted: callback,
  96330. processFailed: callback
  96331. },
  96332. format: me._processFormat(resultFormat)
  96333. });
  96334. facilityAnalystStreamService.processAsync(params);
  96335. }
  96336. /**
  96337. * @function NetworkAnalystService.prototype.findLocation
  96338. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  96339. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  96340. * @param {RequestCallback} callback 回调函数。
  96341. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96342. */
  96343. findLocation(params, callback, resultFormat) {
  96344. var me = this;
  96345. var findLocationService = new FindLocationService(me.url, {
  96346. proxy: me.options.proxy,
  96347. withCredentials: me.options.withCredentials,
  96348. crossOrigin: me.options.crossOrigin,
  96349. headers: me.options.headers,
  96350. eventListeners: {
  96351. scope: me,
  96352. processCompleted: callback,
  96353. processFailed: callback
  96354. },
  96355. format: me._processFormat(resultFormat)
  96356. });
  96357. findLocationService.processAsync(params);
  96358. }
  96359. /**
  96360. * @function NetworkAnalystService.prototype.findPath
  96361. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  96362. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  96363. * @param {RequestCallback} callback - 回调函数。
  96364. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96365. */
  96366. findPath(params, callback, resultFormat) {
  96367. var me = this;
  96368. var findPathService = new FindPathService(me.url, {
  96369. proxy: me.options.proxy,
  96370. withCredentials: me.options.withCredentials,
  96371. crossOrigin: me.options.crossOrigin,
  96372. headers: me.options.headers,
  96373. eventListeners: {
  96374. scope: me,
  96375. processCompleted: callback,
  96376. processFailed: callback
  96377. },
  96378. format: me._processFormat(resultFormat)
  96379. });
  96380. findPathService.processAsync(params);
  96381. }
  96382. /**
  96383. * @function NetworkAnalystService.prototype.findTSPPaths
  96384. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  96385. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  96386. * @param {RequestCallback} callback - 回调函数。
  96387. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96388. */
  96389. findTSPPaths(params, callback, resultFormat) {
  96390. var me = this;
  96391. var findTSPPathsService = new FindTSPPathsService(me.url, {
  96392. proxy: me.options.proxy,
  96393. withCredentials: me.options.withCredentials,
  96394. crossOrigin: me.options.crossOrigin,
  96395. headers: me.options.headers,
  96396. eventListeners: {
  96397. scope: me,
  96398. processCompleted: callback,
  96399. processFailed: callback
  96400. },
  96401. format: me._processFormat(resultFormat)
  96402. });
  96403. findTSPPathsService.processAsync(params);
  96404. }
  96405. /**
  96406. * @function NetworkAnalystService.prototype.findMTSPPaths
  96407. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  96408. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  96409. * @param {RequestCallback} callback - 回调函数。
  96410. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96411. */
  96412. findMTSPPaths(params, callback, resultFormat) {
  96413. var me = this;
  96414. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  96415. proxy: me.options.proxy,
  96416. withCredentials: me.options.withCredentials,
  96417. crossOrigin: me.options.crossOrigin,
  96418. headers: me.options.headers,
  96419. eventListeners: {
  96420. scope: me,
  96421. processCompleted: callback,
  96422. processFailed: callback
  96423. },
  96424. format: me._processFormat(resultFormat)
  96425. });
  96426. findMTSPPathsService.processAsync(params);
  96427. }
  96428. /**
  96429. * @function NetworkAnalystService.prototype.findServiceAreas
  96430. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  96431. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  96432. * @param {RequestCallback} callback 回调函数。
  96433. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96434. */
  96435. findServiceAreas(params, callback, resultFormat) {
  96436. var me = this;
  96437. var findServiceAreasService = new FindServiceAreasService(me.url, {
  96438. proxy: me.options.proxy,
  96439. withCredentials: me.options.withCredentials,
  96440. crossOrigin: me.options.crossOrigin,
  96441. headers: me.options.headers,
  96442. eventListeners: {
  96443. scope: me,
  96444. processCompleted: callback,
  96445. processFailed: callback
  96446. },
  96447. format: me._processFormat(resultFormat)
  96448. });
  96449. findServiceAreasService.processAsync(params);
  96450. }
  96451. /**
  96452. * @function NetworkAnalystService.prototype.updateEdgeWeight
  96453. * @description 更新边的耗费权重服务。
  96454. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  96455. * @param {RequestCallback} callback 回调函数。
  96456. */
  96457. updateEdgeWeight(params, callback) {
  96458. var me = this;
  96459. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  96460. proxy: me.options.proxy,
  96461. withCredentials: me.options.withCredentials,
  96462. crossOrigin: me.options.crossOrigin,
  96463. headers: me.options.headers,
  96464. eventListeners: {
  96465. scope: me,
  96466. processCompleted: callback,
  96467. processFailed: callback
  96468. }
  96469. });
  96470. updateEdgeWeightService.processAsync(params);
  96471. }
  96472. /**
  96473. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  96474. * @description 转向耗费权重更新服务。
  96475. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  96476. * @param {RequestCallback} callback - 回调函数。
  96477. */
  96478. updateTurnNodeWeight(params, callback) {
  96479. var me = this;
  96480. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  96481. proxy: me.options.proxy,
  96482. withCredentials: me.options.withCredentials,
  96483. crossOrigin: me.options.crossOrigin,
  96484. headers: me.options.headers,
  96485. eventListeners: {
  96486. scope: me,
  96487. processCompleted: callback,
  96488. processFailed: callback
  96489. }
  96490. });
  96491. updateTurnNodeWeightService.processAsync(params);
  96492. }
  96493. _processFormat(resultFormat) {
  96494. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  96495. }
  96496. }
  96497. ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalystService.js
  96498. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96499. * This program are made available under the terms of the Apache License, Version 2.0
  96500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96501. /**
  96502. * @class NetworkAnalystService
  96503. * @deprecatedclassinstance L.supermap.networkAnalystService
  96504. * @classdesc 网络分析服务类。
  96505. * @category iServer NetworkAnalyst
  96506. * @modulecategory Services
  96507. * @example
  96508. * new NetworkAnalystService(url)
  96509. * .findPath(params,function(result){
  96510. * //doSomething
  96511. * })
  96512. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  96513. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。<br>
  96514. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  96515. * @param {Object} options - 参数。
  96516. * @param {string} [options.proxy] - 服务代理地址。
  96517. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  96518. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96519. * @param {Object} [options.headers] - 请求头。
  96520. * @extends {ServiceBase}
  96521. * @usage
  96522. */
  96523. var NetworkAnalystService_NetworkAnalystService = ServiceBase.extend({
  96524. initialize: function (url, options) {
  96525. ServiceBase.prototype.initialize.call(this, url, options);
  96526. this._networkAnalystService = new NetworkAnalystService(url, options);
  96527. },
  96528. /**
  96529. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  96530. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  96531. * @param {BurstPipelineAnalystParameters} params - 爆管分析参数类。
  96532. * @param {RequestCallback} callback - 回调函数。
  96533. */
  96534. burstPipelineAnalyst: function (params, callback) {
  96535. params = this._processParams(params);
  96536. this._networkAnalystService.burstPipelineAnalyst(params, callback);
  96537. },
  96538. /**
  96539. * @function NetworkAnalystService.prototype.computeWeightMatrix
  96540. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  96541. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类。
  96542. * @param {RequestCallback} callback - 回调函数。
  96543. */
  96544. computeWeightMatrix: function (params, callback) {
  96545. params = this._processParams(params);
  96546. this._networkAnalystService.computeWeightMatrix(params, callback);
  96547. },
  96548. /**
  96549. * @function NetworkAnalystService.prototype.findClosestFacilities
  96550. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  96551. * @param {FindClosestFacilitiesParameters} params - 最近设施分析参数类。
  96552. * @param {RequestCallback} callback - 回调函数。
  96553. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96554. */
  96555. findClosestFacilities: function (params, callback, resultFormat) {
  96556. params = this._processParams(params);
  96557. this._networkAnalystService.findClosestFacilities(params, callback, resultFormat);
  96558. },
  96559. /**
  96560. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  96561. * @description 上游/下游关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  96562. * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  96563. * @param {RequestCallback} callback - 回调函数。
  96564. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96565. */
  96566. streamFacilityAnalyst: function (params, callback, resultFormat) {
  96567. params = this._processParams(params);
  96568. this._networkAnalystService.streamFacilityAnalyst(params, callback, resultFormat);
  96569. },
  96570. /**
  96571. * @function NetworkAnalystService.prototype.findLocation
  96572. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  96573. * @param {FindLocationParameters} params - 选址分区分析参数类。
  96574. * @param {RequestCallback} callback - 回调函数。
  96575. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96576. */
  96577. findLocation: function (params, callback, resultFormat) {
  96578. params = this._processParams(params);
  96579. this._networkAnalystService.findLocation(params, callback, resultFormat);
  96580. },
  96581. /**
  96582. * @function NetworkAnalystService.prototype.findPath
  96583. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  96584. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  96585. * @param {RequestCallback} callback - 回调函数。
  96586. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96587. */
  96588. findPath: function (params, callback, resultFormat) {
  96589. params = this._processParams(params);
  96590. this._networkAnalystService.findPath(params, callback, resultFormat);
  96591. },
  96592. /**
  96593. * @function NetworkAnalystService.prototype.findTSPPaths
  96594. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  96595. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  96596. * @param {RequestCallback} callback - 回调函数。
  96597. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96598. */
  96599. findTSPPaths: function (params, callback, resultFormat) {
  96600. params = this._processParams(params);
  96601. this._networkAnalystService.findTSPPaths(params, callback, resultFormat);
  96602. },
  96603. /**
  96604. * @function NetworkAnalystService.prototype.findMTSPPaths
  96605. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  96606. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  96607. * @param {RequestCallback} callback - 回调函数。
  96608. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96609. */
  96610. findMTSPPaths: function (params, callback, resultFormat) {
  96611. params = this._processParams(params);
  96612. this._networkAnalystService.findMTSPPaths(params, callback, resultFormat);
  96613. },
  96614. /**
  96615. * @function NetworkAnalystService.prototype.findServiceAreas
  96616. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  96617. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  96618. * @param {RequestCallback} callback - 回调函数。
  96619. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96620. */
  96621. findServiceAreas: function (params, callback, resultFormat) {
  96622. params = this._processParams(params);
  96623. this._networkAnalystService.findServiceAreas(params, callback, resultFormat);
  96624. },
  96625. /**
  96626. * @function NetworkAnalystService.prototype.updateEdgeWeight
  96627. * @description 更新边的耗费权重服务。
  96628. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  96629. * @param {RequestCallback} callback -回调函数。
  96630. */
  96631. updateEdgeWeight: function (params, callback) {
  96632. this._networkAnalystService.updateEdgeWeight(params, callback);
  96633. },
  96634. /**
  96635. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  96636. * @description 转向耗费权重更新服务。
  96637. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  96638. * @param {RequestCallback} callback - 回调函数。
  96639. */
  96640. updateTurnNodeWeight: function (params, callback) {
  96641. this._networkAnalystService.updateTurnNodeWeight(params, callback);
  96642. },
  96643. _processParams: function (params) {
  96644. if (!params) {
  96645. return {};
  96646. }
  96647. if (params.centers && external_L_default().Util.isArray(params.centers)) {
  96648. params.centers.map(function (point, key) {
  96649. params.centers[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  96650. return params.centers[key];
  96651. });
  96652. }
  96653. if (params.nodes && external_L_default().Util.isArray(params.nodes)) {
  96654. params.nodes.map(function (point, key) {
  96655. params.nodes[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  96656. return params.nodes[key];
  96657. });
  96658. }
  96659. if (params.event && params.event instanceof (external_L_default()).LatLng) {
  96660. params.event = {x: params.event.lng, y: params.event.lat};
  96661. }
  96662. if (params.facilities && external_L_default().Util.isArray(params.facilities)) {
  96663. params.facilities.map(function (point, key) {
  96664. params.facilities[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  96665. return params.facilities[key];
  96666. });
  96667. }
  96668. if (params.parameter && params.parameter.barrierPoints) {
  96669. var barrierPoints = params.parameter.barrierPoints;
  96670. if (external_L_default().Util.isArray(barrierPoints)) {
  96671. barrierPoints.map(function (point, key) {
  96672. params.parameter.barrierPoints[key] = (point instanceof (external_L_default()).LatLng) ? {
  96673. x: point.lng,
  96674. y: point.lat
  96675. } : point;
  96676. return params.parameter.barrierPoints[key];
  96677. });
  96678. } else {
  96679. params.parameter.barrierPoints = [(barrierPoints instanceof (external_L_default()).LatLng) ? {
  96680. x: barrierPoints.lng,
  96681. y: barrierPoints.lat
  96682. } : barrierPoints];
  96683. }
  96684. }
  96685. return params;
  96686. },
  96687. _processFormat: function (resultFormat) {
  96688. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  96689. }
  96690. });
  96691. var networkAnalystService = function (url, options) {
  96692. return new NetworkAnalystService_NetworkAnalystService(url, options);
  96693. };
  96694. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingService.js
  96695. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96696. * This program are made available under the terms of the Apache License, Version 2.0
  96697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96698. /**
  96699. * @class ProcessingService
  96700. * @category iServer ProcessingService
  96701. * @classdesc 分布式分析相关服务类。
  96702. * @extends {ServiceBase}
  96703. * @example
  96704. * new ProcessingService(url,options)
  96705. * .getKernelDensityJobs(function(result){
  96706. * //doSomething
  96707. * })
  96708. * @param {string} url - 服务地址。
  96709. * @param {Object} options - 参数。
  96710. * @param {string} [options.proxy] - 服务代理地址。
  96711. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  96712. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96713. * @param {Object} [options.headers] - 请求头。
  96714. * @usage
  96715. */
  96716. class ProcessingService {
  96717. constructor(url, options) {
  96718. this.url = url;
  96719. this.options = options || {};
  96720. this.kernelDensityJobs = {};
  96721. this.summaryMeshJobs = {};
  96722. this.queryJobs = {};
  96723. this.summaryRegionJobs = {};
  96724. this.vectorClipJobs = {};
  96725. this.overlayGeoJobs = {};
  96726. this.buffersJobs = {};
  96727. this.topologyValidatorJobs = {};
  96728. this.summaryAttributesJobs = {};
  96729. }
  96730. /**
  96731. * @function ProcessingService.prototype.getKernelDensityJobs
  96732. * @description 获取密度分析的列表。
  96733. * @param {RequestCallback} callback - 回调函数。
  96734. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96735. */
  96736. getKernelDensityJobs(callback, resultFormat) {
  96737. var me = this,
  96738. format = me._processFormat(resultFormat);
  96739. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96740. proxy: me.options.proxy,
  96741. withCredentials: me.options.withCredentials,
  96742. crossOrigin: me.options.crossOrigin,
  96743. headers: me.options.headers,
  96744. eventListeners: {
  96745. scope: me,
  96746. processCompleted: callback,
  96747. processFailed: callback
  96748. },
  96749. format: format
  96750. });
  96751. kernelDensityJobsService.getKernelDensityJobs();
  96752. }
  96753. /**
  96754. * @function ProcessingService.prototype.getKernelDensityJob
  96755. * @description 获取某个密度分析。
  96756. * @param {string} id - 空间分析的ID。
  96757. * @param {RequestCallback} callback - 回调函数。
  96758. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96759. */
  96760. getKernelDensityJob(id, callback, resultFormat) {
  96761. var me = this,
  96762. format = me._processFormat(resultFormat);
  96763. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96764. proxy: me.options.proxy,
  96765. withCredentials: me.options.withCredentials,
  96766. crossOrigin: me.options.crossOrigin,
  96767. headers: me.options.headers,
  96768. eventListeners: {
  96769. scope: me,
  96770. processCompleted: callback,
  96771. processFailed: callback
  96772. },
  96773. format: format
  96774. });
  96775. kernelDensityJobsService.getKernelDensityJob(id);
  96776. }
  96777. /**
  96778. * @function ProcessingService.prototype.addKernelDensityJob
  96779. * @description 密度分析。
  96780. * @param {KernelDensityJobParameter} params -密度分析参数类。
  96781. * @param {RequestCallback} callback 回调函数。
  96782. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96783. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96784. */
  96785. addKernelDensityJob(params, callback, seconds, resultFormat) {
  96786. var me = this,
  96787. format = me._processFormat(resultFormat);
  96788. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96789. proxy: me.options.proxy,
  96790. withCredentials: me.options.withCredentials,
  96791. crossOrigin: me.options.crossOrigin,
  96792. headers: me.options.headers,
  96793. eventListeners: {
  96794. scope: me,
  96795. processCompleted: callback,
  96796. processFailed: callback,
  96797. processRunning: function (job) {
  96798. me.kernelDensityJobs[job.id] = job.state;
  96799. }
  96800. },
  96801. format: format
  96802. });
  96803. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  96804. }
  96805. /**
  96806. * @function ProcessingService.prototype.getKernelDensityJobState
  96807. * @description 获取密度分析的状态。
  96808. * @param {string} id - 密度分析的id。
  96809. * @returns {Object} 密度分析的状态。
  96810. */
  96811. getKernelDensityJobState(id) {
  96812. return this.kernelDensityJobs[id];
  96813. }
  96814. /**
  96815. * @function ProcessingService.prototype.getSummaryMeshJobs
  96816. * @description 获取点聚合分析的列表。
  96817. * @param {RequestCallback} callback - 回调函数。
  96818. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96819. */
  96820. getSummaryMeshJobs(callback, resultFormat) {
  96821. var me = this,
  96822. format = me._processFormat(resultFormat);
  96823. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96824. proxy: me.options.proxy,
  96825. withCredentials: me.options.withCredentials,
  96826. crossOrigin: me.options.crossOrigin,
  96827. headers: me.options.headers,
  96828. eventListeners: {
  96829. scope: me,
  96830. processCompleted: callback,
  96831. processFailed: callback
  96832. },
  96833. format: format
  96834. });
  96835. summaryMeshJobsService.getSummaryMeshJobs();
  96836. }
  96837. /**
  96838. * @function ProcessingService.prototype.getSummaryMeshJob
  96839. * @description 获取某个点聚合分析。
  96840. * @param {string} id - 空间分析的 ID。
  96841. * @param {RequestCallback} callback - 回调函数。
  96842. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96843. */
  96844. getSummaryMeshJob(id, callback, resultFormat) {
  96845. var me = this,
  96846. format = me._processFormat(resultFormat);
  96847. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96848. proxy: me.options.proxy,
  96849. withCredentials: me.options.withCredentials,
  96850. crossOrigin: me.options.crossOrigin,
  96851. headers: me.options.headers,
  96852. eventListeners: {
  96853. scope: me,
  96854. processCompleted: callback,
  96855. processFailed: callback
  96856. },
  96857. format: format
  96858. });
  96859. summaryMeshJobsService.getSummaryMeshJob(id);
  96860. }
  96861. /**
  96862. * @function ProcessingService.prototype.addSummaryMeshJob
  96863. * @description 点聚合分析。
  96864. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  96865. * @param {RequestCallback} callback 回调函数。
  96866. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96867. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96868. */
  96869. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  96870. var me = this,
  96871. format = me._processFormat(resultFormat);
  96872. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96873. proxy: me.options.proxy,
  96874. withCredentials: me.options.withCredentials,
  96875. crossOrigin: me.options.crossOrigin,
  96876. headers: me.options.headers,
  96877. eventListeners: {
  96878. scope: me,
  96879. processCompleted: callback,
  96880. processFailed: callback,
  96881. processRunning: function (job) {
  96882. me.summaryMeshJobs[job.id] = job.state;
  96883. }
  96884. },
  96885. format: format
  96886. });
  96887. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  96888. }
  96889. /**
  96890. * @function ProcessingService.prototype.getSummaryMeshJobState
  96891. * @description 获取点聚合分析的状态。
  96892. * @param {string} id - 点聚合分析的 ID。
  96893. * @returns {Object} 点聚合分析的状态。
  96894. */
  96895. getSummaryMeshJobState(id) {
  96896. return this.summaryMeshJobs[id];
  96897. }
  96898. /**
  96899. * @function ProcessingService.prototype.getQueryJobs
  96900. * @description 获取单对象查询分析的列表。
  96901. * @param {RequestCallback} callback - 回调函数。
  96902. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96903. */
  96904. getQueryJobs(callback, resultFormat) {
  96905. var me = this,
  96906. format = me._processFormat(resultFormat);
  96907. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96908. proxy: me.options.proxy,
  96909. withCredentials: me.options.withCredentials,
  96910. crossOrigin: me.options.crossOrigin,
  96911. headers: me.options.headers,
  96912. eventListeners: {
  96913. scope: me,
  96914. processCompleted: callback,
  96915. processFailed: callback
  96916. },
  96917. format: format
  96918. });
  96919. singleObjectQueryJobsService.getQueryJobs();
  96920. }
  96921. /**
  96922. * @function ProcessingService.prototype.getQueryJob
  96923. * @description 获取某个单对象查询分析。
  96924. * @param {string} id - 空间分析的 ID。
  96925. * @param {RequestCallback} callback - 回调函数。
  96926. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96927. */
  96928. getQueryJob(id, callback, resultFormat) {
  96929. var me = this,
  96930. format = me._processFormat(resultFormat);
  96931. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96932. proxy: me.options.proxy,
  96933. withCredentials: me.options.withCredentials,
  96934. crossOrigin: me.options.crossOrigin,
  96935. headers: me.options.headers,
  96936. eventListeners: {
  96937. scope: me,
  96938. processCompleted: callback,
  96939. processFailed: callback
  96940. },
  96941. format: format
  96942. });
  96943. singleObjectQueryJobsService.getQueryJob(id);
  96944. }
  96945. /**
  96946. * @function ProcessingService.prototype.addQueryJob
  96947. * @description 单对象查询分析。
  96948. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  96949. * @param {RequestCallback} callback - 回调函数。
  96950. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96951. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96952. */
  96953. addQueryJob(params, callback, seconds, resultFormat) {
  96954. var me = this,
  96955. format = me._processFormat(resultFormat);
  96956. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96957. proxy: me.options.proxy,
  96958. withCredentials: me.options.withCredentials,
  96959. crossOrigin: me.options.crossOrigin,
  96960. headers: me.options.headers,
  96961. eventListeners: {
  96962. scope: me,
  96963. processCompleted: callback,
  96964. processFailed: callback,
  96965. processRunning: function (job) {
  96966. me.queryJobs[job.id] = job.state;
  96967. }
  96968. },
  96969. format: format
  96970. });
  96971. singleObjectQueryJobsService.addQueryJob(params, seconds);
  96972. }
  96973. /**
  96974. * @function ProcessingService.prototype.getQueryJobState
  96975. * @description 获取单对象查询分析的状态。
  96976. * @param {string} id - 单对象查询分析的 ID。
  96977. * @returns {Object} 单对象查询分析的状态。
  96978. */
  96979. getQueryJobState(id) {
  96980. return this.queryJobs[id];
  96981. }
  96982. /**
  96983. * @function ProcessingService.prototype.getSummaryRegionJobs
  96984. * @description 获取区域汇总分析的列表。
  96985. * @param {RequestCallback} callback - 回调函数。
  96986. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96987. */
  96988. getSummaryRegionJobs(callback, resultFormat) {
  96989. var me = this,
  96990. format = me._processFormat(resultFormat);
  96991. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  96992. proxy: me.options.proxy,
  96993. withCredentials: me.options.withCredentials,
  96994. crossOrigin: me.options.crossOrigin,
  96995. headers: me.options.headers,
  96996. eventListeners: {
  96997. scope: me,
  96998. processCompleted: callback,
  96999. processFailed: callback
  97000. },
  97001. format: format
  97002. });
  97003. summaryRegionJobsService.getSummaryRegionJobs();
  97004. }
  97005. /**
  97006. * @function ProcessingService.prototype.getSummaryRegionJob
  97007. * @description 获取某个区域汇总分析。
  97008. * @param {string} id - 区域汇总分析的 ID。
  97009. * @param {RequestCallback} callback - 回调函数。
  97010. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97011. */
  97012. getSummaryRegionJob(id, callback, resultFormat) {
  97013. var me = this,
  97014. format = me._processFormat(resultFormat);
  97015. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  97016. proxy: me.options.proxy,
  97017. withCredentials: me.options.withCredentials,
  97018. crossOrigin: me.options.crossOrigin,
  97019. headers: me.options.headers,
  97020. eventListeners: {
  97021. scope: me,
  97022. processCompleted: callback,
  97023. processFailed: callback
  97024. },
  97025. format: format
  97026. });
  97027. summaryRegionJobsService.getSummaryRegionJob(id);
  97028. }
  97029. /**
  97030. * @function ProcessingService.prototype.addSummaryRegionJob
  97031. * @description 区域汇总分析。
  97032. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  97033. * @param {RequestCallback} callback - 回调函数。
  97034. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97035. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97036. */
  97037. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  97038. var me = this,
  97039. format = me._processFormat(resultFormat);
  97040. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  97041. proxy: me.options.proxy,
  97042. withCredentials: me.options.withCredentials,
  97043. crossOrigin: me.options.crossOrigin,
  97044. headers: me.options.headers,
  97045. eventListeners: {
  97046. scope: me,
  97047. processCompleted: callback,
  97048. processFailed: callback,
  97049. processRunning: function (job) {
  97050. me.summaryRegionJobs[job.id] = job.state;
  97051. }
  97052. },
  97053. format: format
  97054. });
  97055. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  97056. }
  97057. /**
  97058. * @function ProcessingService.prototype.getSummaryRegionJobState
  97059. * @description 获取区域汇总分析的状态。
  97060. * @param {string} id - 生成区域汇总分析的 ID。
  97061. * @returns {Object} 区域汇总分析的状态。
  97062. */
  97063. getSummaryRegionJobState(id) {
  97064. return this.summaryRegionJobs[id];
  97065. }
  97066. /**
  97067. * @function ProcessingService.prototype.getVectorClipJobs
  97068. * @description 获取矢量裁剪分析的列表。
  97069. * @param {RequestCallback} callback - 回调函数。
  97070. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97071. */
  97072. getVectorClipJobs(callback, resultFormat) {
  97073. var me = this,
  97074. format = me._processFormat(resultFormat);
  97075. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  97076. proxy: me.options.proxy,
  97077. withCredentials: me.options.withCredentials,
  97078. crossOrigin: me.options.crossOrigin,
  97079. headers: me.options.headers,
  97080. eventListeners: {
  97081. scope: me,
  97082. processCompleted: callback,
  97083. processFailed: callback
  97084. },
  97085. format: format
  97086. });
  97087. vectorClipJobsService.getVectorClipJobs();
  97088. }
  97089. /**
  97090. * @function ProcessingService.prototype.getVectorClipJob
  97091. * @description 获取某个矢量裁剪分析。
  97092. * @param {string} id - 空间分析的 ID。
  97093. * @param {RequestCallback} callback - 回调函数。
  97094. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97095. */
  97096. getVectorClipJob(id, callback, resultFormat) {
  97097. var me = this,
  97098. format = me._processFormat(resultFormat);
  97099. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  97100. proxy: me.options.proxy,
  97101. withCredentials: me.options.withCredentials,
  97102. crossOrigin: me.options.crossOrigin,
  97103. headers: me.options.headers,
  97104. eventListeners: {
  97105. scope: me,
  97106. processCompleted: callback,
  97107. processFailed: callback
  97108. },
  97109. format: format
  97110. });
  97111. vectorClipJobsService.getVectorClipJob(id);
  97112. }
  97113. /**
  97114. * @function ProcessingService.prototype.addVectorClipJob
  97115. * @description 矢量裁剪分析。
  97116. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  97117. * @param {RequestCallback} callback - 回调函数。
  97118. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97119. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97120. */
  97121. addVectorClipJob(params, callback, seconds, resultFormat) {
  97122. var me = this,
  97123. format = me._processFormat(resultFormat);
  97124. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  97125. proxy: me.options.proxy,
  97126. withCredentials: me.options.withCredentials,
  97127. crossOrigin: me.options.crossOrigin,
  97128. headers: me.options.headers,
  97129. eventListeners: {
  97130. scope: me,
  97131. processCompleted: callback,
  97132. processFailed: callback,
  97133. processRunning: function (job) {
  97134. me.vectorClipJobs[job.id] = job.state;
  97135. }
  97136. },
  97137. format: format
  97138. });
  97139. vectorClipJobsService.addVectorClipJob(params, seconds);
  97140. }
  97141. /**
  97142. * @function ProcessingService.prototype.getVectorClipJobState
  97143. * @description 获取矢量裁剪分析的状态。
  97144. * @param {number} id - 矢量裁剪分析的ID。
  97145. * @returns {Object} 矢量裁剪分析的状态。
  97146. */
  97147. getVectorClipJobState(id) {
  97148. return this.vectorClipJobs[id];
  97149. }
  97150. /**
  97151. * @function ProcessingService.prototype.getOverlayGeoJobs
  97152. * @description 获取叠加分析的列表。
  97153. * @param {RequestCallback} callback - 回调函数。
  97154. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97155. */
  97156. getOverlayGeoJobs(callback, resultFormat) {
  97157. var me = this,
  97158. format = me._processFormat(resultFormat);
  97159. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  97160. proxy: me.options.proxy,
  97161. withCredentials: me.options.withCredentials,
  97162. crossOrigin: me.options.crossOrigin,
  97163. headers: me.options.headers,
  97164. eventListeners: {
  97165. scope: me,
  97166. processCompleted: callback,
  97167. processFailed: callback
  97168. },
  97169. format: format
  97170. });
  97171. overlayGeoJobsService.getOverlayGeoJobs();
  97172. }
  97173. /**
  97174. * @function ProcessingService.prototype.getOverlayGeoJob
  97175. * @description 获取某个叠加分析。
  97176. * @param {string} id - 空间分析的 ID。
  97177. * @param {RequestCallback} callback - 回调函数。
  97178. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97179. */
  97180. getOverlayGeoJob(id, callback, resultFormat) {
  97181. var me = this,
  97182. format = me._processFormat(resultFormat);
  97183. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  97184. proxy: me.options.proxy,
  97185. withCredentials: me.options.withCredentials,
  97186. crossOrigin: me.options.crossOrigin,
  97187. headers: me.options.headers,
  97188. eventListeners: {
  97189. scope: me,
  97190. processCompleted: callback,
  97191. processFailed: callback
  97192. },
  97193. format: format
  97194. });
  97195. overlayGeoJobsService.getOverlayGeoJob(id);
  97196. }
  97197. /**
  97198. * @function ProcessingService.prototype.addOverlayGeoJob
  97199. * @description 叠加分析。
  97200. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  97201. * @param {RequestCallback} callback - 回调函数。
  97202. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97203. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97204. */
  97205. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  97206. var me = this,
  97207. format = me._processFormat(resultFormat);
  97208. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  97209. proxy: me.options.proxy,
  97210. withCredentials: me.options.withCredentials,
  97211. crossOrigin: me.options.crossOrigin,
  97212. headers: me.options.headers,
  97213. eventListeners: {
  97214. scope: me,
  97215. processCompleted: callback,
  97216. processFailed: callback,
  97217. processRunning: function (job) {
  97218. me.overlayGeoJobs[job.id] = job.state;
  97219. }
  97220. },
  97221. format: format
  97222. });
  97223. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  97224. }
  97225. /**
  97226. * @function ProcessingService.prototype.getoverlayGeoJobState
  97227. * @description 获取叠加分析的状态。
  97228. * @param {string} id - 叠加分析的 ID。
  97229. * @returns {Object} 叠加分析的状态。
  97230. */
  97231. getoverlayGeoJobState(id) {
  97232. return this.overlayGeoJobs[id];
  97233. }
  97234. /**
  97235. * @function ProcessingService.prototype.getBuffersJobs
  97236. * @description 获取缓冲区分析的列表。
  97237. * @param {RequestCallback} callback - 回调函数。
  97238. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97239. */
  97240. getBuffersJobs(callback, resultFormat) {
  97241. var me = this,
  97242. format = me._processFormat(resultFormat);
  97243. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  97244. proxy: me.options.proxy,
  97245. withCredentials: me.options.withCredentials,
  97246. crossOrigin: me.options.crossOrigin,
  97247. headers: me.options.headers,
  97248. eventListeners: {
  97249. scope: me,
  97250. processCompleted: callback,
  97251. processFailed: callback
  97252. },
  97253. format: format
  97254. });
  97255. buffersAnalystJobsService.getBuffersJobs();
  97256. }
  97257. /**
  97258. * @function ProcessingService.prototype.getBuffersJob
  97259. * @description 获取某个缓冲区分析。
  97260. * @param {string} id - 空间分析的 ID。
  97261. * @param {RequestCallback} callback - 回调函数。
  97262. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97263. */
  97264. getBuffersJob(id, callback, resultFormat) {
  97265. var me = this,
  97266. format = me._processFormat(resultFormat);
  97267. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  97268. proxy: me.options.proxy,
  97269. withCredentials: me.options.withCredentials,
  97270. crossOrigin: me.options.crossOrigin,
  97271. headers: me.options.headers,
  97272. eventListeners: {
  97273. scope: me,
  97274. processCompleted: callback,
  97275. processFailed: callback
  97276. },
  97277. format: format
  97278. });
  97279. buffersAnalystJobsService.getBuffersJob(id);
  97280. }
  97281. /**
  97282. * @function ProcessingService.prototype.addBuffersJob
  97283. * @description 缓冲区分析。
  97284. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  97285. * @param {RequestCallback} callback - 回调函数。
  97286. * @param {number} seconds - 获取创建成功结果的时间间隔。
  97287. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97288. */
  97289. addBuffersJob(params, callback, seconds, resultFormat) {
  97290. var me = this,
  97291. format = me._processFormat(resultFormat);
  97292. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  97293. proxy: me.options.proxy,
  97294. withCredentials: me.options.withCredentials,
  97295. crossOrigin: me.options.crossOrigin,
  97296. headers: me.options.headers,
  97297. eventListeners: {
  97298. scope: me,
  97299. processCompleted: callback,
  97300. processFailed: callback,
  97301. processRunning: function (job) {
  97302. me.buffersJobs[job.id] = job.state;
  97303. }
  97304. },
  97305. format: format
  97306. });
  97307. buffersAnalystJobsService.addBuffersJob(params, seconds);
  97308. }
  97309. /**
  97310. * @function ProcessingService.prototype.getBuffersJobState
  97311. * @description 获取缓冲区分析的状态。
  97312. * @param {string} id - 缓冲区分析的 ID。
  97313. * @returns {Object} 缓冲区分析的状态。
  97314. */
  97315. getBuffersJobState(id) {
  97316. return this.buffersJobs[id];
  97317. }
  97318. /**
  97319. * @function ProcessingService.prototype.getTopologyValidatorJobs
  97320. * @description 获取拓扑检查分析的列表。
  97321. * @param {RequestCallback} callback - 回调函数。
  97322. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97323. */
  97324. getTopologyValidatorJobs(callback, resultFormat) {
  97325. var me = this,
  97326. format = me._processFormat(resultFormat);
  97327. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  97328. proxy: me.options.proxy,
  97329. withCredentials: me.options.withCredentials,
  97330. crossOrigin: me.options.crossOrigin,
  97331. headers: me.options.headers,
  97332. eventListeners: {
  97333. scope: me,
  97334. processCompleted: callback,
  97335. processFailed: callback
  97336. },
  97337. format: format
  97338. });
  97339. topologyValidatorJobsService.getTopologyValidatorJobs();
  97340. }
  97341. /**
  97342. * @function ProcessingService.prototype.getTopologyValidatorJob
  97343. * @description 获取某个拓扑检查分析。
  97344. * @param {string} id - 空间分析的 ID。
  97345. * @param {RequestCallback} callback - 回调函数。
  97346. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97347. */
  97348. getTopologyValidatorJob(id, callback, resultFormat) {
  97349. var me = this,
  97350. format = me._processFormat(resultFormat);
  97351. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  97352. proxy: me.options.proxy,
  97353. withCredentials: me.options.withCredentials,
  97354. crossOrigin: me.options.crossOrigin,
  97355. headers: me.options.headers,
  97356. eventListeners: {
  97357. scope: me,
  97358. processCompleted: callback,
  97359. processFailed: callback
  97360. },
  97361. format: format
  97362. });
  97363. topologyValidatorJobsService.getTopologyValidatorJob(id);
  97364. }
  97365. /**
  97366. * @function ProcessingService.prototype.addTopologyValidatorJob
  97367. * @description 拓扑检查分析。
  97368. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  97369. * @param {RequestCallback} callback - 回调函数。
  97370. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97371. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97372. */
  97373. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  97374. var me = this,
  97375. format = me._processFormat(resultFormat);
  97376. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  97377. proxy: me.options.proxy,
  97378. withCredentials: me.options.withCredentials,
  97379. crossOrigin: me.options.crossOrigin,
  97380. headers: me.options.headers,
  97381. eventListeners: {
  97382. scope: me,
  97383. processCompleted: callback,
  97384. processFailed: callback,
  97385. processRunning: function (job) {
  97386. me.topologyValidatorJobs[job.id] = job.state;
  97387. }
  97388. },
  97389. format: format
  97390. });
  97391. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  97392. }
  97393. /**
  97394. * @function ProcessingService.prototype.getTopologyValidatorJobState
  97395. * @description 获取拓扑检查分析的状态。
  97396. * @param {string} id - 拓扑检查分析的 ID。
  97397. * @returns {Object} 拓扑检查分析的状态。
  97398. */
  97399. getTopologyValidatorJobState(id) {
  97400. return this.topologyValidatorJobs[id];
  97401. }
  97402. /**
  97403. * @function ProcessingService.prototype.getSummaryAttributesJobs
  97404. * @description 获取属性汇总分析的列表。
  97405. * @param {RequestCallback} callback - 回调函数。
  97406. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97407. */
  97408. getSummaryAttributesJobs(callback, resultFormat) {
  97409. var me = this,
  97410. format = me._processFormat(resultFormat);
  97411. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  97412. proxy: me.options.proxy,
  97413. withCredentials: me.options.withCredentials,
  97414. crossOrigin: me.options.crossOrigin,
  97415. headers: me.options.headers,
  97416. eventListeners: {
  97417. scope: me,
  97418. processCompleted: callback,
  97419. processFailed: callback
  97420. },
  97421. format: format
  97422. });
  97423. summaryAttributesJobsService.getSummaryAttributesJobs();
  97424. }
  97425. /**
  97426. * @function ProcessingService.prototype.getSummaryAttributesJob
  97427. * @description 获取某个属性汇总分析。
  97428. * @param {string} id - 空间分析的 ID。
  97429. * @param {RequestCallback} callback - 回调函数。
  97430. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97431. */
  97432. getSummaryAttributesJob(id, callback, resultFormat) {
  97433. var me = this,
  97434. format = me._processFormat(resultFormat);
  97435. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  97436. proxy: me.options.proxy,
  97437. withCredentials: me.options.withCredentials,
  97438. crossOrigin: me.options.crossOrigin,
  97439. headers: me.options.headers,
  97440. eventListeners: {
  97441. scope: me,
  97442. processCompleted: callback,
  97443. processFailed: callback
  97444. },
  97445. format: format
  97446. });
  97447. summaryAttributesJobsService.getSummaryAttributesJob(id);
  97448. }
  97449. /**
  97450. * @function ProcessingService.prototype.addSummaryAttributesJob
  97451. * @description 属性汇总分析。
  97452. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  97453. * @param {RequestCallback} callback - 回调函数。
  97454. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97455. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97456. */
  97457. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  97458. var me = this,
  97459. format = me._processFormat(resultFormat);
  97460. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  97461. proxy: me.options.proxy,
  97462. withCredentials: me.options.withCredentials,
  97463. crossOrigin: me.options.crossOrigin,
  97464. headers: me.options.headers,
  97465. eventListeners: {
  97466. scope: me,
  97467. processCompleted: callback,
  97468. processFailed: callback,
  97469. processRunning: function (job) {
  97470. me.summaryAttributesJobs[job.id] = job.state;
  97471. }
  97472. },
  97473. format: format
  97474. });
  97475. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  97476. }
  97477. /**
  97478. * @function ProcessingService.prototype.getSummaryAttributesJobState
  97479. * @description 获取属性汇总分析的状态。
  97480. * @param {string} id - 属性汇总分析的 ID。
  97481. * @returns {Object} 属性汇总分析的状态
  97482. */
  97483. getSummaryAttributesJobState(id) {
  97484. return this.summaryAttributesJobs[id];
  97485. }
  97486. _processFormat(resultFormat) {
  97487. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  97488. }
  97489. }
  97490. ;// CONCATENATED MODULE: ./src/leaflet/services/ProcessingService.js
  97491. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97492. * This program are made available under the terms of the Apache License, Version 2.0
  97493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97494. /**
  97495. * @class ProcessingService
  97496. * @deprecatedclassinstance L.supermap.processingService
  97497. * @classdesc 分布式分析服务类。
  97498. * @category iServer ProcessingService
  97499. * @modulecategory Services
  97500. * @extends ServiceBase
  97501. * @example
  97502. * new ProcessingService(url)
  97503. * .getKernelDensityJobs(function(result){
  97504. * //doSomething
  97505. * })
  97506. * @param {string} url - 服务地址。
  97507. * @param {Object} options - 参数。
  97508. * @param {string} [options.proxy] - 服务代理地址。
  97509. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  97510. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  97511. * @param {Object} [options.headers] - 请求头。
  97512. * @usage
  97513. */
  97514. var ProcessingService_ProcessingService = ServiceBase.extend({
  97515. initialize: function(url, options) {
  97516. options = options || {};
  97517. external_L_default().setOptions(this, options);
  97518. ServiceBase.prototype.initialize.call(this, url, options);
  97519. this.kernelDensityJobs = {};
  97520. this.summaryMeshJobs = {};
  97521. this.queryJobs = {};
  97522. this.summaryRegionJobs = {};
  97523. this.vectorClipJobs = {};
  97524. this.overlayGeoJobs = {};
  97525. this.buffersJobs = {};
  97526. this.topologyValidatorJobs = {};
  97527. this.summaryAttributesJobs = {};
  97528. this._processingService = new ProcessingService(url, options);
  97529. },
  97530. /**
  97531. * @function ProcessingService.prototype.getKernelDensityJobs
  97532. * @description 获取密度分析的列表。
  97533. * @param {RequestCallback} callback - 回调函数。
  97534. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97535. */
  97536. getKernelDensityJobs: function(callback, resultFormat) {
  97537. this._processingService.getKernelDensityJobs(callback, resultFormat);
  97538. },
  97539. /**
  97540. * @function ProcessingService.prototype.getKernelDensityJob
  97541. * @description 获取指定 ID 的密度分析。
  97542. * @param {string} id - 空间分析的 ID。
  97543. * @param {RequestCallback} callback - 回调函数。
  97544. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97545. */
  97546. getKernelDensityJob: function(id, callback, resultFormat) {
  97547. this._processingService.getKernelDensityJob(id, callback, resultFormat);
  97548. },
  97549. /**
  97550. * @function ProcessingService.prototype.addKernelDensityJob
  97551. * @description 新建密度分析。
  97552. * @param {KernelDensityJobParameter} params - 密度分析任务参数类。
  97553. * @param {RequestCallback} callback - 回调函数。
  97554. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97555. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97556. */
  97557. addKernelDensityJob: function(params, callback, seconds, resultFormat) {
  97558. let processParams = this._processParams(params);
  97559. this._processingService.addKernelDensityJob(processParams, callback, seconds, resultFormat);
  97560. },
  97561. /**
  97562. * @function ProcessingService.prototype.getKernelDensityJobState
  97563. * @description 获取密度分析的状态。
  97564. * @param {string} id - 密度分析 ID。
  97565. * @returns {Object} 密度分析的状态。
  97566. */
  97567. getKernelDensityJobState: function(id) {
  97568. return this._processingService.getKernelDensityJobState(id);
  97569. },
  97570. /**
  97571. * @function ProcessingService.prototype.getSummaryMeshJobs
  97572. * @description 获取点聚合分析的列表。
  97573. * @param {RequestCallback} callback - 回调函数。
  97574. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97575. */
  97576. getSummaryMeshJobs: function(callback, resultFormat) {
  97577. this._processingService.getSummaryMeshJobs(callback, resultFormat);
  97578. },
  97579. /**
  97580. * @function ProcessingService.prototype.getSummaryMeshJob
  97581. * @description 获取指定 ID 的点聚合分析。
  97582. * @param {string} id - 空间分析的 ID。
  97583. * @param {RequestCallback} callback - 回调函数。
  97584. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97585. */
  97586. getSummaryMeshJob: function(id, callback, resultFormat) {
  97587. this._processingService.getSummaryMeshJob(id, callback, resultFormat);
  97588. },
  97589. /**
  97590. * @function ProcessingService.prototype.addSummaryMeshJob
  97591. * @description 新建点聚合分析。
  97592. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  97593. * @param {RequestCallback} callback - 回调函数。
  97594. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97595. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97596. */
  97597. addSummaryMeshJob: function(params, callback, seconds, resultFormat) {
  97598. params = this._processParams(params);
  97599. this._processingService.addSummaryMeshJob(params, callback, seconds, resultFormat);
  97600. },
  97601. /**
  97602. * @function ProcessingService.prototype.getSummaryMeshJobState
  97603. * @description 获取点聚合分析的状态。
  97604. * @param {string} id - 点聚合分析的 ID。
  97605. * @returns {Object} 点聚合分析的状态。
  97606. */
  97607. getSummaryMeshJobState: function(id) {
  97608. return this._processingService.getSummaryMeshJobState(id);
  97609. },
  97610. /**
  97611. * @function ProcessingService.prototype.getQueryJobs
  97612. * @description 获取单对象查询分析的列表。
  97613. * @param {RequestCallback} callback - 回调函数。
  97614. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97615. */
  97616. getQueryJobs: function(callback, resultFormat) {
  97617. this._processingService.getQueryJobs(callback, resultFormat);
  97618. },
  97619. /**
  97620. * @function ProcessingService.prototype.getQueryJob
  97621. * @description 获取指定 ID 的单对象查询分析。
  97622. * @param {string} id - 空间分析的 ID。
  97623. * @param {RequestCallback} callback - 回调函数。
  97624. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97625. */
  97626. getQueryJob: function(id, callback, resultFormat) {
  97627. this._processingService.getQueryJob(id, callback, resultFormat);
  97628. },
  97629. /**
  97630. * @function ProcessingService.prototype.addQueryJob
  97631. * @description 新建单对象查询分析。
  97632. * @param {SingleObjectQueryJobsParameter} params - 单对象空间查询分析任务参数类。
  97633. * @param {RequestCallback} callback - 回调函数。
  97634. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97635. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97636. */
  97637. addQueryJob: function(params, callback, seconds, resultFormat) {
  97638. params = this._processParams(params);
  97639. this._processingService.addQueryJob(params, callback, seconds, resultFormat);
  97640. },
  97641. /**
  97642. * @function ProcessingService.prototype.getQueryJobState
  97643. * @description 获取单对象查询分析的状态。
  97644. * @param {string} id - 单对象查询分析的 ID。
  97645. * @returns {Object} 单对象查询分析的状态。
  97646. */
  97647. getQueryJobState: function(id) {
  97648. return this._processingService.getQueryJobState(id);
  97649. },
  97650. /**
  97651. * @function ProcessingService.prototype.getSummaryRegionJobs
  97652. * @description 获取区域汇总分析的列表。
  97653. * @param {RequestCallback} callback - 回调函数。
  97654. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97655. */
  97656. getSummaryRegionJobs: function(callback, resultFormat) {
  97657. this._processingService.getSummaryRegionJobs(callback, resultFormat);
  97658. },
  97659. /**
  97660. * @function ProcessingService.prototype.getSummaryRegionJob
  97661. * @description 获取指定 ID 的区域汇总分析。
  97662. * @param {string} id - 区域汇总分析的 ID。
  97663. * @param {RequestCallback} callback - 回调函数。
  97664. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97665. */
  97666. getSummaryRegionJob: function(id, callback, resultFormat) {
  97667. this._processingService.getSummaryRegionJob(id, callback, resultFormat);
  97668. },
  97669. /**
  97670. * @function ProcessingService.prototype.addSummaryRegionJob
  97671. * @description 新建区域汇总分析。
  97672. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  97673. * @param {RequestCallback} callback - 回调函数。
  97674. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97675. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97676. */
  97677. addSummaryRegionJob: function(params, callback, seconds, resultFormat) {
  97678. params = this._processParams(params);
  97679. this._processingService.addSummaryRegionJob(params, callback, seconds, resultFormat);
  97680. },
  97681. /**
  97682. * @function ProcessingService.prototype.getSummaryRegionJobState
  97683. * @description 获取区域汇总分析的状态。
  97684. * @param {string} id - 区域汇总分析的 ID。
  97685. * @returns {Object} 区域汇总分析的状态。
  97686. */
  97687. getSummaryRegionJobState: function(id) {
  97688. return this._processingService.getSummaryRegionJobState(id);
  97689. },
  97690. /**
  97691. * @function ProcessingService.prototype.getVectorClipJobs
  97692. * @description 获取矢量裁剪分析的列表。
  97693. * @param {RequestCallback} callback - 回调函数。
  97694. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97695. */
  97696. getVectorClipJobs: function(callback, resultFormat) {
  97697. this._processingService.getVectorClipJobs(callback, resultFormat);
  97698. },
  97699. /**
  97700. * @function ProcessingService.prototype.getVectorClipJob
  97701. * @description 获取指定 ID 的矢量裁剪分析。
  97702. * @param {string} id - 空间分析的 ID。
  97703. * @param {RequestCallback} callback - 回调函数。
  97704. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97705. */
  97706. getVectorClipJob: function(id, callback, resultFormat) {
  97707. this._processingService.getVectorClipJob(id, callback, resultFormat);
  97708. },
  97709. /**
  97710. * @function ProcessingService.prototype.addVectorClipJob
  97711. * @description 新建矢量裁剪分析。
  97712. * @param {VectorClipJobsParameter} params - 矢量裁剪分析任务参数类。
  97713. * @param {RequestCallback} callback - 回调函数。
  97714. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97715. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97716. */
  97717. addVectorClipJob: function(params, callback, seconds, resultFormat) {
  97718. params = this._processParams(params);
  97719. this._processingService.addVectorClipJob(params, callback, seconds, resultFormat);
  97720. },
  97721. /**
  97722. * @function ProcessingService.prototype.getVectorClipJobState
  97723. * @description 获取矢量裁剪分析的状态。
  97724. * @param {string} id - 矢量裁剪分析的 ID。
  97725. * @returns {Object} 矢量裁剪分析的状态。
  97726. */
  97727. getVectorClipJobState: function(id) {
  97728. return this._processingService.getVectorClipJobState(id);
  97729. },
  97730. /**
  97731. * @function ProcessingService.prototype.getOverlayGeoJobs
  97732. * @description 获取叠加分析的列表。
  97733. * @param {RequestCallback} callback - 回调函数。
  97734. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97735. */
  97736. getOverlayGeoJobs: function(callback, resultFormat) {
  97737. this._processingService.getOverlayGeoJobs(callback, resultFormat);
  97738. },
  97739. /**
  97740. * @function ProcessingService.prototype.getOverlayGeoJob
  97741. * @description 获取指定 ID 的叠加分析。
  97742. * @param {string} id - 空间分析的 ID。
  97743. * @param {RequestCallback} callback - 回调函数。
  97744. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97745. */
  97746. getOverlayGeoJob: function(id, callback, resultFormat) {
  97747. this._processingService.getOverlayGeoJob(id, callback, resultFormat);
  97748. },
  97749. /**
  97750. * @function ProcessingService.prototype.addOverlayGeoJob
  97751. * @description 新建叠加分析。
  97752. * @param {OverlayGeoJobParameter} params - 叠加分析任务参数类。
  97753. * @param {RequestCallback} callback - 回调函数。
  97754. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97755. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97756. */
  97757. addOverlayGeoJob: function(params, callback, seconds, resultFormat) {
  97758. params = this._processParams(params);
  97759. this._processingService.addOverlayGeoJob(params, callback, seconds, resultFormat);
  97760. },
  97761. /**
  97762. * @function ProcessingService.prototype.getoverlayGeoJobState
  97763. * @description 获取叠加分析的状态。
  97764. * @param {string} id - 叠加分析的 ID。
  97765. * @returns {Object} 叠加分析的状态。
  97766. */
  97767. getoverlayGeoJobState: function(id) {
  97768. return this._processingService.getoverlayGeoJobState(id);
  97769. },
  97770. /**
  97771. * @function ProcessingService.prototype.getBuffersJobs
  97772. * @description 获取缓冲区分析的列表。
  97773. * @param {RequestCallback} callback - 回调函数。
  97774. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97775. */
  97776. getBuffersJobs: function(callback, resultFormat) {
  97777. this._processingService.getBuffersJobs(callback, resultFormat);
  97778. },
  97779. /**
  97780. * @function ProcessingService.prototype.getBuffersJob
  97781. * @description 获取指定 ID 的缓冲区分析。
  97782. * @param {string} id - 空间分析的 ID。
  97783. * @param {RequestCallback} callback - 回调函数。
  97784. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97785. */
  97786. getBuffersJob: function(id, callback, resultFormat) {
  97787. this._processingService.getBuffersJob(id, callback, resultFormat);
  97788. },
  97789. /**
  97790. * @function ProcessingService.prototype.addBuffersJob
  97791. * @description 新建缓冲区分析。
  97792. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析任务参数类。
  97793. * @param {RequestCallback} callback - 回调函数。
  97794. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97795. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97796. */
  97797. addBuffersJob: function(params, callback, seconds, resultFormat) {
  97798. params = this._processParams(params);
  97799. this._processingService.addBuffersJob(params, callback, seconds, resultFormat);
  97800. },
  97801. /**
  97802. * @function ProcessingService.prototype.getBuffersJobState
  97803. * @description 获取缓冲区分析的状态。
  97804. * @param {string} id - 缓冲区分析的 ID。
  97805. * @returns {Object} 缓冲区分析的状态
  97806. */
  97807. getBuffersJobState: function(id) {
  97808. return this._processingService.getBuffersJobState(id);
  97809. },
  97810. /**
  97811. * @function ProcessingService.prototype.getTopologyValidatorJobs
  97812. * @description 获取拓扑检查分析的列表。
  97813. * @param {RequestCallback} callback - 回调函数。
  97814. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97815. */
  97816. getTopologyValidatorJobs: function(callback, resultFormat) {
  97817. this._processingService.getTopologyValidatorJobs(callback, resultFormat);
  97818. },
  97819. /**
  97820. * @function ProcessingService.prototype.getTopologyValidatorJob
  97821. * @description 获取指定 ID 的拓扑检查分析。
  97822. * @param {string} id - 空间分析的 ID。
  97823. * @param {RequestCallback} callback - 回调函数。
  97824. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97825. */
  97826. getTopologyValidatorJob: function(id, callback, resultFormat) {
  97827. this._processingService.getTopologyValidatorJob(id, callback, resultFormat);
  97828. },
  97829. /**
  97830. * @function ProcessingService.prototype.addTopologyValidatorJob
  97831. * @description 新建拓扑检查分析。
  97832. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  97833. * @param {RequestCallback} callback - 回调函数。
  97834. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97835. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97836. */
  97837. addTopologyValidatorJob: function(params, callback, seconds, resultFormat) {
  97838. params = this._processParams(params);
  97839. this._processingService.addTopologyValidatorJob(params, callback, seconds, resultFormat);
  97840. },
  97841. /**
  97842. * @function ProcessingService.prototype.getTopologyValidatorJobState
  97843. * @description 获取拓扑检查分析的状态。
  97844. * @param {string} id - 拓扑检查分析的 ID。
  97845. * @returns {Object} 拓扑检查分析的状态。
  97846. */
  97847. getTopologyValidatorJobState: function(id) {
  97848. return this._processingService.getTopologyValidatorJobState(id);
  97849. },
  97850. /**
  97851. * @function ProcessingService.prototype.getSummaryAttributesJobs
  97852. * @description 获取属性汇总分析的列表。
  97853. * @param {RequestCallback} callback - 回调函数。
  97854. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97855. */
  97856. getSummaryAttributesJobs: function(callback, resultFormat) {
  97857. this._processingService.getSummaryAttributesJobs(callback, resultFormat);
  97858. },
  97859. /**
  97860. * @function ProcessingService.prototype.getSummaryAttributesJob
  97861. * @description 获取指定 ID 的属性汇总分析。
  97862. * @param {string} id - 空间分析的 ID。
  97863. * @param {RequestCallback} callback - 回调函数。
  97864. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97865. */
  97866. getSummaryAttributesJob: function(id, callback, resultFormat) {
  97867. this._processingService.getSummaryAttributesJob(id, callback, resultFormat);
  97868. },
  97869. /**
  97870. * @function ProcessingService.prototype.addSummaryAttributesJob
  97871. * @description 新建属性汇总分析。
  97872. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  97873. * @param {RequestCallback} callback - 回调函数。
  97874. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  97875. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97876. */
  97877. addSummaryAttributesJob: function(params, callback, seconds, resultFormat) {
  97878. params = this._processParams(params);
  97879. this._processingService.addSummaryAttributesJob(params, callback, seconds, resultFormat);
  97880. },
  97881. /**
  97882. * @function ProcessingService.prototype.getSummaryAttributesJobState
  97883. * @description 获取属性汇总分析的状态。
  97884. * @param {string} id - 属性汇总分析的 ID。
  97885. * @returns {Object} 属性汇总分析的状态。
  97886. */
  97887. getSummaryAttributesJobState: function(id) {
  97888. return this._processingService.getSummaryAttributesJobState(id);
  97889. },
  97890. _processParams: function(params) {
  97891. if (!params) {
  97892. return {};
  97893. }
  97894. if (params.bounds) {
  97895. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  97896. }
  97897. if (params.query) {
  97898. params.query = CommontypesConversion.toSuperMapBounds(params.query);
  97899. }
  97900. if (params.geometryQuery) {
  97901. params.geometryQuery = CommontypesConversion.toProcessingParam(params.geometryQuery);
  97902. }
  97903. if (params.geometryClip) {
  97904. params.geometryClip = CommontypesConversion.toProcessingParam(params.geometryClip);
  97905. }
  97906. return params;
  97907. }
  97908. });
  97909. var processingService = function(url, options) {
  97910. return new ProcessingService_ProcessingService(url, options);
  97911. };
  97912. ;// CONCATENATED MODULE: ./src/leaflet/services/QueryService.js
  97913. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97914. * This program are made available under the terms of the Apache License, Version 2.0
  97915. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97916. /**
  97917. * @class QueryService
  97918. * @deprecatedclassinstance L.supermap.queryService
  97919. * @classdesc 地图查询服务类。
  97920. * @category iServer Map QueryResults
  97921. * @modulecategory Services
  97922. * @extends {ServiceBase}
  97923. * @param {string} url - 服务地址。
  97924. * @param {Object} options - 参数。
  97925. * @param {string} [options.proxy] - 服务代理地址。
  97926. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  97927. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  97928. * @param {Object} [options.headers] - 请求头。
  97929. * @example
  97930. * new QueryService(url).queryByBounds(param,function(result){
  97931. * //doSomething
  97932. * })
  97933. * @usage
  97934. */
  97935. var QueryService_QueryService = ServiceBase.extend({
  97936. initialize: function(url, options) {
  97937. ServiceBase.prototype.initialize.call(this, url, options);
  97938. this._queryService = new QueryService(url, options);
  97939. },
  97940. /**
  97941. * @function QueryService.prototype.queryByBounds
  97942. * @description bounds 查询地图服务。
  97943. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  97944. * @param {RequestCallback} callback - 回调函数。
  97945. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97946. */
  97947. queryByBounds: function(params, callback, resultFormat) {
  97948. params = this._processParams(params);
  97949. this._queryService.queryByBounds(params, callback, resultFormat);
  97950. },
  97951. /**
  97952. * @function QueryService.prototype.queryByDistance
  97953. * @description 地图距离查询服务。
  97954. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  97955. * @param {RequestCallback} callback - 回调函数。
  97956. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97957. */
  97958. queryByDistance: function(params, callback, resultFormat) {
  97959. params = this._processParams(params);
  97960. this._queryService.queryByDistance(params, callback, resultFormat);
  97961. },
  97962. /**
  97963. * @function QueryService.prototype.queryBySQL
  97964. * @description 地图 SQL 查询服务。
  97965. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  97966. * @param {RequestCallback} callback - 回调函数。
  97967. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97968. */
  97969. queryBySQL: function(params, callback, resultFormat) {
  97970. params = this._processParams(params);
  97971. this._queryService.queryBySQL(params, callback, resultFormat);
  97972. },
  97973. /**
  97974. * @function QueryService.prototype.queryByGeometry
  97975. * @description 地图几何查询服务。
  97976. * @param {QueryByGeometryParameters} params - Geometry 查询相关参数类。
  97977. * @param {RequestCallback} callback - 回调函数。
  97978. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97979. */
  97980. queryByGeometry: function(params, callback, resultFormat) {
  97981. params = this._processParams(params);
  97982. this._queryService.queryByGeometry(params, callback, resultFormat);
  97983. },
  97984. _processParams: function(params) {
  97985. if (!params) {
  97986. return {};
  97987. }
  97988. params.returnContent = params.returnContent == null ? true : params.returnContent;
  97989. if (params.queryParams && !external_L_default().Util.isArray(params.queryParams)) {
  97990. params.queryParams = [params.queryParams];
  97991. }
  97992. if (params.bounds) {
  97993. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  97994. }
  97995. if (params.geometry) {
  97996. if (params.geometry instanceof (external_L_default()).Point) {
  97997. params.geometry = new Point(params.geometry.x, params.geometry.y);
  97998. } else {
  97999. params.geometry = Util_toSuperMapGeometry(params.geometry);
  98000. }
  98001. }
  98002. return params;
  98003. }
  98004. });
  98005. var queryService = function(url, options) {
  98006. return new QueryService_QueryService(url, options);
  98007. };
  98008. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystService.js
  98009. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98010. * This program are made available under the terms of the Apache License, Version 2.0
  98011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98012. /**
  98013. * @class SpatialAnalystService
  98014. * @extends {ServiceBase}
  98015. * @category iServer SpatialAnalyst
  98016. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  98017. * @example
  98018. * new SpatialAnalystService(url).bufferAnalysis(params,function(result){
  98019. * //doSomething
  98020. * })
  98021. * @param {string} url - 服务地址。
  98022. * @param {Object} options - 参数。
  98023. * @param {string} [options.proxy] - 服务代理地址。
  98024. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98025. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98026. * @param {Object} [options.headers] - 请求头。
  98027. * @usage
  98028. */
  98029. class SpatialAnalystService {
  98030. constructor(url, options) {
  98031. this.url = url;
  98032. this.options = options || {};
  98033. }
  98034. /**
  98035. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  98036. * @description 地区太阳辐射。
  98037. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  98038. * @param {RequestCallback} callback 回调函数。
  98039. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98040. */
  98041. getAreaSolarRadiationResult(params, callback, resultFormat) {
  98042. var me = this;
  98043. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  98044. proxy: me.options.proxy,
  98045. withCredentials: me.options.withCredentials,
  98046. crossOrigin: me.options.crossOrigin,
  98047. headers: me.options.headers,
  98048. eventListeners: {
  98049. scope: me,
  98050. processCompleted: callback,
  98051. processFailed: callback
  98052. },
  98053. format: me._processFormat(resultFormat)
  98054. });
  98055. areaSolarRadiationService.processAsync(params);
  98056. }
  98057. /**
  98058. * @function SpatialAnalystService.prototype.bufferAnalysis
  98059. * @description 缓冲区分析。
  98060. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  98061. * @param {RequestCallback} callback 回调函数。
  98062. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98063. */
  98064. bufferAnalysis(params, callback, resultFormat) {
  98065. var me = this;
  98066. var bufferAnalystService = new BufferAnalystService(me.url, {
  98067. proxy: me.options.proxy,
  98068. withCredentials: me.options.withCredentials,
  98069. crossOrigin: me.options.crossOrigin,
  98070. headers: me.options.headers,
  98071. eventListeners: {
  98072. scope: me,
  98073. processCompleted: callback,
  98074. processFailed: callback
  98075. },
  98076. format: me._processFormat(resultFormat)
  98077. });
  98078. bufferAnalystService.processAsync(params);
  98079. }
  98080. /**
  98081. * @function SpatialAnalystService.prototype.densityAnalysis
  98082. * @description 点密度分析。
  98083. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  98084. * @param {RequestCallback} callback 回调函数。
  98085. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98086. */
  98087. densityAnalysis(params, callback, resultFormat) {
  98088. var me = this;
  98089. var densityAnalystService = new DensityAnalystService(me.url, {
  98090. proxy: me.options.proxy,
  98091. withCredentials: me.options.withCredentials,
  98092. crossOrigin: me.options.crossOrigin,
  98093. headers: me.options.headers,
  98094. eventListeners: {
  98095. scope: me,
  98096. processCompleted: callback,
  98097. processFailed: callback
  98098. },
  98099. format: me._processFormat(resultFormat)
  98100. });
  98101. densityAnalystService.processAsync(params);
  98102. }
  98103. /**
  98104. * @function SpatialAnalystService.prototype.generateSpatialData
  98105. * @description 动态分段分析。
  98106. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  98107. * @param {RequestCallback} callback 回调函数。
  98108. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98109. */
  98110. generateSpatialData(params, callback, resultFormat) {
  98111. var me = this;
  98112. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  98113. proxy: me.options.proxy,
  98114. withCredentials: me.options.withCredentials,
  98115. crossOrigin: me.options.crossOrigin,
  98116. headers: me.options.headers,
  98117. eventListeners: {
  98118. scope: me,
  98119. processCompleted: callback,
  98120. processFailed: callback
  98121. },
  98122. format: me._processFormat(resultFormat)
  98123. });
  98124. generateSpatialDataService.processAsync(params);
  98125. }
  98126. /**
  98127. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  98128. * @description 空间关系分析。
  98129. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  98130. * @param {RequestCallback} callback 回调函数。
  98131. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98132. */
  98133. geoRelationAnalysis(params, callback, resultFormat) {
  98134. var me = this;
  98135. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  98136. proxy: me.options.proxy,
  98137. withCredentials: me.options.withCredentials,
  98138. crossOrigin: me.options.crossOrigin,
  98139. headers: me.options.headers,
  98140. eventListeners: {
  98141. scope: me,
  98142. processCompleted: callback,
  98143. processFailed: callback
  98144. },
  98145. format: me._processFormat(resultFormat)
  98146. });
  98147. geoRelationAnalystService.processAsync(params);
  98148. }
  98149. /**
  98150. * @function SpatialAnalystService.prototype.interpolationAnalysis
  98151. * @description 插值分析。
  98152. * @param {InterpolationRBFAnalystParameters|InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值分析参数类。
  98153. * @param {RequestCallback} callback 回调函数。
  98154. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98155. */
  98156. interpolationAnalysis(params, callback, resultFormat) {
  98157. var me = this;
  98158. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  98159. proxy: me.options.proxy,
  98160. withCredentials: me.options.withCredentials,
  98161. crossOrigin: me.options.crossOrigin,
  98162. headers: me.options.headers,
  98163. eventListeners: {
  98164. scope: me,
  98165. processCompleted: callback,
  98166. processFailed: callback
  98167. },
  98168. format: me._processFormat(resultFormat)
  98169. });
  98170. interpolationAnalystService.processAsync(params);
  98171. }
  98172. /**
  98173. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  98174. * @description 栅格代数运算。
  98175. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  98176. * @param {RequestCallback} callback 回调函数。
  98177. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98178. */
  98179. mathExpressionAnalysis(params, callback, resultFormat) {
  98180. var me = this;
  98181. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  98182. proxy: me.options.proxy,
  98183. withCredentials: me.options.withCredentials,
  98184. crossOrigin: me.options.crossOrigin,
  98185. headers: me.options.headers,
  98186. eventListeners: {
  98187. scope: me,
  98188. processCompleted: callback,
  98189. processFailed: callback
  98190. },
  98191. format: me._processFormat(resultFormat)
  98192. });
  98193. mathExpressionAnalysisService.processAsync(params);
  98194. }
  98195. /**
  98196. * @function SpatialAnalystService.prototype.overlayAnalysis
  98197. * @description 叠加分析。
  98198. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或几何对象叠加分析参数类。
  98199. * @param {RequestCallback} callback 回调函数。
  98200. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98201. */
  98202. overlayAnalysis(params, callback, resultFormat) {
  98203. var me = this;
  98204. var overlayAnalystService = new OverlayAnalystService(me.url, {
  98205. proxy: me.options.proxy,
  98206. withCredentials: me.options.withCredentials,
  98207. crossOrigin: me.options.crossOrigin,
  98208. headers: me.options.headers,
  98209. eventListeners: {
  98210. scope: me,
  98211. processCompleted: callback,
  98212. processFailed: callback
  98213. },
  98214. format: me._processFormat(resultFormat)
  98215. });
  98216. overlayAnalystService.processAsync(params);
  98217. }
  98218. /**
  98219. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  98220. * @description 路由测量计算。
  98221. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  98222. * @param {RequestCallback} callback 回调函数。
  98223. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98224. */
  98225. routeCalculateMeasure(params, callback, resultFormat) {
  98226. var me = this;
  98227. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  98228. proxy: me.options.proxy,
  98229. withCredentials: me.options.withCredentials,
  98230. crossOrigin: me.options.crossOrigin,
  98231. headers: me.options.headers,
  98232. eventListeners: {
  98233. scope: me,
  98234. processCompleted: callback,
  98235. processFailed: callback
  98236. },
  98237. format: me._processFormat(resultFormat)
  98238. });
  98239. routeCalculateMeasureService.processAsync(params);
  98240. }
  98241. /**
  98242. * @function SpatialAnalystService.prototype.routeLocate
  98243. * @description 路由定位。
  98244. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  98245. * @param {RequestCallback} callback 回调函数。
  98246. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98247. */
  98248. routeLocate(params, callback, resultFormat) {
  98249. var me = this;
  98250. var routeLocatorService = new RouteLocatorService(me.url, {
  98251. proxy: me.options.proxy,
  98252. withCredentials: me.options.withCredentials,
  98253. crossOrigin: me.options.crossOrigin,
  98254. headers: me.options.headers,
  98255. eventListeners: {
  98256. scope: me,
  98257. processCompleted: callback,
  98258. processFailed: callback
  98259. },
  98260. format: me._processFormat(resultFormat)
  98261. });
  98262. routeLocatorService.processAsync(params);
  98263. }
  98264. /**
  98265. * @function SpatialAnalystService.prototype.surfaceAnalysis
  98266. * @description 表面分析。
  98267. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  98268. * @param {RequestCallback} callback 回调函数。
  98269. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98270. */
  98271. surfaceAnalysis(params, callback, resultFormat) {
  98272. var me = this;
  98273. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  98274. proxy: me.options.proxy,
  98275. withCredentials: me.options.withCredentials,
  98276. crossOrigin: me.options.crossOrigin,
  98277. headers: me.options.headers,
  98278. eventListeners: {
  98279. scope: me,
  98280. processCompleted: callback,
  98281. processFailed: callback
  98282. },
  98283. format: me._processFormat(resultFormat)
  98284. });
  98285. surfaceAnalystService.processAsync(params);
  98286. }
  98287. /**
  98288. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  98289. * @description 地形曲率计算。
  98290. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  98291. * @param {RequestCallback} callback 回调函数。
  98292. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98293. */
  98294. terrainCurvatureCalculate(params, callback, resultFormat) {
  98295. var me = this;
  98296. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  98297. proxy: me.options.proxy,
  98298. withCredentials: me.options.withCredentials,
  98299. crossOrigin: me.options.crossOrigin,
  98300. headers: me.options.headers,
  98301. eventListeners: {
  98302. scope: me,
  98303. processCompleted: callback,
  98304. processFailed: callback
  98305. },
  98306. format: me._processFormat(resultFormat)
  98307. });
  98308. terrainCurvatureCalculationService.processAsync(params);
  98309. }
  98310. /**
  98311. * @function SpatialAnalystService.prototype.thiessenAnalysis
  98312. * @description 泰森多边形分析。
  98313. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  98314. * @param {RequestCallback} callback 回调函数。
  98315. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98316. */
  98317. thiessenAnalysis(params, callback, resultFormat) {
  98318. var me = this;
  98319. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  98320. proxy: me.options.proxy,
  98321. withCredentials: me.options.withCredentials,
  98322. crossOrigin: me.options.crossOrigin,
  98323. headers: me.options.headers,
  98324. eventListeners: {
  98325. scope: me,
  98326. processCompleted: callback,
  98327. processFailed: callback
  98328. },
  98329. format: me._processFormat(resultFormat)
  98330. });
  98331. thiessenAnalystService.processAsync(params);
  98332. }
  98333. /**
  98334. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  98335. * @description 批量空间分析。
  98336. * @param {Array.<Object>} params - 批量分析参数对象数组。
  98337. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  98338. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  98339. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  98340. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  98341. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  98342. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  98343. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  98344. * @param {RequestCallback} callback - 回调函数。
  98345. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  98346. */
  98347. geometrybatchAnalysis(params, callback, resultFormat) {
  98348. var me = this;
  98349. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  98350. eventListeners: {
  98351. scope: me,
  98352. processCompleted: callback,
  98353. processFailed: callback
  98354. },
  98355. format: me._processFormat(resultFormat)
  98356. });
  98357. //处理批量分析中各个分类类型的参数:
  98358. var analystParameters = [];
  98359. for (var i = 0; i < params.length; i++) {
  98360. var tempParameter = params[i];
  98361. analystParameters.push({
  98362. analystName: tempParameter.analystName,
  98363. param: tempParameter.param
  98364. })
  98365. }
  98366. geometryBatchAnalystService.processAsync(analystParameters);
  98367. }
  98368. _processFormat(resultFormat) {
  98369. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  98370. }
  98371. }
  98372. ;// CONCATENATED MODULE: ./src/leaflet/services/SpatialAnalystService.js
  98373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98374. * This program are made available under the terms of the Apache License, Version 2.0
  98375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98376. /**
  98377. * @class SpatialAnalystService
  98378. * @deprecatedclassinstance L.supermap.spatialAnalystService
  98379. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  98380. * @category iServer SpatialAnalyst
  98381. * @modulecategory Services
  98382. * @example
  98383. * new SpatialAnalystService(url)
  98384. * .bufferAnalysis(params,function(result){
  98385. * //doSomething
  98386. * })
  98387. * @param {string} url - 服务地址。
  98388. * @param {Object} options - 参数。
  98389. * @param {string} [options.proxy] - 服务代理地址。
  98390. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98391. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98392. * @param {Object} [options.headers] - 请求头。
  98393. * @extends {ServiceBase}
  98394. * @usage
  98395. */
  98396. var SpatialAnalystService_SpatialAnalystService = ServiceBase.extend({
  98397. initialize: function(url, options) {
  98398. ServiceBase.prototype.initialize.call(this, url, options);
  98399. this._spatialAnalystService = new SpatialAnalystService(url, options);
  98400. },
  98401. /**
  98402. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  98403. * @description 地区太阳辐射。
  98404. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  98405. * @param {RequestCallback} callback - 回调函数。
  98406. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98407. */
  98408. getAreaSolarRadiationResult: function(params, callback, resultFormat) {
  98409. this._spatialAnalystService.getAreaSolarRadiationResult(params, callback, resultFormat);
  98410. },
  98411. /**
  98412. * @function SpatialAnalystService.prototype.bufferAnalysis
  98413. * @description 缓冲区分析。
  98414. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  98415. * @param {RequestCallback} callback - 回调函数。
  98416. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98417. */
  98418. bufferAnalysis: function(params, callback, resultFormat) {
  98419. params = this._processParams(params);
  98420. this._spatialAnalystService.bufferAnalysis(params, callback, resultFormat);
  98421. },
  98422. /**
  98423. * @function SpatialAnalystService.prototype.densityAnalysis
  98424. * @description 点密度分析。
  98425. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  98426. * @param {RequestCallback} callback - 回调函数。
  98427. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98428. */
  98429. densityAnalysis: function(params, callback, resultFormat) {
  98430. params = this._processParams(params);
  98431. this._spatialAnalystService.densityAnalysis(params, callback, resultFormat);
  98432. },
  98433. /**
  98434. * @function SpatialAnalystService.prototype.generateSpatialData
  98435. * @description 动态分段分析。
  98436. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  98437. * @param {RequestCallback} callback - 回调函数。
  98438. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98439. */
  98440. generateSpatialData: function(params, callback, resultFormat) {
  98441. this._spatialAnalystService.generateSpatialData(params, callback, resultFormat);
  98442. },
  98443. /**
  98444. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  98445. * @description 空间关系分析。
  98446. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  98447. * @param {RequestCallback} callback - 回调函数。
  98448. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98449. */
  98450. geoRelationAnalysis: function(params, callback, resultFormat) {
  98451. params = this._processParams(params);
  98452. this._spatialAnalystService.geoRelationAnalysis(params, callback, resultFormat);
  98453. },
  98454. /**
  98455. * @function SpatialAnalystService.prototype.interpolationAnalysis
  98456. * @description 插值分析。
  98457. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值(径向基函数插值法)分析参数类。
  98458. * @param {RequestCallback} callback - 回调函数。
  98459. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98460. */
  98461. interpolationAnalysis: function(params, callback, resultFormat) {
  98462. params = this._processParams(params);
  98463. this._spatialAnalystService.interpolationAnalysis(params, callback, resultFormat);
  98464. },
  98465. /**
  98466. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  98467. * @description 栅格代数运算。
  98468. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  98469. * @param {RequestCallback} callback - 回调函数。
  98470. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98471. */
  98472. mathExpressionAnalysis: function(params, callback, resultFormat) {
  98473. params = this._processParams(params);
  98474. this._spatialAnalystService.mathExpressionAnalysis(params, callback, resultFormat);
  98475. },
  98476. /**
  98477. * @function SpatialAnalystService.prototype.overlayAnalysis
  98478. * @description 叠加分析。
  98479. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类。|| 几何对象叠加分析参数类。
  98480. * @param {RequestCallback} callback - 回调函数。
  98481. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98482. */
  98483. overlayAnalysis: function(params, callback, resultFormat) {
  98484. params = this._processParams(params);
  98485. this._spatialAnalystService.overlayAnalysis(params, callback, resultFormat);
  98486. },
  98487. /**
  98488. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  98489. * @description 路由测量计算。
  98490. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  98491. * @param {RequestCallback} callback - 回调函数。
  98492. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98493. */
  98494. routeCalculateMeasure: function(params, callback, resultFormat) {
  98495. params = this._processParams(params);
  98496. this._spatialAnalystService.routeCalculateMeasure(params, callback, resultFormat);
  98497. },
  98498. /**
  98499. * @function SpatialAnalystService.prototype.routeLocate
  98500. * @description 路由定位。
  98501. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  98502. * @param {RequestCallback} callback - 回调函数。
  98503. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98504. */
  98505. routeLocate: function(params, callback, resultFormat) {
  98506. params = this._processParams(params);
  98507. this._spatialAnalystService.routeLocate(params, callback, resultFormat);
  98508. },
  98509. /**
  98510. * @function SpatialAnalystService.prototype.surfaceAnalysis
  98511. * @description 表面分析。
  98512. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  98513. * @param {RequestCallback} callback - 回调函数。
  98514. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98515. */
  98516. surfaceAnalysis: function(params, callback, resultFormat) {
  98517. params = this._processParams(params);
  98518. this._spatialAnalystService.surfaceAnalysis(params, callback, resultFormat);
  98519. },
  98520. /**
  98521. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  98522. * @description 地形曲率计算。
  98523. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  98524. * @param {RequestCallback} callback - 回调函数。
  98525. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98526. */
  98527. terrainCurvatureCalculate: function(params, callback, resultFormat) {
  98528. this._spatialAnalystService.terrainCurvatureCalculate(params, callback, resultFormat);
  98529. },
  98530. /**
  98531. * @function SpatialAnalystService.prototype.thiessenAnalysis
  98532. * @description 泰森多边形分析。
  98533. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  98534. * @param {RequestCallback} callback - 回调函数。
  98535. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98536. */
  98537. thiessenAnalysis: function(params, callback, resultFormat) {
  98538. params = this._processParams(params);
  98539. this._spatialAnalystService.thiessenAnalysis(params, callback, resultFormat);
  98540. },
  98541. /**
  98542. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  98543. * @description 批量空间分析。
  98544. * @param {Array.<Object>} params -批量分析参数对象数组;包括:</br>
  98545. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  98546. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"
  98547. * @param {Object} param - 空间分析类型对应的请求参数,包括:</br>
  98548. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  98549. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  98550. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  98551. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  98552. * @param {RequestCallback} callback - 回调函数。
  98553. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  98554. */
  98555. geometrybatchAnalysis: function(params, callback, resultFormat) {
  98556. for (var i = 0; i < params.length; i++) {
  98557. params[i].param = this._processParams(params[i].param)
  98558. }
  98559. this._spatialAnalystService.geometrybatchAnalysis(params, callback, resultFormat);
  98560. },
  98561. _processParams: function(params) {
  98562. if (!params) {
  98563. return {};
  98564. }
  98565. if (params.bounds) {
  98566. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  98567. }
  98568. if (params.inputPoints) {
  98569. for (let i = 0; i < params.inputPoints.length; i++) {
  98570. let inputPoint = params.inputPoints[i];
  98571. if (external_L_default().Util.isArray(inputPoint)) {
  98572. params.inputPoints[i] = { x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2] };
  98573. }
  98574. }
  98575. }
  98576. if (params.points) {
  98577. for (let i = 0; i < params.points.length; i++) {
  98578. let point = params.points[i];
  98579. if (external_L_default().Util.isArray(point)) {
  98580. params.points[i] = { x: point[0], y: point[1] };
  98581. } else if (point instanceof (external_L_default()).LatLng) {
  98582. params.points[i] = { x: point.lng, y: point.lat };
  98583. } else {
  98584. params.points[i] = { x: point.x, y: point.y };
  98585. }
  98586. }
  98587. }
  98588. if (params.point) {
  98589. if (external_L_default().Util.isArray(params.point)) {
  98590. params.point = { x: params.point[0], y: params.point[1] };
  98591. } else if (params.point instanceof (external_L_default()).LatLng) {
  98592. params.point = { x: params.point.lng, y: params.point.lat };
  98593. } else {
  98594. params.point = { x: params.point.x, y: params.point.y };
  98595. }
  98596. }
  98597. if (params.extractRegion) {
  98598. params.extractRegion = Util_toSuperMapGeometry(params.extractRegion);
  98599. }
  98600. if (params.extractParameter && params.extractParameter.clipRegion) {
  98601. params.extractParameter.clipRegion = Util_toSuperMapGeometry(params.extractParameter.clipRegion);
  98602. }
  98603. if (params.clipParam && params.clipParam.clipRegion) {
  98604. params.clipParam.clipRegion = Util_toSuperMapGeometry(params.clipParam.clipRegion);
  98605. }
  98606. //支持格式:Vector Layers; GeoJson
  98607. if (params.sourceGeometry) {
  98608. var SRID = null;
  98609. if (params.sourceGeometrySRID) {
  98610. SRID = params.sourceGeometrySRID;
  98611. }
  98612. params.sourceGeometry = Util_toSuperMapGeometry(params.sourceGeometry);
  98613. if (SRID) {
  98614. params.sourceGeometry.SRID = SRID;
  98615. }
  98616. delete params.sourceGeometry.sourceGeometrySRID;
  98617. }
  98618. if (params.operateGeometry) {
  98619. params.operateGeometry = Util_toSuperMapGeometry(params.operateGeometry);
  98620. }
  98621. //支持传入多个几何要素进行叠加分析:
  98622. if (params.sourceGeometries) {
  98623. var sourceGeometries = [];
  98624. for (var k = 0; k < params.sourceGeometries.length; k++) {
  98625. sourceGeometries.push(Util_toSuperMapGeometry(params.sourceGeometries[k]));
  98626. }
  98627. params.sourceGeometries = sourceGeometries;
  98628. }
  98629. //支持传入多个几何要素进行叠加分析:
  98630. if (params.operateGeometries) {
  98631. var operateGeometries = [];
  98632. for (var j = 0; j < params.operateGeometries.length; j++) {
  98633. operateGeometries.push(Util_toSuperMapGeometry(params.operateGeometries[j]));
  98634. }
  98635. params.operateGeometries = operateGeometries;
  98636. }
  98637. if (params.sourceRoute) {
  98638. if (params.sourceRoute instanceof (external_L_default()).Polyline) {
  98639. var target = {};
  98640. target.type = 'LINEM';
  98641. target.parts = [params.sourceRoute.getLatLngs().length];
  98642. target.points = [];
  98643. for (let i = 0; i < params.sourceRoute.getLatLngs().length; i++) {
  98644. let point = params.sourceRoute.getLatLngs()[i];
  98645. target.points = target.points.concat({ x: point.lng, y: point.lat, measure: point.alt });
  98646. }
  98647. params.sourceRoute = target;
  98648. }
  98649. }
  98650. if (params.operateRegions && external_L_default().Util.isArray(params.operateRegions)) {
  98651. params.operateRegions.map(function(geometry, key) {
  98652. params.operateRegions[key] = Util_toSuperMapGeometry(geometry);
  98653. return params.operateRegions[key];
  98654. });
  98655. }
  98656. // if (params.sourceRoute && params.sourceRoute.components && L.Util.isArray(params.sourceRoute.components)) {
  98657. // params.sourceRoute.components.map(function (geometry, key) {
  98658. // params.sourceRoute.components[key] = Util.toSuperMapGeometry(geometry);
  98659. // });
  98660. // }
  98661. return params;
  98662. },
  98663. _processFormat: function(resultFormat) {
  98664. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  98665. }
  98666. });
  98667. var spatialAnalystService = function(url, options) {
  98668. return new SpatialAnalystService_SpatialAnalystService(url, options);
  98669. };
  98670. ;// CONCATENATED MODULE: ./src/leaflet/services/ThemeService.js
  98671. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98672. * This program are made available under the terms of the Apache License, Version 2.0
  98673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98674. /**
  98675. * @class ThemeService
  98676. * @deprecatedclassinstance L.supermap.themeService
  98677. * @classdesc 专题图服务类。
  98678. * @category iServer Map Theme
  98679. * @modulecategory Services
  98680. * @extends {ServiceBase}
  98681. * @example
  98682. * new ThemeService(url,{
  98683. * projection:projection
  98684. * }).getThemeInfo(params,function(result){
  98685. * //doSomething
  98686. * });
  98687. * @param {string} url - 服务地址。
  98688. * @param {Object} options - 参数。
  98689. * @param {string} [options.proxy] - 服务代理地址。
  98690. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98691. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98692. * @param {Object} [options.headers] - 请求头。
  98693. * @usage
  98694. */
  98695. var ThemeService_ThemeService = ServiceBase.extend({
  98696. initialize: function (url, options) {
  98697. ServiceBase.prototype.initialize.call(this, url, options);
  98698. this._themeService = new ThemeService(this.url, {
  98699. proxy: this.options.proxy,
  98700. withCredentials: this.options.withCredentials,
  98701. crossOrigin:this.options.crossOrigin,
  98702. headers:this.options.headers
  98703. });
  98704. },
  98705. /**
  98706. * @function ThemeService.prototype.getThemeInfo
  98707. * @description 获取专题图信息。
  98708. * @param {ThemeParameters} params - 专题图参数类。
  98709. * @param {RequestCallback} callback - 回调函数。
  98710. */
  98711. getThemeInfo: function (params, callback) {
  98712. this._themeService.processAsync(params, callback);
  98713. }
  98714. });
  98715. var themeService = function (url, options) {
  98716. return new ThemeService_ThemeService(url, options);
  98717. };
  98718. ;// CONCATENATED MODULE: ./src/common/iServer/TrafficTransferAnalystService.js
  98719. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98720. * This program are made available under the terms of the Apache License, Version 2.0
  98721. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98722. /**
  98723. * @class TrafficTransferAnalystService
  98724. * @extends {ServiceBase}
  98725. * @category iServer TrafficTransferAnalyst
  98726. * @classdesc 交通换乘分析服务类。
  98727. * @example
  98728. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  98729. * //doSomething
  98730. * })
  98731. * @param {string} url - 服务地址。
  98732. * @param {Object} options - 参数。
  98733. * @param {string} [options.proxy] - 服务代理地址。
  98734. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98735. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98736. * @param {Object} [options.headers] - 请求头。
  98737. * @usage
  98738. */
  98739. class TrafficTransferAnalystService {
  98740. constructor(url, options) {
  98741. this.url = url;
  98742. this.options = options || {};
  98743. }
  98744. /**
  98745. * @function TrafficTransferAnalystService.prototype.queryStop
  98746. * @description 站点查询服务。
  98747. * @param {StopQueryParameters} params - 查询相关参数类。
  98748. * @param {RequestCallback} callback - 回调函数。
  98749. */
  98750. queryStop(params, callback) {
  98751. var me = this;
  98752. var stopQueryService = new StopQueryService(me.url, {
  98753. proxy: me.options.proxy,
  98754. withCredentials: me.options.withCredentials,
  98755. crossOrigin: me.options.crossOrigin,
  98756. headers: me.options.headers,
  98757. eventListeners: {
  98758. scope: me,
  98759. processCompleted: callback,
  98760. processFailed: callback
  98761. }
  98762. });
  98763. stopQueryService.processAsync(params);
  98764. }
  98765. /**
  98766. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  98767. * @description 交通换乘线路查询服务。
  98768. * @param {TransferPathParameters} params - 查询相关参数类。
  98769. * @param {RequestCallback} callback - 回调函数。
  98770. */
  98771. analysisTransferPath(params, callback) {
  98772. var me = this;
  98773. var transferPathService = new TransferPathService(me.url, {
  98774. proxy: me.options.proxy,
  98775. withCredentials: me.options.withCredentials,
  98776. crossOrigin: me.options.crossOrigin,
  98777. headers: me.options.headers,
  98778. eventListeners: {
  98779. scope: me,
  98780. processCompleted: callback,
  98781. processFailed: callback
  98782. }
  98783. });
  98784. transferPathService.processAsync(params);
  98785. }
  98786. /**
  98787. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  98788. * @description 交通换乘方案查询服务。
  98789. * @param {TransferSolutionParameters} params - 查询相关参数类。
  98790. * @param {RequestCallback} callback - 回调函数。
  98791. */
  98792. analysisTransferSolution(params, callback) {
  98793. var me = this;
  98794. var transferSolutionService = new TransferSolutionService(me.url, {
  98795. proxy: me.options.proxy,
  98796. withCredentials: me.options.withCredentials,
  98797. crossOrigin: me.options.crossOrigin,
  98798. headers: me.options.headers,
  98799. eventListeners: {
  98800. scope: me,
  98801. processCompleted: callback,
  98802. processFailed: callback
  98803. }
  98804. });
  98805. transferSolutionService.processAsync(params);
  98806. }
  98807. }
  98808. ;// CONCATENATED MODULE: ./src/leaflet/services/TrafficTransferAnalystService.js
  98809. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98810. * This program are made available under the terms of the Apache License, Version 2.0
  98811. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98812. /**
  98813. * @class TrafficTransferAnalystService
  98814. * @deprecatedclassinstance L.supermap.trafficTransferAnalystService
  98815. * @classdesc 交通换乘分析服务类。
  98816. * @category iServer TrafficTransferAnalyst
  98817. * @modulecategory Services
  98818. * @example
  98819. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  98820. * //doSomething
  98821. * })
  98822. * @extends {ServiceBase}
  98823. * @param {string} url - 服务地址。
  98824. * @param {Object} options - 参数。
  98825. * @param {string} [options.proxy] - 服务代理地址。
  98826. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98827. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98828. * @param {Object} [options.headers] - 请求头。
  98829. * @usage
  98830. */
  98831. var TrafficTransferAnalystService_TrafficTransferAnalystService = ServiceBase.extend({
  98832. initialize: function(url, options) {
  98833. ServiceBase.prototype.initialize.call(this, url, options);
  98834. this._commonTrafficTransferAnalystService = new TrafficTransferAnalystService(url, options);
  98835. },
  98836. /**
  98837. * @function TrafficTransferAnalystService.prototype.queryStop
  98838. * @description 站点查询服务。
  98839. * @param {StopQueryParameters} params - 站点查询参数类。
  98840. * @param {RequestCallback} callback - 回调函数。
  98841. */
  98842. queryStop: function(params, callback) {
  98843. this._commonTrafficTransferAnalystService.queryStop(params, callback);
  98844. },
  98845. /**
  98846. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  98847. * @description 交通换乘线路查询服务。
  98848. * @param {TransferPathParameters} params - 交通换乘线路查询参数类。
  98849. * @param {RequestCallback} callback - 回调函数。
  98850. */
  98851. analysisTransferPath: function(params, callback) {
  98852. params = this._processParams(params);
  98853. this._commonTrafficTransferAnalystService.analysisTransferPath(params, callback);
  98854. },
  98855. /**
  98856. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  98857. * @description 交通换乘方案查询服务。
  98858. * @param {TransferSolutionParameters} params - 交通换乘方案查询参数类。
  98859. * @param {RequestCallback} callback - 回调函数。
  98860. */
  98861. analysisTransferSolution: function(params, callback) {
  98862. params = this._processParams(params);
  98863. this._commonTrafficTransferAnalystService.analysisTransferSolution(params, callback);
  98864. },
  98865. _processParams: function(params) {
  98866. if (!params) {
  98867. return {};
  98868. }
  98869. if (params.points && external_L_default().Util.isArray(params.points)) {
  98870. params.points.map(function(point, key) {
  98871. params.points[key] = point instanceof (external_L_default()).LatLng ? { x: point.lng, y: point.lat } : point;
  98872. return params.points[key];
  98873. });
  98874. }
  98875. return params;
  98876. }
  98877. });
  98878. var trafficTransferAnalystService = function(url, options) {
  98879. return new TrafficTransferAnalystService_TrafficTransferAnalystService(url, options);
  98880. };
  98881. ;// CONCATENATED MODULE: ./src/leaflet/services/WebPrintingJobService.js
  98882. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98883. * This program are made available under the terms of the Apache License, Version 2.0
  98884. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98885. /**
  98886. * @class WebPrintingJobService
  98887. * @deprecatedclassinstance L.supermap.webPrintingJobService
  98888. * @classdesc Web 打印服务类。
  98889. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  98890. * @category iServer WebPrintingJob
  98891. * @modulecategory Services
  98892. * @example
  98893. * new WebPrintingJobService(url)
  98894. * .createWebPrintingJob(param,function(result){
  98895. * //doSomething
  98896. * })
  98897. * @extends {ServiceBase}
  98898. * @version 10.1.0
  98899. * @param {string} url - 服务地址。
  98900. * @param {Object} options - 参数。
  98901. * @param {string} [options.proxy] - 服务代理地址。
  98902. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98903. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98904. * @param {Object} [options.headers] - 请求头。
  98905. * @usage
  98906. */
  98907. var WebPrintingJobService = ServiceBase.extend({
  98908. initialize: function(url, options) {
  98909. ServiceBase.prototype.initialize.call(this, url, options);
  98910. this._webPrintingService = new WebPrintingService(this.url, {
  98911. proxy: this.options.proxy,
  98912. withCredentials:this.options.withCredentials,
  98913. crossOrigin: this.options.crossOrigin,
  98914. headers: this.options.headers
  98915. });
  98916. },
  98917. /**
  98918. * @function WebPrintingJobService.prototype.createWebPrintingJob
  98919. * @description 创建 Web 打印任务。
  98920. * @param {WebPrintingJobParameters} params - Web 打印参数类。
  98921. * @param {RequestCallback} callback - 回调函数。
  98922. */
  98923. createWebPrintingJob(params, callback) {
  98924. if (!params) {
  98925. return;
  98926. }
  98927. this._webPrintingService.createWebPrintingJob(this._processParams(params), callback);
  98928. },
  98929. /**
  98930. * @function WebPrintingJobService.prototype.getPrintingJob
  98931. * @description 获取 Web 打印输出文档任务。
  98932. * @param {string} jobId - Web 打印输入文档任务 ID。
  98933. * @param {RequestCallback} callback - 回调函数。
  98934. */
  98935. getPrintingJob: function(jobId, callback) {
  98936. this._webPrintingService.getPrintingJob(jobId, callback);
  98937. },
  98938. /**
  98939. * @function WebPrintingJobService.prototype.getPrintingJobResult
  98940. * @description 获取 Web 打印任务的输出文档。
  98941. * @param {string} jobId - Web 打印输入文档任务 ID。
  98942. * @param {RequestCallback} callback - 回调函数。
  98943. */
  98944. getPrintingJobResult: function(jobId, callback) {
  98945. this._webPrintingService.getPrintingJobResult(jobId, callback);
  98946. },
  98947. /**
  98948. * @function WebPrintingJobService.prototype.getLayoutTemplates
  98949. * @description 查询 Web 打印服务所有可用的模板信息。
  98950. * @param {RequestCallback} callback - 回调函数。
  98951. */
  98952. getLayoutTemplates: function(callback) {
  98953. this._webPrintingService.getLayoutTemplates(callback);
  98954. },
  98955. _processParams(params) {
  98956. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  98957. params.layoutOptions.littleMapOptions.center = this._toPointObject(
  98958. params.layoutOptions.littleMapOptions.center
  98959. );
  98960. }
  98961. if (params.exportOptions) {
  98962. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  98963. }
  98964. return params;
  98965. },
  98966. _toPointObject(point) {
  98967. if (external_L_default().Util.isArray(point)) {
  98968. return {
  98969. x: point[0],
  98970. y: point[1]
  98971. };
  98972. } else if (point instanceof Point || point instanceof (external_L_default()).Point) {
  98973. return {
  98974. x: point.x,
  98975. y: point.y
  98976. };
  98977. } else if (point instanceof (external_L_default()).LatLng) {
  98978. return {
  98979. x: point.lng,
  98980. y: point.lat
  98981. };
  98982. }
  98983. return point;
  98984. }
  98985. });
  98986. var webPrintingJobService = function(url, options) {
  98987. return new WebPrintingJobService(url, options);
  98988. };
  98989. ;// CONCATENATED MODULE: ./src/leaflet/services/ImageService.js
  98990. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98991. * This program are made available under the terms of the Apache License, Version 2.0
  98992. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98993. /**
  98994. * @class ImageService
  98995. * @deprecatedclassinstance L.supermap.imageService
  98996. * @version 10.2.0
  98997. * @constructs ImageService
  98998. * @classdesc 影像服务类。
  98999. * @category iServer Image
  99000. * @modulecategory Services
  99001. * @extends {ServiceBase}
  99002. * @example
  99003. * new ImageService(url,options)
  99004. * .getCollections(function(result){
  99005. * //doSomething
  99006. * })
  99007. * @param {string} url - 服务地址。
  99008. * @param {Object} options - 参数。
  99009. * @param {string} [options.proxy] - 服务代理地址。
  99010. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  99011. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  99012. * @param {Object} [options.headers] - 请求头。
  99013. * @usage
  99014. */
  99015. var ImageService_ImageService = ServiceBase.extend({
  99016. initialize: function (url, options) {
  99017. ServiceBase.prototype.initialize.call(this, url, options);
  99018. this._imageService = new ImageService(this.url, {
  99019. proxy: this.options.proxy,
  99020. withCredentials: this.options.withCredentials,
  99021. crossOrigin: this.options.crossOrigin,
  99022. headers: this.options.headers
  99023. });
  99024. },
  99025. /**
  99026. * @function ImageService.prototype.getCollections
  99027. * @description 返回影像集合列表(Collections)。
  99028. * @param {RequestCallback} callback - 回调函数。
  99029. */
  99030. getCollections: function (callback) {
  99031. this._imageService.getCollections(callback);
  99032. },
  99033. /**
  99034. * @function ImageService.prototype.getCollectionByID
  99035. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  99036. * @param {string} collectionId 影像集合( Collection )的 ID ,在一个影像服务中唯一标识影像集合。
  99037. * @param {RequestCallback} callback - 回调函数。
  99038. */
  99039. getCollectionByID: function (collectionId, callback) {
  99040. this._imageService.getCollectionByID(collectionId, callback);
  99041. },
  99042. /**
  99043. * @function ImageService.prototype.search
  99044. * @description 查询与过滤条件匹配的影像数据。
  99045. * @param {ImageSearchParameter} [itemSearch] 查询参数。
  99046. * @param {RequestCallback} callback - 回调函数。
  99047. */
  99048. search: function (itemSearch, callback) {
  99049. this._imageService.search(itemSearch, callback);
  99050. }
  99051. });
  99052. var imageService = function (url, options) {
  99053. return new ImageService_ImageService(url, options);
  99054. };
  99055. ;// CONCATENATED MODULE: ./src/leaflet/services/ImageCollectionService.js
  99056. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99057. * This program are made available under the terms of the Apache License, Version 2.0
  99058. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99059. /**
  99060. * @class ImageCollectionService
  99061. * @deprecatedclassinstance L.supermap.imageCollectionService
  99062. * @version 10.2.0
  99063. * @constructs ImageCollectionService
  99064. * @classdesc 影像集合服务类。
  99065. * @category iServer Image
  99066. * @modulecategory Services
  99067. * @extends {ServiceBase}
  99068. * @example
  99069. * new ImageCollectionService(url,options)
  99070. * .getLegend(queryParams, function(result){
  99071. * //doSomething
  99072. * })
  99073. * @param {string} url - 服务地址。
  99074. * @param {Object} options - 参数。
  99075. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  99076. * @param {string} [options.proxy] - 服务代理地址。
  99077. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  99078. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  99079. * @param {Object} [options.headers] - 请求头。
  99080. * @usage
  99081. */
  99082. var ImageCollectionService_ImageCollectionService = ServiceBase.extend({
  99083. initialize: function (url, options) {
  99084. ServiceBase.prototype.initialize.call(this, url, options);
  99085. this._imageCollectionService = new ImageCollectionService(this.url, {
  99086. collectionId: this.options.collectionId,
  99087. proxy: this.options.proxy,
  99088. withCredentials: this.options.withCredentials,
  99089. crossOrigin: this.options.crossOrigin,
  99090. headers: this.options.headers
  99091. });
  99092. },
  99093. /**
  99094. * @function ImageCollectionService.prototype.getLegend
  99095. * @param {Object} queryParams query 参数。
  99096. * @param {ImageRenderingRule} [queryParams.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。默认使用发布服务时所配置的风格。
  99097. * @param {RequestCallback} callback - 回调函数。
  99098. */
  99099. getLegend: function (queryParams, callback) {
  99100. this._imageCollectionService.getLegend(queryParams, callback);
  99101. },
  99102. /**
  99103. * @function ImageCollectionService.prototype.getStatistics
  99104. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  99105. * @param {RequestCallback} callback - 回调函数。
  99106. */
  99107. getStatistics: function (callback) {
  99108. this._imageCollectionService.getStatistics(callback);
  99109. },
  99110. /**
  99111. * @function ImageCollectionService.prototype.getTileInfo
  99112. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  99113. * @param {RequestCallback} callback - 回调函数。
  99114. */
  99115. getTileInfo: function (callback) {
  99116. this._imageCollectionService.getTileInfo(callback);
  99117. },
  99118. /**
  99119. * @function ImageCollectionService.prototype.deleteItemByID
  99120. * @description 删除影像集合中指定ID (`featureId`)的Item对象,即从影像集合中删除指定的影像。
  99121. * @param {string} featureId Feature 的本地标识符。
  99122. * @param {RequestCallback} callback - 回调函数。
  99123. */
  99124. deleteItemByID(featureId, callback) {
  99125. this._imageCollectionService.deleteItemByID(featureId, callback);
  99126. },
  99127. /**
  99128. * @function ImageCollectionService.prototype.getItemByID
  99129. * @description 返回影像集合中指定ID (`featureId`)的Item对象,即返回影像集合中指定的影像。
  99130. * @param {string} featureId Feature 的本地标识符。
  99131. * @param {RequestCallback} callback - 回调函数。
  99132. */
  99133. getItemByID(featureId, callback) {
  99134. this._imageCollectionService.getItemByID(featureId, callback);
  99135. }
  99136. });
  99137. var imageCollectionService = function (url, options) {
  99138. return new ImageCollectionService_ImageCollectionService(url, options);
  99139. };
  99140. ;// CONCATENATED MODULE: ./src/leaflet/services/index.js
  99141. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99142. * This program are made available under the terms of the Apache License, Version 2.0
  99143. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99144. ;// CONCATENATED MODULE: ./src/leaflet/components/ComponentsViewBase.js
  99145. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99146. * This program are made available under the terms of the Apache License, Version 2.0
  99147. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99148. /**
  99149. * @class ComponentsViewBase
  99150. * @aliasclass Components.ComponentsViewBase
  99151. * @deprecatedclassinstance L.supermap.components.componentsViewBase
  99152. * @classdesc Lealfet 组件基类。
  99153. * @category Components Common
  99154. * @version 9.1.1
  99155. * @param {Object} options - 参数。
  99156. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  99157. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
  99158. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  99159. * @extends {L.Control}
  99160. * @usage
  99161. */
  99162. var ComponentsViewBase = external_L_default().Control.extend({
  99163. options: {
  99164. //控件位置 继承自leaflet control
  99165. position: 'topright',
  99166. //默认样式,以支持组件设置图层基本样式
  99167. style: (feature, latLng) => {
  99168. if (latLng /*&& feature instanceof L.latLng || feature.geometry.type.toLowerCase() === "point"*/) {
  99169. return external_L_default().circleMarker(latLng, {
  99170. fillColor: 'blue',
  99171. weight: 1,
  99172. opacity: 1,
  99173. color: 'blue',
  99174. fillOpacity: 0.6
  99175. });
  99176. } else {
  99177. return {
  99178. fillColor: 'blue',
  99179. weight: 1,
  99180. opacity: 1,
  99181. color: 'blue',
  99182. fillOpacity: 0.6
  99183. }
  99184. }
  99185. },
  99186. onEachFeature: null
  99187. },
  99188. initialize(options) {
  99189. external_L_default().setOptions(this, options);
  99190. //组件事件处理对象://todo 确认一些公开或私有的成员变量
  99191. this._event = new (external_L_default()).Evented();
  99192. //组件根 dom 元素:
  99193. this.rootContainer = null;
  99194. //图层参数,主要配置组件返回数据图层的样式和事件等
  99195. },
  99196. /**
  99197. * @function ComponentsViewBase.prototype.onAdd
  99198. * @description 向地图添加组件。
  99199. */
  99200. onAdd(map) {
  99201. //子类实现此方法
  99202. this.map = map;
  99203. this.rootContainer = this._initView();
  99204. return this.rootContainer;
  99205. },
  99206. /**
  99207. * @function ComponentsViewBase.prototype.on
  99208. * @description 事件绑定。
  99209. * @param {string} eventType - 监听的事件类型。
  99210. * @param {function} callback - 监听事件的回调函数。
  99211. */
  99212. on(eventType, callback) {
  99213. this._event.on(eventType, callback);
  99214. },
  99215. /**
  99216. * @function ComponentsViewBase.prototype.off
  99217. * @description 事件关闭。
  99218. * @param {string} eventType - 监听的事件名。
  99219. * @param {function} callback - 监听事件的回调函数。
  99220. */
  99221. off(eventType, callback) {
  99222. if (callback) {
  99223. this._event.off(eventType, callback);
  99224. return;
  99225. }
  99226. this._event.off(eventType);
  99227. },
  99228. /**
  99229. * @function ComponentsViewBase.prototype._initView
  99230. * @description 初始化组件 UI。
  99231. * @private
  99232. */
  99233. _initView() {
  99234. //子类实现此方法
  99235. },
  99236. /**
  99237. * @function ComponentsViewBase.prototype._preventMapEvent
  99238. * @description 阻止 map 默认事件。
  99239. * @private
  99240. */
  99241. _preventMapEvent(div, map) {
  99242. if (!div || !map) {
  99243. return;
  99244. }
  99245. div.addEventListener('mouseover', function () {
  99246. map.dragging.disable();
  99247. map.scrollWheelZoom.disable();
  99248. map.doubleClickZoom.disable();
  99249. });
  99250. div.addEventListener('mouseout', function () {
  99251. map.dragging.enable();
  99252. map.scrollWheelZoom.enable();
  99253. map.doubleClickZoom.enable();
  99254. });
  99255. }
  99256. });
  99257. var componentsViewBase = function (options) {
  99258. return new ComponentsViewBase(options);
  99259. };
  99260. ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileViewModel.js
  99261. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99262. * This program are made available under the terms of the Apache License, Version 2.0
  99263. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99264. /**
  99265. * @class OpenFileViewModel
  99266. * @aliasclass Components.OpenFileViewModel
  99267. * @deprecatedclassinstance L.supermap.components.openFileViewModel
  99268. * @classdesc 打开本地文件组件功能类,目前只支持 WGS84 经纬度坐标。
  99269. * @version 9.1.1
  99270. * @category Components OpenFile
  99271. * @param {L.Map} map - Leaflet Map 对象。
  99272. * @fires OpenFileViewModel#filesizeexceed
  99273. * @fires OpenFileViewModel#errorfileformat
  99274. * @fires OpenFileViewModel#openfilesucceeded
  99275. * @fires OpenFileViewModel#openfilefailed
  99276. * @extends {L.Evented}
  99277. * @usage
  99278. */
  99279. var OpenFileViewModel = external_L_default().Evented.extend({
  99280. initialize() {
  99281. this.fileModel = new FileModel();
  99282. },
  99283. /**
  99284. * @function OpenFileViewModel.prototype.readFile
  99285. * @description 打开文件并加载到地图。
  99286. * @param {Object} fileEventObject - 本地文件对象。
  99287. */
  99288. readFile(fileEventObject) {
  99289. let inputDom = fileEventObject.target;
  99290. let file = inputDom.files[0];
  99291. //文件大小限制
  99292. if (file.size > this.fileModel.FileConfig.fileMaxSize) {
  99293. // document.alert("File supports up to 10M.");
  99294. /**
  99295. * @event OpenFileViewModel#filesizeexceed
  99296. * @description 超出文件大小限制后触发。
  99297. * @property {string} messageType - 警告类型。
  99298. * @property {string} message - 警告内容。
  99299. */
  99300. this.fire("filesizeexceed", {messageType: "warring", message: Lang.i18n('msg_fileSizeExceeded')});
  99301. return false;
  99302. }
  99303. let filePath = inputDom.value;
  99304. let fileName = file.name;
  99305. let fileType = ComponentsUtil.getFileType(fileName);
  99306. //文件格式不支持
  99307. if (!fileType) {
  99308. // document.alert("Unsupported data type.");
  99309. /**
  99310. * @event OpenFileViewModel#errorfileformat
  99311. * @description 文件格式不支持时触发。
  99312. * @property {string} messageType - 警告类型。
  99313. * @property {string} message - 警告内容。
  99314. */
  99315. this.fire("errorfileformat", {messageType: "failure", message: Lang.i18n('msg_fileTypeUnsupported')});
  99316. return false;
  99317. }
  99318. //文件类型限制
  99319. if (fileName !== "") {
  99320. //给control 一份数据
  99321. //todo MVVM模式 应该是数据变化触发数据变化的事件
  99322. this.fileModel.set(
  99323. "loadFileObject", {
  99324. file: file,
  99325. filePath: filePath,
  99326. fileName: fileName,
  99327. fileType: fileType
  99328. });
  99329. //响应选中文件添加到地图
  99330. this._readData();
  99331. }
  99332. },
  99333. /**
  99334. * @function OpenFileViewModel.prototype._readData
  99335. * @description 数据文件中的数据。
  99336. * @private
  99337. */
  99338. _readData() {
  99339. //todo 需要测试另外两个
  99340. const me = this;
  99341. const type = this.fileModel.loadFileObject.fileType;
  99342. FileReaderUtil.readFile(type, {
  99343. file: this.fileModel.loadFileObject.file,
  99344. path: this.fileModel.loadFileObject.filePath
  99345. }, (data) => {
  99346. //将数据统一转换为 geoJson 格式加载到底图
  99347. FileReaderUtil.processDataToGeoJson(type, data, (geojson) => {
  99348. if (geojson) {
  99349. /**
  99350. * @event OpenFileViewModel#openfilesucceeded
  99351. * @description 打开文件成功。
  99352. * @property {GeoJSONObject} result - GeoJSON 格式数据。
  99353. * @property {string} layerName - 图层名。
  99354. */
  99355. this.fire("openfilesucceeded", {
  99356. result: geojson,
  99357. layerName: this.fileModel.loadFileObject.fileName.split('.')[0]
  99358. });
  99359. }
  99360. }, (e) => {
  99361. me.fire("openfilefailed", {messageType: "failure", message: e});
  99362. }, this);
  99363. }, () => {
  99364. /**
  99365. * @event OpenFileViewModel#openfilefailed
  99366. * @description 打开文件失败。
  99367. * @property {string} messageType - 警告类型。
  99368. * @property {string} message - 警告内容。
  99369. */
  99370. me.fire("openfilefailed", {messageType: "failure", message: Lang.i18n('msg_openFileFail')});
  99371. }, this);
  99372. }
  99373. });
  99374. var openFileViewModel = function (options) {
  99375. return new OpenFileViewModel(options);
  99376. };
  99377. ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileView.js
  99378. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99379. * This program are made available under the terms of the Apache License, Version 2.0
  99380. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99381. /**
  99382. * @class OpenFileView
  99383. * @aliasclass Components.OpenFileView
  99384. * @deprecatedclassinstance L.supermap.components.openFile
  99385. * @classdesc 打开文件组件类。用于打开本地数据文件并加载到地图,目前支持打开.csv|.xls|.xlsx|.geojson|.json 格式,只支持 WGS84 经纬度坐标。
  99386. * @version 9.1.1
  99387. * @modulecategory Components
  99388. * @param {Object} options - 参数。
  99389. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  99390. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
  99391. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  99392. * @fires OpenFileView#openfilesucceeded
  99393. * @fires OpenFileView#openfilefailed
  99394. * @extends {ComponentsViewBase}
  99395. * @category Components OpenFile
  99396. * @usage
  99397. */
  99398. var OpenFileView = ComponentsViewBase.extend({
  99399. options: {
  99400. //绑定的底图图层
  99401. layer: null
  99402. },
  99403. initialize(options) {
  99404. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  99405. //初始化 ViewModel:
  99406. this.viewModel = new OpenFileViewModel();
  99407. },
  99408. /**
  99409. * @function OpenFileView.prototype.setViewStyle
  99410. * @description 设置组件样式。
  99411. * @param {string} styleName - CSS 样式名称。
  99412. * @param {string} value - CSS 样式值。
  99413. */
  99414. setViewStyle(styleName, value) {
  99415. this.rootContainer.style[styleName] = value;
  99416. },
  99417. /**
  99418. * @function OpenFileView.prototype._initView
  99419. * @description 创建打开文件组件。
  99420. * @returns {HTMLElement}
  99421. * @private
  99422. * @override
  99423. */
  99424. _initView() {
  99425. //初始化 view
  99426. const uploadContent = external_L_default().DomUtil.create('div', 'component-openfile');
  99427. uploadContent.id = 'openFile';
  99428. this.fileSelect = external_L_default().DomUtil.create('div', '', uploadContent);
  99429. this.label = external_L_default().DomUtil.create('label', 'component-openfile__span--select', this.fileSelect);
  99430. this.label.htmlFor = "input_file";
  99431. external_L_default().DomUtil.create('div', 'supermapol-icons-upload', this.label);
  99432. const fileSpan = external_L_default().DomUtil.create('span', 'component-openfile__span', this.label);
  99433. fileSpan.appendChild(document.createTextNode(Lang.i18n('text_chooseFile')));
  99434. this.fileInput = external_L_default().DomUtil.create('input', 'component-openfile__input', this.fileSelect);
  99435. this.fileInput.id = "input_file";
  99436. this.fileInput.type = "file";
  99437. this.fileInput.accept = ".json,.geojson,.csv,.xls,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  99438. this.fileInput.onchange = (fileEventObject) => {
  99439. this.messageBox.closeView();
  99440. this.viewModel.readFile(fileEventObject);
  99441. };
  99442. //增加提示框:
  99443. this.messageBox = new MessageBox();
  99444. //添加监听
  99445. this.viewModel.on("filesizeexceed", (e) => {
  99446. this.messageBox.showView(e.message, e.messageType);
  99447. });
  99448. this.viewModel.on("errorfileformat", (e) => {
  99449. this.messageBox.showView(e.message, e.messageType);
  99450. });
  99451. this.viewModel.on("openfilefailed", (e) => {
  99452. this.messageBox.showView(e.message, e.messageType);
  99453. /**
  99454. * @event OpenFileView#openfilefailed
  99455. * @description 打开文件失败。
  99456. * @property {Object} e - 事件对象。
  99457. */
  99458. this._event.fire("openfilefailed", e);
  99459. });
  99460. this.viewModel.on("readdatafail", (e) => {
  99461. this.messageBox.showView(e.message, e.messageType);
  99462. });
  99463. this.viewModel.on("openfilesucceeded", (e) => {
  99464. /**
  99465. * @event OpenFileView#openfilesucceeded
  99466. * @description 打开文件成功。
  99467. * @property {Object} e - 事件对象。
  99468. */
  99469. this._event.fire("openfilesucceeded", e);
  99470. });
  99471. // 阻止 map 默认事件
  99472. this._preventMapEvent(uploadContent, this.map);
  99473. return uploadContent;
  99474. }
  99475. });
  99476. var openFileView = function (options) {
  99477. return new OpenFileView(options);
  99478. };
  99479. ;// CONCATENATED MODULE: ./src/leaflet/components/search/CityConfig.js
  99480. const config = {
  99481. HOT: {
  99482. HOT: ["北京市", "上海市", "广州市", "深圳市", "南京市", "杭州市", "天津市", "重庆市", "成都市", "青岛市", "苏州市", "无锡市", "常州市", "温州市", "武汉市", "长沙市", "南昌市", "三亚市", "合肥市", "石家庄市"]
  99483. },
  99484. AB: {
  99485. A: ["阿拉善盟", "鞍山市", "安庆市", "安阳市", "阿坝藏族羌族自治州", "安顺市", "阿里地区", "安康市", "阿克苏地区", "阿勒泰地区", "阿拉尔市"],
  99486. B: ["北京市", "保定市", "包头市", "巴彦淖尔市", "本溪市", "白山市", "白城市", "蚌埠市", "亳州市", "滨州市", "北海市", "百色市", "白沙黎族自治县", "保亭黎族苗族自治县", "巴中市", "毕节地区", "保山市", "宝鸡市", "白银市", "博尔塔拉蒙古自治州", "巴音郭楞蒙古自治州", "北区"]
  99487. },
  99488. CD: {
  99489. C: ["重庆市", "成都市", "常州市", "长沙市", "承德市", "沧州市", "长治市", "赤峰市", "朝阳市", "长春市", "滁州市", "巢湖市", "池州市", "常德市", "郴州市", "潮州市", "崇左市", "澄迈县", "昌江黎族自治县", "楚雄彝族自治州", "昌都地区", "昌吉回族自治州"],
  99490. D: ["大同市", "大连市", "丹东市", "大庆市", "大兴安岭地区", "东营市", "德州市", "东莞市", "儋州市", "东方市", "定安县", "德阳市", "达州市", "大理白族自治州", "德宏傣族景颇族自治州", "迪庆藏族自治州", "定西市", "东区", "大埔区", "大堂区"]
  99491. },
  99492. EFG: {
  99493. E: ["鄂尔多斯市", "鄂州市", "恩施土家族苗族自治州"],
  99494. F: ["抚顺市", "阜新市", "阜阳市", "福州市", "抚州市", "佛山市", "防城港市"],
  99495. G: ["广州市", "赣州市", "桂林市", "贵港市", "广元市", "广安市", "贵阳市", "固原市", "高雄市", "高雄县", "甘南藏族自治州", "甘孜藏族自治州"]
  99496. },
  99497. H: {
  99498. H: ["杭州市", "合肥市", "邯郸市", "衡水市", "呼和浩特市", "呼伦贝尔市", "葫芦岛市", "哈尔滨市", "鹤岗市", "黑河市", "淮安市", "湖州市", "淮南市", "淮北市", "黄山市", "菏泽市", "鹤壁市", "黄石市", "黄冈市", "衡阳市", "怀化市", "惠州市", "河源市", "贺州市", "河池市", "海口市", "红河哈尼族彝族自治州", "汉中市", "海东地区", "海北藏族自治州", "黄南藏族自治州", "海南藏族自治州", "果洛藏族自治州", "海西蒙古族藏族自治州", "哈密地区", "和田地区", "花莲县", "黄大仙区", "花地玛堂区"]
  99499. },
  99500. J: {
  99501. J: ["晋城市", "晋中市", "锦州市", "吉林市", "鸡西市", "佳木斯市", "嘉兴市", "金华市", "景德镇市", "九江市", "吉安市", "济南市", "济宁市", "焦作市", "济源市", "荆门市", "荆州市", "江门市", "湛江市", "揭阳市", "嘉峪关市", "金昌市", "酒泉市", "基隆市", "嘉义市", "嘉义县", "九龙城区", "嘉模堂区"]
  99502. },
  99503. KL: {
  99504. K: ["开封市", "昆明市", "克拉玛依市", "克孜勒苏柯尔克孜自治州", "喀什地区"],
  99505. L: ["廊坊市", "临汾市", "吕梁市", "辽阳市", "辽源市", "连云港市", "丽水市", "六安市", "龙岩市", "莱芜市", "临沂市", "聊城市", "洛阳市", "漯河市", "娄底市", "柳州市", "来宾市", "临高县", "乐东黎族自治县", "陵水黎族自治县", "泸州市", "乐山市", "凉山彝族自治州", "六盘水市", "丽江市", "临沧市", "拉萨市", "林芝地区", "兰州市", "陇南市", "临夏回族自治州"]
  99506. },
  99507. MNP: {
  99508. M: ["牡丹江市", "马鞍山市", "茂名市", "梅州市", "绵阳市", "眉山市", "苗栗县"],
  99509. N: ["南京市", "南昌市", "南通市", "宁波市", "南平市", "宁德市", "南阳市", "南宁市", "南沙群岛", "内江市", "南充市", "怒江傈傈族自治州", "那曲地区", "南投县"],
  99510. P: ["盘锦市", "莆田市", "萍乡市", "平顶山市", "濮阳市", "攀枝花市", "平凉市", "屏东县", "澎湖县"]
  99511. },
  99512. QR: {
  99513. Q: ["青岛市", "秦皇岛市", "齐齐哈尔市", "黔西南布依族苗族自治州", "七台河市", "衢州市", "泉州市", "潜江市", "清远市", "钦州市", "琼海市", "曲靖市", "庆阳市", "荃湾区", "黔东南苗族侗族自治州", "黔南布依族苗族自治州", "琼中黎族苗族自治县"],
  99514. R: ["日照市", "日喀则地区"]
  99515. },
  99516. S: {
  99517. S: ["上海市", "深圳市", "苏州市", "石家庄市", "三亚市", "朔州市", "沈阳市", "四平市", "松原市", "双鸭山市", "绥化市", "宿迁市", "绍兴市", "宿州市", "三明市", "上饶市", "三门峡市", "商丘市", "十堰市", "随州市", "邵阳市", "韶关市", "汕头市", "汕尾市", "三亚市", "遂宁市", "思茅市", "山南地区", "商洛市", "石嘴山市", "石河子市", "深水埗区", "沙田区", "神农架林区", "圣安多尼堂区", "圣方济各堂区"]
  99518. },
  99519. T: {
  99520. T: ["天津市", "唐山市", "太原市", "通辽市", "铁岭市", "通化市", "泰州市", "台州市", "铜陵市", "泰安市", "天门市", "屯昌县", "铜仁地区", "铜川市", "天水市", "吐鲁番地区", "塔城地区", "图木舒克市", "台北市", "台中市", "台南市", "台北县", "桃园县", "台中县", "台南县", "台东县", "屯门区"]
  99521. },
  99522. W: {
  99523. W: ["无锡市", "温州市", "武汉市", "乌海市", "乌兰察布市", "芜湖市", "潍坊市", "威海市", "梧州市", "五指山市", "文昌市", "万宁市", "文山壮族苗族自治州", "渭南市", "武威市", "吴忠市", "乌鲁木齐市", "五家渠市", "湾仔区", "望德堂区"]
  99524. },
  99525. X: {
  99526. X: ["邢台市", "忻州市", "兴安盟", "徐州市", "宣城市", "厦门市", "新余市", "新乡市", "许昌市", "信阳市", "襄樊市", "孝感市", "咸宁市", "仙桃市", "湘潭市", "西安市", "咸阳市", "西宁市", "新竹市", "新竹县", "西贡区", "锡林郭勒盟", "西沙群岛", "湘西土家族苗族自治州", "西双版纳傣族自治州"]
  99527. },
  99528. Y: {
  99529. Y: ["阳泉市", "运城市", "营口市", "延边朝鲜族自治州", "伊春市", "盐城市", "扬州市", "鹰潭市", "宜春市", "烟台市", "宜昌市", "岳阳市", "益阳市", "永州市", "阳江市", "云浮市", "玉林市", "宜宾市", "雅安市", "玉溪市", "延安市", "榆林市", "玉树藏族自治州", "银川市", "伊犁哈萨克自治州", "宜兰县", "云林县", "油尖旺区", "元朗区"]
  99530. },
  99531. Z: {
  99532. Z: ["郑州市", "张家口市", "镇江市", "舟山市", "漳州市", "淄博市", "枣庄市", "周口市", "驻马店市", "株洲市", "张家界市", "珠海市", "肇庆市", "中山市", "自贡市", "资阳市", "遵义市", "昭通市", "张掖市", "中卫市", "彰化县", "中西区", "中沙群岛的岛礁及其海域"]
  99533. }
  99534. };
  99535. ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJsonLayersModel.js
  99536. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99537. * This program are made available under the terms of the Apache License, Version 2.0
  99538. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99539. /**
  99540. * @class GeoJsonLayersDataModel
  99541. * @aliasclass Components.GeoJsonLayersDataModel
  99542. * @deprecatedclassinstance L.supermap.components.GeoJsonLayersDataModel
  99543. * @description 多图层数据模型。
  99544. * @category Components Common
  99545. * @private
  99546. * @param {Array.<Object>} layers - 图层数组。
  99547. * @param {GeoJSONLayerWithName} layers.layerObject - 含有 layerName 与 GeoJSON 图层的对象。
  99548. * @fires GeoJsonLayersDataModel#newlayeradded
  99549. * @usage
  99550. */
  99551. // todo 看看如何完善
  99552. class GeoJsonLayersDataModel {
  99553. constructor(layers) {
  99554. this.layers = [];
  99555. if (layers && layers.length > 0) {
  99556. this.addLayers(layers);
  99557. }
  99558. this.currentLayerDataModel = null;
  99559. }
  99560. addLayers(layers, success, failed, context) {
  99561. for (let i = 0; i < layers.length; i++) {
  99562. let layerName = layers[i].layerName;
  99563. if (layers[i].layer instanceof (external_L_default()).GeoJSON) {
  99564. let geoJsonLayerDataModel = new GeoJsonLayerDataModel(layers[i].layer);
  99565. //赋给 GeoJsonLayersDataModel 对象 layerName 属性,每个图层名对应一个 layerDataModel 对象
  99566. this.layers[layerName] = geoJsonLayerDataModel;
  99567. success && success.call(context, {layerName: layerName, layer: geoJsonLayerDataModel});
  99568. } else {
  99569. failed && failed.call(context, "")
  99570. }
  99571. }
  99572. }
  99573. /**
  99574. * @function GeoJsonLayersDataModel.prototype.setCurrentLayerDataModel
  99575. * @description 设置当前选中的图层。
  99576. * @param {string} layerName - 选中的图层名称。
  99577. */
  99578. setCurrentLayerDataModel(layerName) {
  99579. if (this.layers[layerName]) {
  99580. this.currentLayerDataModel = this.layers[layerName];
  99581. }
  99582. }
  99583. }
  99584. /**
  99585. * @class GeoJsonLayerDataModel
  99586. * @classdesc 图层数据模型,可用于图层要素数据、属性管理等。
  99587. * @category Components Common
  99588. * @param {L.GeoJSON} layer - GeoJSON 图层。
  99589. * 注:leaflet 没有 feature 的概念
  99590. * @usage
  99591. */
  99592. class GeoJsonLayerDataModel {
  99593. constructor(layer) {
  99594. //图层对象
  99595. this.layer = layer;
  99596. //要素图层数组
  99597. this.features = layer.getLayers();
  99598. //图层属性字段
  99599. this.attributeNames = [];
  99600. //这里一个图层默认共用一套属性字段
  99601. if (this.features[0].feature.properties) {
  99602. for (let field in this.features[0].feature.properties) {
  99603. this.attributeNames.push(field);
  99604. }
  99605. }
  99606. //指定图层操作属性字段
  99607. this.operatingAttributeNames = [];
  99608. //图层属性对象
  99609. this.attributes = {};
  99610. }
  99611. /**
  99612. * @function GeoJsonLayerDataModel.prototype.setOperatingAttributeNames
  99613. * @description 指定操作字段。
  99614. * @param {Array.<string>} operatingAttr - 查询属性字段数组,该数组为 this.attributeNames 的子集。
  99615. */
  99616. setOperatingAttributeNames(operatingAttr) {
  99617. this.operatingAttributeNames = operatingAttr;
  99618. }
  99619. /**
  99620. * @function GeoJsonLayerDataModel.prototype.getAllAttributeNames
  99621. * @description 获取图层所有属性名称。
  99622. * @returns {Array.<string>} 返回图层所有属性名称。
  99623. */
  99624. getAllAttributeNames() {
  99625. return this.attributeNames;
  99626. }
  99627. /**
  99628. * @function GeoJsonLayerDataModel.prototype.getAttributeNamesByType
  99629. * @description 获取指定类型的图层属性字段。
  99630. * @param {string} [type] - 类型参数。默认返回所有字段,可选 'Num'。
  99631. * @returns {Array.<string>} 返回指定类型的图层属性字段。
  99632. */
  99633. getAttributeNamesByType(type) {
  99634. //图层属性字段
  99635. if (this.features[0].feature.properties) {
  99636. let properties = this.features[0].feature.properties;
  99637. let attributeNames = [];
  99638. if (type === 'Num') {
  99639. for (let field in properties) {
  99640. if (!isNaN(properties[field])) {
  99641. attributeNames.push(field);
  99642. }
  99643. }
  99644. } else {
  99645. attributeNames = this.attributeNames;
  99646. }
  99647. return attributeNames;
  99648. }
  99649. }
  99650. /**
  99651. * @function GeoJsonLayerDataModel.prototype.getAllFeatures
  99652. * @description 获取图层所有要素。
  99653. * @returns {Array.<Object>} 返回图层所有要素。
  99654. */
  99655. getAllFeatures() {
  99656. return this.features;
  99657. }
  99658. /**
  99659. * @function GeoJsonLayerDataModel.prototype.getAttributeValueByAttributeName
  99660. * @description 获取属性值。
  99661. * @param {string} attributeName - 属性名称。
  99662. * @returns {Object} 返回属性值对象。
  99663. */
  99664. getAttributeValueByAttributeName(attributeName) {
  99665. //如果图层属性对象中已存在该属性,则直接返回
  99666. if (this.attributes[attributeName]) {
  99667. return this.attributes[attributeName];
  99668. }
  99669. //若图层属性对象还未存储该属性,则遍历每个feature 读取其属性值,并存储到图层属性对象中
  99670. this.attributes[attributeName] = [];
  99671. for (let i = 0; i < this.features.length; i++) {
  99672. this.attributes[attributeName].push([this.features[i].feature.properties[attributeName]]);
  99673. }
  99674. return this.attributes[attributeName];
  99675. }
  99676. //getAttributeValueByAttributeName(feature,attributeName)
  99677. //getAllFeatures()
  99678. //todo getFeatureByID()
  99679. //getFeaturesByKeywords(keyword,searchAttributeNames)
  99680. //getAllAttributeValues(attributeName) ??
  99681. //getAllAttributeNames()
  99682. /**
  99683. * @function GeoJsonLayerDataModel.prototype.getFeaturesByKeyWord
  99684. * @description 查询要素对象。
  99685. * @param {string} keyWord - 查询关键字。
  99686. * @returns {Array.<Object>} 返回要素对象数组。
  99687. */
  99688. getFeaturesByKeyWord(keyWord) {
  99689. let features = [], keyReg = new RegExp(keyWord.toLowerCase());
  99690. const self = this;
  99691. this.features.forEach(function (feature) {
  99692. if (!feature.feature.properties) {
  99693. return null;
  99694. }
  99695. let fAttr = feature.feature.properties;
  99696. let operatingAttributeNames;
  99697. //若设置了过滤字段,则按过滤字段查询
  99698. if (self.operatingAttributeNames.length > 0) {
  99699. operatingAttributeNames = self.operatingAttributeNames;
  99700. } else {
  99701. //若未设置了过滤字段,则按图层字段查询
  99702. operatingAttributeNames = self.attributeNames;
  99703. }
  99704. //遍历要素,查询符合条件的要素
  99705. for (let i = 0, len = operatingAttributeNames.length; i < len; i++) {
  99706. if (fAttr[operatingAttributeNames[i]] && keyReg.test(fAttr[operatingAttributeNames[i]].toString().toLowerCase())) {
  99707. let filterAttributeName = operatingAttributeNames[i];
  99708. let filterAttributeValue = fAttr[operatingAttributeNames[i]];
  99709. //将查询出的属性字段及属性值赋给 feature 并返回
  99710. feature.filterAttribute = {
  99711. filterAttributeName: filterAttributeName,
  99712. filterAttributeValue: filterAttributeValue
  99713. };
  99714. features.push(feature);
  99715. break;
  99716. }
  99717. }
  99718. });
  99719. return features;
  99720. }
  99721. }
  99722. ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchViewModel.js
  99723. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99724. * This program are made available under the terms of the Apache License, Version 2.0
  99725. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99726. /**
  99727. * @class SearchViewModel
  99728. * @aliasclass Components.SearchViewModel
  99729. * @deprecatedclassinstance L.supermap.components.searchViewModel
  99730. * @classdesc 图层查询组件功能类。
  99731. * @version 9.1.1
  99732. * @category Components Search
  99733. * @param {L.Map} map - Leaflet Map 对象。
  99734. * @param {Object} options - 参数。
  99735. * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""},默认为 online 本地搜索服务。
  99736. * @fires SearchViewModel#newlayeradded
  99737. * @fires SearchViewModel#searchlayersucceeded
  99738. * @fires SearchViewModel#searchfailed
  99739. * @fires SearchViewModel#geocodesucceeded
  99740. * @extends {L.Evented}
  99741. * @usage
  99742. */
  99743. var SearchViewModel = external_L_default().Evented.extend({
  99744. options: {
  99745. cityGeoCodingConfig: {
  99746. addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
  99747. key: "fvV2osxwuZWlY0wJb8FEb2i5"
  99748. }
  99749. },
  99750. initialize(map, options) {
  99751. if (map) {
  99752. /**
  99753. * @member {L.Map} SearchViewModel.prototype.map
  99754. * @description 当前组件所在的地图。
  99755. */
  99756. this.map = map;
  99757. } else {
  99758. return new Error(`Cannot find map, fileModel.map cannot be null.`);
  99759. }
  99760. external_L_default().Util.setOptions(this, options);
  99761. //初始化Model
  99762. this.dataModel = new GeoJsonLayersDataModel();
  99763. //初始话地址匹配服务
  99764. this.geoCodeParam = {
  99765. keyWords: '北京市',
  99766. city: "北京市",
  99767. pageSize: this.options.pageSize,
  99768. pageNum: this.options.pageNum
  99769. };
  99770. //查询缓存
  99771. this.searchCache = {};
  99772. },
  99773. /**
  99774. * @function SearchViewModel.prototype.search
  99775. * @description 查询。
  99776. * @param {string} keyWords - 查询的关键字。
  99777. * @param {string} [searchLayerName] - 执行的查询类型,支执行矢量图层属性查询,当为 "geocode" 则执行地址匹配。
  99778. */
  99779. search(keyWord, searchLayerName) {
  99780. if (!searchLayerName) {
  99781. this.searchFromCityLocalSearchService(keyWord);
  99782. } else {
  99783. this.searchFromLayer(keyWord, searchLayerName);
  99784. }
  99785. },
  99786. /**
  99787. * @function SearchViewModel.prototype.searchFromLayer
  99788. * @description 图层属性查询。
  99789. * @param {string} searchLayerName - 查询的图层名。
  99790. * @param {string} keyWord - 图层属性搜索关键字。
  99791. */
  99792. searchFromLayer(keyWord, searchLayerName) {
  99793. if (this.dataModel.layers[searchLayerName]) {
  99794. let resultFeatures = this.dataModel.layers[searchLayerName].getFeaturesByKeyWord(keyWord);
  99795. if (resultFeatures && resultFeatures.length > 0) {
  99796. /**
  99797. * @event SearchViewModel#searchlayersucceeded
  99798. * @description 图层属性查询成功后触发。
  99799. * @property {Object} result - 图层数据。
  99800. */
  99801. this.fire("searchlayersucceeded", {
  99802. result: resultFeatures
  99803. });
  99804. } else {
  99805. /**
  99806. * @event SearchViewModel#searchfailed
  99807. * @description 图层属性查询失败后触发。
  99808. * @property {string} searchType - 图层属性查询状态。
  99809. */
  99810. this.fire("searchfailed", {
  99811. searchType: "searchLayersField"
  99812. });
  99813. }
  99814. }
  99815. },
  99816. /**
  99817. * @function SearchViewModel.prototype.searchFromCityLocalSearchService
  99818. * @description 城市地址匹配查询。
  99819. * @param {string} keyWords - 城市地址匹配查询关键字。
  99820. */
  99821. searchFromCityLocalSearchService(keyWords) {
  99822. //todo 是否保留缓存?请求过的数据保留一份缓存?
  99823. if (this.searchCache[keyWords]) {
  99824. /**
  99825. * @event SearchViewModel#geocodesucceeded
  99826. * @description 城市地址匹配成功后触发。
  99827. * @property {Object} result - 城市匹配成功后返回的数据。
  99828. */
  99829. this.fire("geocodesucceeded", {
  99830. result: this.searchCache[keyWords]
  99831. });
  99832. } else {
  99833. this.geoCodeParam.keyWords = keyWords || this.geoCodeParam.city;
  99834. const self = this;
  99835. let url = this._getSearchUrl(this.geoCodeParam);
  99836. FetchRequest.get(url).then((response) => {
  99837. return response.json();
  99838. }).then((geocodingResult) => {
  99839. if (geocodingResult.error || geocodingResult.poiInfos.length === 0) {
  99840. self.fire("searchfailed", {
  99841. searchType: "searchGeocodeField"
  99842. });
  99843. return;
  99844. }
  99845. if (geocodingResult.poiInfos) {
  99846. const geoJsonResult = self._dataToGeoJson(geocodingResult.poiInfos, self.geoCodeParam);
  99847. self.fire("geocodesucceeded", {
  99848. result: geoJsonResult
  99849. });
  99850. }
  99851. })
  99852. }
  99853. },
  99854. /**
  99855. * @function SearchViewModel.prototype.addSearchLayers
  99856. * @description 添加新的可查询图层。
  99857. * @param {Array.<L.GeoJSON>} layers - 新添加的图层对象。
  99858. */
  99859. addSearchLayers(layers) {
  99860. this.dataModel.addLayers(layers, (e) => {
  99861. /**
  99862. * @event SearchViewModel#newlayeradded
  99863. * @description 添加查询图层事件。
  99864. * @property {Object} result - 事件返回的新的查询图层对象。
  99865. * @property {string} layerName - 事件返回的新的查询图层对象名。
  99866. */
  99867. this.fire("newlayeradded", {
  99868. layerName: e.layerName
  99869. });
  99870. }, null, this);
  99871. },
  99872. /**
  99873. * @function SearchViewModel.prototype.panToLayer
  99874. * @description 缩放到指定图层。
  99875. * @param {string} layerName - 指定缩放的图层名。
  99876. */
  99877. panToLayer(layerName) {
  99878. if (this.dataModel.layers[layerName]) {
  99879. this.map.flyToBounds(this.dataModel.layers[layerName].layer.getBounds());
  99880. }
  99881. },
  99882. /**
  99883. * @function SearchViewModel.prototype.panToCity
  99884. * @description 缩放到指定城市。
  99885. * @param {string} city - 指定缩放的城市名。
  99886. */
  99887. panToCity(city) {
  99888. this.geoCodeParam.keyWords = city;
  99889. this.geoCodeParam.city = city;
  99890. const self = this;
  99891. let url = this._getSearchUrl(this.geoCodeParam);
  99892. FetchRequest.get(url).then((response) => {
  99893. return response.json();
  99894. }).then((geocodingResult) => {
  99895. if (geocodingResult.poiInfos.length > 0) {
  99896. //缩放至城市
  99897. const center = external_L_default().latLng(geocodingResult.poiInfos[0].location.y, geocodingResult.poiInfos[0].location.x);
  99898. self.map.setView(center, 8);
  99899. } else {
  99900. self.fire("searchfailed", {
  99901. searchType: "cityGeocodeField"
  99902. });
  99903. }
  99904. })
  99905. },
  99906. /**
  99907. * @description 将地址匹配返回的数据转为 GeoJSON 格式数据。
  99908. * @param data
  99909. * @private
  99910. */
  99911. _dataToGeoJson(data, geoCodeParam) {
  99912. let features = [];
  99913. for (let i = 0; i < data.length; i++) {
  99914. let feature = {
  99915. type: "Feature",
  99916. geometry: {
  99917. type: "Point",
  99918. coordinates: [data[i].location.x, data[i].location.y]
  99919. },
  99920. properties: {
  99921. name: data[i].name || geoCodeParam.keyWords,
  99922. address: data[i].formatedAddress || data[i].address
  99923. }
  99924. };
  99925. features.push(feature);
  99926. }
  99927. return features;
  99928. },
  99929. /**
  99930. * @function SearchViewModel.prototype._getSearchUrl
  99931. * @description 获取地理编码查询地址。
  99932. * @param {Object} geoCodeParam - 地理编码查询参数。
  99933. * @private
  99934. */
  99935. _getSearchUrl(geoCodeParam) {
  99936. let url = this.options.cityGeoCodingConfig.addressUrl + `.json?keywords=${geoCodeParam.keyWords}&city=${geoCodeParam.city}&pageSize=${geoCodeParam.pageSize}&pageNum=${geoCodeParam.pageNum}&key=${this.options.cityGeoCodingConfig.key}`;
  99937. return url;
  99938. }
  99939. });
  99940. var searchViewModel = function (options) {
  99941. return new SearchViewModel(options);
  99942. };
  99943. ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchView.js
  99944. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  99945. * This program are made available under the terms of the Apache License, Version 2.0
  99946. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  99947. /**
  99948. * @class SearchView
  99949. * @aliasclass Components.Search
  99950. * @deprecatedclassinstance L.supermap.components.search
  99951. * @classdesc 图层查询组件类。
  99952. * @category Components Search
  99953. * @modulecategory Components
  99954. * @version 9.1.1
  99955. * @param {Object} options - 参数。
  99956. * @param {Object|Array.<string>} [options.cityConfig] - 城市地址匹配配置,默认为全国城市,与 options.cityGeoCodingConfig 支持匹配的服务对应;
  99957. * 配置两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或 ["成都市","北京市"],用户可根据自己的项目需求进行配置。
  99958. * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""} 默认为 online 地址匹配服务,与 options.cityConfig 对应。
  99959. * @param {boolean} [options.isGeoCoding=true] - 是否支持城市地址匹配功能。
  99960. * @param {number} [options.pageSize=10] - 地址匹配查询返回记录结果数,最大设置为 20。
  99961. * @param {number} [options.pageNum=1] - 地址匹配查询分页页码,默认 1 代表第一页。
  99962. * @param {number} [options.perPageDataNum=8] - 每页显示个数,最大值为 8。
  99963. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  99964. * @param {function} [options.style] - 默认图层样式。点样式( maker|circleMaker);线和面样式( L.path )。
  99965. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  99966. * @extends {ComponentsViewBase}
  99967. * @fires SearchView#searchlayersucceeded
  99968. * @fires SearchView#searchfailed
  99969. * @fires SearchView#geocodesucceeded
  99970. * @usage
  99971. */
  99972. var SearchView = ComponentsViewBase.extend({
  99973. options: {
  99974. cityConfig: config,
  99975. cityGeoCodingConfig: {
  99976. addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
  99977. key: "fvV2osxwuZWlY0wJb8FEb2i5"
  99978. },
  99979. isGeoCoding: true,
  99980. pageSize: 10,
  99981. pageNum: 1,
  99982. perPageDataNum: 8
  99983. },
  99984. initialize(options) {
  99985. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  99986. //当前选中查询的图层名:
  99987. this.currentSearchLayerName = "";
  99988. this.isSearchLayer = false;
  99989. this.perPageDataNum = this.options.perPageDataNum;
  99990. },
  99991. /*------以下是一些接口-----*/
  99992. /**
  99993. * @function SearchView.prototype.onAdd
  99994. * @description 向底图添加组件。
  99995. * @private
  99996. * @override
  99997. */
  99998. onAdd: function (map) {
  99999. //初始化组件业务逻辑执行对象 viewModel
  100000. this.viewModel = new SearchViewModel(map, this.options);
  100001. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  100002. },
  100003. /**
  100004. * @function SearchView.prototype.addSearchLayer
  100005. * @description 添加可查询的图层。
  100006. * @param {Array.<L.GeoJSON>|L.GeoJSON} layers - 可查询的图层。
  100007. */
  100008. addSearchLayer(layers) {
  100009. //将可查询图层数据传入vm处理
  100010. this.viewModel.addSearchLayers(layers);
  100011. },
  100012. /*----------以下是创建 dom 元素的方法---------*/
  100013. /**
  100014. * @function SearchView.prototype._initView
  100015. * @description 创建地址匹配或图层要素查询组件。
  100016. * @override
  100017. * @returns {HTMLElement}
  100018. * @private
  100019. */
  100020. _initView() {
  100021. // self 便于 this 对象的使用
  100022. const self = this;
  100023. const div = document.createElement("div");
  100024. div.setAttribute("class", "component-search-container");
  100025. //外框
  100026. const poiContainer = document.createElement("div");
  100027. poiContainer.setAttribute("class", "component-search");
  100028. //主体
  100029. //---------下拉框:
  100030. const poiSettings = document.createElement("div");
  100031. poiSettings.setAttribute("class", "component-search__settings");
  100032. //下拉框
  100033. const poiSearchName = document.createElement("div");
  100034. //由View 维护,进行交互操作
  100035. poiSearchName.setAttribute("class", "component-search__settings__name");
  100036. //poiSettings.innerHTML 通过下拉框选项改变
  100037. poiSettings.appendChild(poiSearchName);
  100038. //下拉标记
  100039. const triangleIcon = document.createElement("span");
  100040. triangleIcon.setAttribute("class", "supermapol-icons-solid-down-triangle");
  100041. poiSettings.appendChild(triangleIcon);
  100042. //城市地址匹配页面, 以及图层查询页面
  100043. //城市地址匹配页面:
  100044. let citySelect = null;
  100045. if (this.options.isGeoCoding) {
  100046. const cityTabsPageObj = new CityTabsPage({
  100047. config: this.options.cityConfig
  100048. });
  100049. citySelect = cityTabsPageObj.getElement();
  100050. //点选城市名,修改显示,并执行定位城市查询【城市列表列表点击事件】
  100051. cityTabsPageObj.content.onclick = (e) => {
  100052. if (e.target.nodeName === "SPAN" && e.target.innerText) {
  100053. this.viewModel.panToCity(e.target.innerHTML);
  100054. this.messageBox.closeView();
  100055. poiSearchName.removeChild(poiSearchName.firstChild);
  100056. poiSearchName.insertBefore(document.createTextNode(e.target.innerHTML), poiSearchName.firstChild);
  100057. this.isSearchLayer = false;
  100058. }
  100059. };
  100060. //支持城市地址匹配,则初始化显示配置的第一个城市名:
  100061. poiSearchName.appendChild(document.createTextNode(cityTabsPageObj.content.getElementsByTagName("span")[0].innerText));
  100062. }
  100063. //图层查询页面:写法是为了为了代码可读性
  100064. const layersSelect = function () {
  100065. const layersSelect = document.createElement("div");
  100066. layersSelect.setAttribute("class", "component-search__layers");
  100067. const layersContent = document.createElement("div");
  100068. layersContent.setAttribute("class", "component-search-layers-content");
  100069. layersSelect.appendChild(layersContent);
  100070. //header todo 两个选项的功能暂没用到,先关闭,后续用到再打开
  100071. const layersHeader = document.createElement("div");
  100072. layersHeader.setAttribute("class", "component-search__layers__header");
  100073. //加载搜索条件
  100074. const loadBtn = document.createElement("div");
  100075. loadBtn.setAttribute("class", "load-btn");
  100076. layersHeader.appendChild(loadBtn);
  100077. const loadIcon = document.createElement("span");
  100078. loadIcon.setAttribute("class", "supermapol-icons-poi-load");
  100079. loadBtn.appendChild(loadIcon);
  100080. const loadBtnText = document.createElement("span");
  100081. loadBtnText.appendChild(document.createTextNode(Lang.i18n("text_loadSearchCriteria")));
  100082. loadBtn.appendChild(loadBtnText);
  100083. //保存搜索条件
  100084. const saveBtn = document.createElement("div");
  100085. saveBtn.setAttribute("class", "save-btn");
  100086. layersHeader.appendChild(saveBtn);
  100087. const icon = document.createElement("span");
  100088. icon.setAttribute("class", "supermapol-icons-poi-save");
  100089. saveBtn.appendChild(icon);
  100090. const saveBtnText = document.createElement("span");
  100091. saveBtnText.appendChild(document.createTextNode(Lang.i18n("text_saveSearchCriteria")));
  100092. saveBtn.appendChild(saveBtnText);
  100093. //body
  100094. const layerSelectOptions = document.createElement("div");
  100095. layerSelectOptions.setAttribute("class", "component-search__layers__body");
  100096. //选中查询图层监听
  100097. //选择查询图层【图层列表点击事件】
  100098. layerSelectOptions.onclick = (e) => {
  100099. //先进行清除操作
  100100. self.clearSearchResult();
  100101. let selectLayerOption = null;
  100102. if (e.target.classList[0] === "component-search__layers__itme__singleselect") {
  100103. selectLayerOption = e.target;
  100104. } else if (e.target.classList[0] === "component-single-default-img" || e.target.classList[0] === "single-label") {
  100105. selectLayerOption = e.target.parentNode;
  100106. } else {
  100107. return;
  100108. }
  100109. if (document.getElementsByClassName("component-single-checked-img").length > 0) {
  100110. document.getElementsByClassName("component-single-checked-img")[0].setAttribute("class", "component-single-default-img");
  100111. }
  100112. selectLayerOption.firstChild.setAttribute("class", "component-single-checked-img");
  100113. self.currentSearchLayerName = selectLayerOption.lastChild.innerText;
  100114. self.isSearchLayer = true;
  100115. poiSearchName.removeChild(poiSearchName.firstChild);
  100116. poiSearchName.insertBefore(document.createTextNode(self.currentSearchLayerName), poiSearchName.firstChild);
  100117. self.viewModel.panToLayer(self.currentSearchLayerName);
  100118. self.messageBox.closeView();
  100119. };
  100120. layersContent.appendChild(layerSelectOptions);
  100121. //读取当前图层数据,并展现
  100122. //只有调用添加查询图层接口才能添加图层选项
  100123. return layersSelect;
  100124. }();
  100125. //配置开启 城市匹配功能则添加
  100126. let navTabs = [];
  100127. if (citySelect) {
  100128. navTabs.push({
  100129. title: Lang.i18n("title_searchCity"),
  100130. content: citySelect
  100131. })
  100132. }
  100133. navTabs.push({
  100134. title: Lang.i18n("title_searchLayer"),
  100135. content: layersSelect
  100136. });
  100137. const navTabsPageObject = new NavTabsPage({
  100138. tabs: navTabs
  100139. });
  100140. const navTabsPage = navTabsPageObject.getElement();
  100141. navTabsPageObject.closeView();
  100142. poiContainer.appendChild(navTabsPage);
  100143. poiSettings.onclick = () => {
  100144. if (navTabsPage.hidden) {
  100145. navTabsPageObject.showView();
  100146. } else {
  100147. navTabsPageObject.closeView();
  100148. }
  100149. };
  100150. poiContainer.appendChild(poiSettings);
  100151. //初始时,下拉框若没赋值显示信息,则再次赋值:
  100152. if (!poiSearchName.innerText) {
  100153. poiSearchName.appendChild(document.createTextNode(Lang.i18n("text_label_chooseSearchLayers")));
  100154. }
  100155. //---------下拉框 END
  100156. //---------搜索输入框:
  100157. const poiInputContainer = document.createElement("div");
  100158. poiInputContainer.setAttribute("class", "component-search__input");
  100159. const poiInput = document.createElement("input");
  100160. poiInput.type = "text";
  100161. poiInput.placeholder = Lang.i18n("text_label_searchTips");
  100162. poiInputContainer.appendChild(poiInput);
  100163. //由View 维护,进行交互操作
  100164. this.poiInput = poiInput;
  100165. //清除输入内容按钮:
  100166. const poiInputClose = document.createElement("span");
  100167. poiInputClose.setAttribute("class", "supermapol-icons-close");
  100168. poiInputClose.hidden = true;
  100169. poiInputContainer.appendChild(poiInputClose);
  100170. poiContainer.appendChild(poiInputContainer);
  100171. //---------搜索输入框 END
  100172. //--------搜索按钮:
  100173. const searchBtn = document.createElement("div");
  100174. searchBtn.setAttribute("class", "component-search-icon supermapol-icons-search");
  100175. //查询结果页面
  100176. const resultDomObj = new PaginationContainer();
  100177. this._resultDomObj = resultDomObj;
  100178. //查询要素或匹配要素【搜索按钮点击事件】
  100179. searchBtn.onclick = () => {
  100180. //若是遮挡结果显示,则关闭
  100181. resultDomObj.closeView();
  100182. this.clearSearchResult();
  100183. this.messageBox.closeView();
  100184. navTabsPageObject.closeView();
  100185. const keyWord = this.poiInput.value.trim();
  100186. if (keyWord === "") {
  100187. this.messageBox.showView(Lang.i18n('msg_searchKeywords'));
  100188. return;
  100189. }
  100190. if (this.isSearchLayer) {
  100191. this.viewModel.search(keyWord, this.currentSearchLayerName);
  100192. } else {
  100193. this.viewModel.search(keyWord);
  100194. }
  100195. };
  100196. //【输入框输入内容回车事件】
  100197. poiInput.onkeypress = (e) => {
  100198. //.which属性判断按下的是哪个键,回车键的键位序号为13
  100199. if (e.which == 13) {
  100200. //手动触发 searchBtn 得点击事件,执行查询操作
  100201. var evt = document.createEvent("HTMLEvents");
  100202. evt.initEvent("click", false, true);
  100203. searchBtn.dispatchEvent(evt);
  100204. }
  100205. };
  100206. poiContainer.appendChild(searchBtn);
  100207. //--------搜索按钮 END
  100208. const resultContainer = function createResultPage() {
  100209. const resultContainer = resultDomObj.getElement();
  100210. resultContainer.style.position = "absolute";
  100211. resultContainer.style.top = "44px";
  100212. resultContainer.style.right = "0";
  100213. //先关闭结果界面,当有数据时再打开
  100214. resultDomObj.closeView();
  100215. //【结果列表点击事件】,以支持联动map上对应要素:
  100216. resultDomObj.content.onclick = (e) => {
  100217. let selectFeatureOption = null;
  100218. if (e.target.parentNode.className === "component-search-result-info") {
  100219. selectFeatureOption = e.target.parentNode.parentNode;
  100220. } else if (e.target.parentNode.className === "component-search__resultitme") {
  100221. selectFeatureOption = e.target.parentNode;
  100222. } else if (e.target.className === "component-search__resultitme") {
  100223. selectFeatureOption = e.target;
  100224. } else {
  100225. return;
  100226. }
  100227. //修改
  100228. if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
  100229. document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
  100230. }
  100231. selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
  100232. let filter = selectFeatureOption.children[1].firstChild.innerText;
  100233. //联动地图上要素响应
  100234. self._linkageFeature(filter);
  100235. };
  100236. return resultContainer;
  100237. }();
  100238. poiContainer.appendChild(resultContainer);
  100239. //清除输入框内容【输入框删除按钮点击事件】
  100240. poiInputClose.onclick = (e) => {
  100241. this.clearSearchResult();
  100242. poiInput.value = "";
  100243. e.target.hidden = true;
  100244. resultDomObj.closeView();
  100245. };
  100246. //【输入框输入内容事件】
  100247. poiInput.oninput = () => {
  100248. poiInputClose.hidden = false;
  100249. };
  100250. //添加提示框
  100251. this.messageBox = new MessageBox();
  100252. //绑定 VM 的监听
  100253. this._addViewModelListener();
  100254. div.appendChild(poiContainer);
  100255. //阻止 map 默认事件
  100256. this._preventMapEvent(div, this.map);
  100257. return div;
  100258. },
  100259. /**
  100260. * @function SearchView.prototype._createSearchLayerItem
  100261. * @description 创建查询图层选项。
  100262. * @private
  100263. */
  100264. _createSearchLayerItem(layerName) {
  100265. const layerOption = document.createElement("div");
  100266. layerOption.setAttribute("class", "component-search__layers__itme");
  100267. // 创建圆形单选框
  100268. const singleSelect = document.createElement("div");
  100269. singleSelect.setAttribute("class", "component-search__layers__itme__singleselect");
  100270. const singleIcon = document.createElement("div");
  100271. singleIcon.setAttribute("class", "component-single-default-img");
  100272. singleSelect.appendChild(singleIcon);
  100273. const singleLabel = document.createElement("span");
  100274. singleLabel.setAttribute("class", "single-label");
  100275. singleLabel.innerHTML = layerName;
  100276. singleSelect.appendChild(singleLabel);
  100277. layerOption.appendChild(singleSelect);
  100278. //attributes-select todo 暂不支持该功能
  100279. // const attributesSelect = (new ComponentSelect(layer.layer.attributeNames)).getElement();
  100280. //选择查询的字段 todo 限制图层查找属性功能待属性选择框优化后完善
  100281. /*attributesSelect.onchange = (e) => {
  100282. this.searchAttributes = e.target.value;
  100283. };*/
  100284. // layerOption.appendChild(attributesSelect);
  100285. document.getElementsByClassName("component-search__layers__body")[0].appendChild(layerOption);
  100286. },
  100287. /**
  100288. * @function SearchView.prototype._createResultItem
  100289. * @description 创建查询结果列表。
  100290. * @private
  100291. */
  100292. _createResultItem(featureType, properties) {
  100293. const item = document.createElement("div");
  100294. item.setAttribute("class", "component-search__resultitme");
  100295. let icon = document.createElement("div");
  100296. if (featureType === "Point" || featureType === "MultiPoint") {
  100297. icon.setAttribute("class", "supermapol-icons-marker-layer component-search-result-icon");
  100298. } else if (featureType === "LineString" || featureType === "MultiLineString ") {
  100299. icon.setAttribute("class", "supermapol-icons-line-layer component-search-result-icon");
  100300. } else if (featureType === "Polygon" || featureType === "MultiPolygon") {
  100301. icon.setAttribute("class", "supermapol-icons-polygon-layer component-search-result-icon");
  100302. } else {
  100303. icon.setAttribute("class", "supermapol-icons-point-layer component-search-result-icon");
  100304. }
  100305. item.appendChild(icon);
  100306. const info = document.createElement("div");
  100307. info.setAttribute("class", "component-search-result-info");
  100308. const info1 = document.createElement("div");
  100309. info.appendChild(info1);
  100310. const info2 = document.createElement("div");
  100311. //分地址匹配和图层搜索的两种数据展现形式:
  100312. if (properties.name) {
  100313. info1.innerHTML = properties.name;
  100314. info2.innerHTML = properties.address;
  100315. info.appendChild(info2);
  100316. } else {
  100317. info1.innerHTML = properties.filterAttributeName + ": " + properties.filterAttributeValue;
  100318. }
  100319. item.appendChild(info);
  100320. //暂时删除复选框UI
  100321. const check = document.createElement("div");
  100322. check.setAttribute("class", "component-checkbox component-checkbox-default-img");
  100323. // item.appendChild(check);
  100324. return item;
  100325. },
  100326. /*----------对 VM 的一些事件监听 ----------*/
  100327. /**
  100328. * @function SearchView.prototype._addViewModelListener
  100329. * @description 绑定对 VM 的事件监听。
  100330. * @private
  100331. */
  100332. _addViewModelListener() {
  100333. //----可查询图层变化监听
  100334. this.viewModel.on("searchlayerschanged", (layers) => {
  100335. for (let i = 0; i < layers.length; i++) {
  100336. this._createSearchLayerItem(layers[i]);
  100337. }
  100338. });
  100339. //----可查询图层变化监听
  100340. this.viewModel.on("newlayeradded", (e) => {
  100341. this._createSearchLayerItem(e.layerName);
  100342. });
  100343. //----图层查询结果监听
  100344. this.viewModel.on("searchlayersucceeded", (e) => {
  100345. const data = e.result;
  100346. this.clearSearchResult();
  100347. this.searchResultLayer = external_L_default().featureGroup(data, {
  100348. pointToLayer: this.options.style,
  100349. style: this.options.style
  100350. }).bindPopup(function (layer) {
  100351. if (layer.feature.properties) {
  100352. return (new AttributesPopContainer({
  100353. attributes: layer.feature.properties
  100354. })).getElement();
  100355. }
  100356. }).addTo(this.map);
  100357. this.searchResultLayer.eachLayer((layer) => {
  100358. this.options.onEachFeature ? this.options.onEachFeature(layer.toGeoJSON(), layer) :
  100359. this._featureOnclickEvent.bind(this)(layer.toGeoJSON(), layer);
  100360. });
  100361. this.searchLayersData = data;
  100362. //查询结果列表:
  100363. this._prepareResultData(data);
  100364. /**
  100365. * @event SearchView#searchlayersucceeded
  100366. * @description 图层查询成功后触发。
  100367. * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
  100368. */
  100369. this._event.fire("searchlayersucceeded", {
  100370. result: this.searchResultLayer.toGeoJSON()
  100371. });
  100372. });
  100373. //----地址匹配服务监听
  100374. this.viewModel.on("geocodesucceeded", (e) => {
  100375. const data = e.result;
  100376. //先清空当前有的地址匹配图层
  100377. this.clearSearchResult();
  100378. this.searchResultLayer = external_L_default().geoJSON(data, {
  100379. pointToLayer: this.options.style,
  100380. style: this.options.style,
  100381. onEachFeature: this.options.onEachFeature || this._featureOnclickEvent.bind(this)
  100382. }).bindPopup(function (layer) {
  100383. if (layer.feature.properties) {
  100384. return (new AttributesPopContainer({
  100385. attributes: layer.feature.properties
  100386. })).getElement();
  100387. }
  100388. }).addTo(this.map);
  100389. this.searchLayersData = data
  100390. //查询结果列表:
  100391. this._prepareResultData(data);
  100392. /**
  100393. * @event SearchView#geocodesucceeded
  100394. * @description 地址匹配服务成功后触发。
  100395. * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
  100396. */
  100397. this._event.fire("geocodesucceeded", {
  100398. result: data
  100399. });
  100400. });
  100401. //----地址匹配或图层查询失败监听
  100402. this.viewModel.on("searchfailed", (e) => {
  100403. let message = "";
  100404. if (e.searchType === "searchGeocodeField") {
  100405. message = Lang.i18n("msg_searchGeocodeField");
  100406. } else if (e.searchType === "cityGeocodeField") {
  100407. message = Lang.i18n("msg_cityGeocodeField");
  100408. } else {
  100409. message = Lang.i18n("msg_getFeatureField");
  100410. }
  100411. this.messageBox.showView(message)
  100412. /**
  100413. * @event SearchView#searchfailed
  100414. * @description 图层属性查询失败后触发。
  100415. * @property {string} message - 失败原因。
  100416. */
  100417. this._event.fire("searchfailed", {
  100418. message: message
  100419. });
  100420. });
  100421. },
  100422. /*-------以下是一些辅助性功能函数 -------*/
  100423. /**
  100424. * @function SearchView.prototype._prepareResultData
  100425. * @description 展示数据。
  100426. * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
  100427. * @private
  100428. */
  100429. _prepareResultData(data) {
  100430. this.currentResult = data;
  100431. //向下取舍,这只页码
  100432. let pageCounts = Math.ceil(data.length / this.perPageDataNum);
  100433. this._resultDomObj.setPageLink(pageCounts);
  100434. //初始结果页面内容:
  100435. this._createResultListByPageNum(1, data);
  100436. this._resultDomObj.showView();
  100437. //给页面模板设置联动事件
  100438. this._resultDomObj.setLinkageEvent(_linkageEvent);
  100439. const self = this;
  100440. function _linkageEvent(page) {
  100441. self._createResultListByPageNum(page, self.currentResult);
  100442. }
  100443. },
  100444. /**
  100445. * @function SearchView.prototype._createResultListByPageNum
  100446. * @description 填充内容。
  100447. * @param {number} page - 页数。
  100448. * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
  100449. * @private
  100450. */
  100451. _createResultListByPageNum(page, data) {
  100452. let start = 0,
  100453. end;
  100454. if (page === 1 && data.length < this.perPageDataNum) {
  100455. //data数据不满8个时:
  100456. end = data.length - 1;
  100457. } else if (page * this.perPageDataNum > data.length) {
  100458. //最后一页且数据不满8个时
  100459. start = this.perPageDataNum * (page - 1);
  100460. end = data.length - 1
  100461. } else {
  100462. //中间页面的情况
  100463. start = this.perPageDataNum * (page - 1);
  100464. end = page * this.perPageDataNum - 1
  100465. }
  100466. const content = document.createElement("div");
  100467. for (let i = start; i <= end; i++) {
  100468. let properties, featureType = "Point";
  100469. if (data[i].filterAttribute) {
  100470. featureType = data[i].feature.geometry.type;
  100471. properties = data[i].filterAttribute;
  100472. } else {
  100473. properties = data[i].properties;
  100474. }
  100475. content.appendChild(this._createResultItem(featureType, properties))
  100476. }
  100477. this._resultDomObj.setContent(content);
  100478. this._resultDomObj.showView();
  100479. //查询完成默认选中第一个结果:
  100480. content.firstChild.getElementsByClassName("component-search-result-icon")[0].classList.add("component-search__resultitme-selected");
  100481. const filter = content.firstChild.getElementsByClassName("component-search-result-info")[0].firstChild.innerText;
  100482. !this._selectMarkerFeature && this._linkageFeature(filter);
  100483. },
  100484. /**
  100485. * @function SearchView.prototype._flyToBounds
  100486. * @param {L.Bounds} bounds - 当前图层范围。
  100487. * @description 移动到该范围。
  100488. * @private
  100489. */
  100490. _flyToBounds(bounds) {
  100491. const sw = bounds.getSouthWest();
  100492. const ne = bounds.getNorthEast();
  100493. if (sw.lat === ne.lat && sw.lng === ne.lng) {
  100494. this.map.flyTo(sw);
  100495. } else {
  100496. // this.map.fitBounds(this.searchResultLayer.getBounds());
  100497. this.map.fitBounds(bounds);
  100498. }
  100499. },
  100500. /**
  100501. * @function SearchView.prototype._linkageFeature
  100502. * @description 点击结果列表联动地图上要素响应。
  100503. * @private
  100504. */
  100505. _linkageFeature(filter) {
  100506. let filterValue = "";
  100507. if (this.isSearchLayer) {
  100508. filterValue = filter.split(":")[1].trim();
  100509. } else {
  100510. filterValue = filter;
  100511. }
  100512. this._selectFeature && this._selectFeature.addTo(this.map);
  100513. this.searchResultLayer.eachLayer((layer) => {
  100514. // this._resetLayerStyleToDefault(layer);
  100515. if (!filterValue || layer.filterAttribute && layer.filterAttribute.filterAttributeValue === filterValue ||
  100516. layer.feature.properties && layer.feature.properties.name === filterValue) {
  100517. layer.remove();
  100518. this._setSelectedLayerStyle(layer);
  100519. /*layer.bindPopup(function () {
  100520. return (new AttributesPopContainer(layer.feature.properties)).getElement()
  100521. }, {closeOnClick: false}).openPopup().addTo(this.map);*/
  100522. //若这个图层只有一个点的话,则直接 flyTo 到点:
  100523. }
  100524. });
  100525. },
  100526. /**
  100527. * @function SearchView.prototype.clearSearchResult
  100528. * @description 清空查询结果。
  100529. */
  100530. clearSearchResult() {
  100531. if (this.searchResultLayer) {
  100532. this.map.closePopup();
  100533. //若当前是查询图层的结果,则不删除图层,只修改样式
  100534. !this.isSearchLayer && this.map.removeLayer(this.searchResultLayer);
  100535. this._selectMarkerFeature && this.map.removeLayer(this._selectMarkerFeature);
  100536. this._selectFeaturethis && this.map.removeLayer(this._selectFeature);
  100537. this._selectMarkerFeature = null;
  100538. this._selectFeature = null;
  100539. this.searchResultLayer = null;
  100540. this.currentResult = null;
  100541. }
  100542. },
  100543. /**
  100544. * @function SearchView.prototype._featureOnclickEvent
  100545. * @description 要素点击事件
  100546. * @param {L.layer} layer - Leaflet Layer 对象。
  100547. * @private
  100548. */
  100549. _featureOnclickEvent(feature, layer) {
  100550. layer.on('click', () => {
  100551. let pageEles1 = document.getElementsByClassName('component-pagination__link')[0];
  100552. this._resultDomObj._changePageEvent({
  100553. target: pageEles1.children[0].children[0]
  100554. });
  100555. this._selectFeature && this._selectFeature.addTo(this.map);
  100556. layer.remove();
  100557. let page, dataIndex;
  100558. for (let i = 0; i < this.searchLayersData.length; i++) {
  100559. let item = this.searchLayersData[i]
  100560. if ((item.properties && (item.properties.name === feature.properties.name)) || (item.filterAttribute && (item.filterAttribute.filterAttributeName + ": " + item.filterAttribute.filterAttributeValue) === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue))) {
  100561. dataIndex = i % this.perPageDataNum;
  100562. page = parseInt(i / this.perPageDataNum) + 1;
  100563. break;
  100564. }
  100565. }
  100566. if (page > 1) {
  100567. for (let i = 1; i < page; i++) {
  100568. let pageEles;
  100569. pageEles = document.getElementsByClassName('component-pagination__link')[0];
  100570. this._resultDomObj._changePageEvent({
  100571. target: pageEles.children[pageEles.children.length - 2].children[0]
  100572. });
  100573. }
  100574. }
  100575. let pageList = document.getElementsByClassName('component-search-result-info')
  100576. let target = pageList[dataIndex].children[0];
  100577. if (target.innerHTML === feature.properties.name || target.innerHTML === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue)) {
  100578. let selectFeatureOption = pageList[dataIndex].parentNode;
  100579. //修改
  100580. if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
  100581. document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
  100582. }
  100583. selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
  100584. this._setSelectedLayerStyle(layer);
  100585. }
  100586. }, this)
  100587. },
  100588. /**
  100589. * @function SearchView.prototype._setSelectedLayerStyle
  100590. * @description 设置图层选中样式。
  100591. * @param {L.layer} layer - Leaflet Layer 对象。
  100592. * @private
  100593. */
  100594. _setSelectedLayerStyle(layer) {
  100595. this._selectMarkerFeature && this._selectMarkerFeature.remove();
  100596. this._selectMarkerFeature = null;
  100597. this._selectFeature = layer;
  100598. //circleMarker 需要变成 marker 的样式:
  100599. this._selectMarkerFeature = external_L_default().geoJSON(layer.toGeoJSON(), {
  100600. //点选中样式, todo marker 显示位置需要调整
  100601. pointToLayer: (geoJsonPoint, latlng) => {
  100602. return external_L_default().marker(latlng, {
  100603. icon: external_L_default().divIcon({
  100604. className: 'component-select-marker-icon',
  100605. iconAnchor: [15, 0]
  100606. })
  100607. })
  100608. },
  100609. //线和面选中样式:
  100610. style: {
  100611. fillColor: 'red',
  100612. weight: 1,
  100613. opacity: 1,
  100614. color: 'red',
  100615. fillOpacity: 0.2
  100616. }
  100617. }).addTo(this.map);
  100618. this._selectMarkerFeature.bindPopup(function () {
  100619. return (new AttributesPopContainer({
  100620. attributes: layer.feature.properties
  100621. })).getElement()
  100622. }, {
  100623. closeOnClick: false
  100624. }).openPopup().addTo(this.map);
  100625. this._flyToBounds(this.searchResultLayer.getBounds());
  100626. let center;
  100627. if (layer.getLatLng) {
  100628. center = layer.getLatLng();
  100629. } else if (layer.getCenter) {
  100630. center = layer.getCenter();
  100631. }
  100632. this.map.setView(center);
  100633. }
  100634. });
  100635. var searchView = function (options) {
  100636. return new SearchView(options);
  100637. };
  100638. ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowViewModel.js
  100639. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  100640. * This program are made available under the terms of the Apache License, Version 2.0
  100641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  100642. /**
  100643. * @class DataFlowViewModel
  100644. * @aliasclass Components.DataFlowViewModel
  100645. * @deprecatedclassinstance L.supermap.components.dataFlowViewModel
  100646. * @classdesc 数据流组件功能类。
  100647. * @version 9.1.1
  100648. * @category Components DataFlow
  100649. * @param {L.Map} map - Leaflet Map 对象。
  100650. * @param {Object} [dataFlowLayerOptions] - 数据流服务返回数据数据展示样式,默认采用 ViewModel 默认样式。
  100651. * @param {Object} options - 参数。
  100652. * @param {function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
  100653. `function (feature) {
  100654. return {
  100655. fillColor: "red",
  100656. fillOpacity: 1,
  100657. radius: 6,
  100658. weight: 0
  100659. };
  100660. }`
  100661. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗,默认对新创建的图层不执行任何操作。
  100662. * @fires DataFlowViewModel#dataflowservicesubscribed
  100663. * @fires DataFlowViewModel#subscribesucceeded
  100664. * @fires DataFlowViewModel#subscribefailed
  100665. * @fires DataFlowViewModel#dataupdated
  100666. * @extends {L.Evented}
  100667. * @usage
  100668. */
  100669. var DataFlowViewModel = external_L_default().Evented.extend({
  100670. options: {
  100671. _defaultLayerOptions: {
  100672. //style 返回 marker样式或者 L.path 样式
  100673. style: null,
  100674. onEachFeature: function (feature, layer) {
  100675. let content = "属性信息如下:<br>";
  100676. for (let key in feature.properties) {
  100677. content += key + ": " + feature.properties[key] + "<br>"
  100678. }
  100679. layer.bindPopup(content);
  100680. }
  100681. }
  100682. },
  100683. initialize(map, dataFlowLayerOptions = null) {
  100684. if (map) {
  100685. /**
  100686. * @member {L.Map} DataFlowViewModel.prototype.map
  100687. * @description Leaflet Map 对象。
  100688. */
  100689. this.map = map;
  100690. } else {
  100691. return new Error(`Cannot find map, fileModel.map cannot be null.`);
  100692. }
  100693. //合并用户的 dataFlowLayerOptions
  100694. external_L_default().Util.extend(this.options._defaultLayerOptions, dataFlowLayerOptions);
  100695. //点样式也存储在style里
  100696. this.options._defaultLayerOptions.pointToLayer = this.options._defaultLayerOptions.style;
  100697. /**
  100698. * @member {boolean} [DataFlowViewModel.prototype.popupsStatus=true]
  100699. * @description 图层 popup 打开 "true" 或关闭 "false" 的状态。
  100700. */
  100701. this.popupsStatus = true;
  100702. /**
  100703. * @member {boolean} [DataFlowViewModel.prototype.dataFlowStatus=false]
  100704. * @description 数据流服务当前状态,订阅 "true" 或未订阅 "false" 的状态。
  100705. */
  100706. this.dataFlowStatus = false;
  100707. /**
  100708. * @member {string} [DataFlowViewModel.prototype.dataFlowUrl=""]
  100709. * @description 数据流地址。
  100710. */
  100711. this.dataFlowUrl = "";
  100712. /**
  100713. * @member {Array.<Object>} [DataFlowViewModel.prototype.currentFeatures]
  100714. * @description 当前订阅数据流返回的要素数组。
  100715. */
  100716. this.currentFeatures = [];
  100717. /**
  100718. * @member {DataFlowLayer} [DataFlowViewModel.prototype.dataFlowLayer=null]
  100719. * @description 当前 dataFlowLayer 图层对象。
  100720. */
  100721. this.dataFlowLayer = null;
  100722. },
  100723. /**
  100724. * @function DataFlowViewModel.prototype.subscribe
  100725. * @description 订阅数据流。
  100726. * @param {string} dataFlowUrl - 数据流服务地址。
  100727. */
  100728. subscribe(dataFlowUrl) {
  100729. //若当前数据流服务没变,则不进行重新订阅 todo 或者没点击暂停
  100730. if (this.dataFlowUrl === dataFlowUrl) {
  100731. if (this.dataFlowStatus) {
  100732. /**
  100733. * @event DataFlowViewModel#dataflowservicesubscribed
  100734. * @description 数据流订阅成功后触发。
  100735. */
  100736. this.fire("dataflowservicesubscribed");
  100737. return;
  100738. }
  100739. } else {
  100740. this.dataFlowUrl = dataFlowUrl
  100741. }
  100742. this.dataFlowStatus = true;
  100743. //移除已有图层
  100744. if (this.dataFlowLayer) {
  100745. this.dataFlowLayer.remove();
  100746. this.dataFlowLayer = null;
  100747. }
  100748. //创建DataFlowLayer,创建DataFlowLayer订阅iServer dataflow服务并将结果加载到地图上
  100749. const dataFlowLayer = new DataFlowLayer(dataFlowUrl, this.options._defaultLayerOptions);
  100750. dataFlowLayer.on('subscribesucceeded', (result) => {
  100751. /**
  100752. * @event DataFlowViewModel#subscribesucceeded
  100753. * @description 数据流订阅成功后触发。
  100754. * @property {Object} result - 返回的数据。
  100755. */
  100756. this.fire("subscribesucceeded", {result: result});
  100757. });
  100758. dataFlowLayer.on('subscribefailed', (result) => {
  100759. /**
  100760. * @event DataFlowViewModel#subscribefailed
  100761. * @description 数据流订阅失败后触发。
  100762. * @property {Object} result - 返回的数据。
  100763. */
  100764. this.fire("subscribefailed", {result: result});
  100765. });
  100766. dataFlowLayer.on('dataupdated', (result) => {
  100767. //派发出订阅返回的数据:
  100768. /**
  100769. * @event DataFlowViewModel#dataupdated
  100770. * @description 数据返回成功后触发。
  100771. * @property {Object} result - 返回的数据。
  100772. */
  100773. this.fire("dataupdated", {result: result});
  100774. //若数据超出当前视图范围,则移动到数据所在视图范围:
  100775. let layerBounds = result.layer.getBounds(),
  100776. mapBounds = CommontypesConversion.toSuperMapBounds(this.map.getBounds()),
  100777. layerBoundsSuperMap = CommontypesConversion.toSuperMapBounds(layerBounds);
  100778. if (!mapBounds.intersectsBounds(layerBoundsSuperMap)) {
  100779. if (layerBoundsSuperMap.left === layerBoundsSuperMap.right && layerBoundsSuperMap.top === layerBoundsSuperMap.bottom) {
  100780. this.map.setView(layerBounds.getCenter())
  100781. } else {
  100782. this.map.flyToBounds(layerBounds);
  100783. }
  100784. }
  100785. if (this.popupsStatus) {
  100786. this.openPopups();
  100787. }
  100788. });
  100789. dataFlowLayer.addTo(this.map);
  100790. this.dataFlowLayer = dataFlowLayer;
  100791. },
  100792. /**
  100793. * @function DataFlowViewModel.prototype.cancelSubscribe
  100794. * @description 取消订阅的数据流。
  100795. */
  100796. cancelSubscribe() {
  100797. if (this.dataFlowLayer) {
  100798. this.dataFlowStatus = false;
  100799. this.dataFlowLayer.dataService.unSubscribe();
  100800. this.dataFlowLayer.remove();
  100801. this.dataFlowLayer = null;
  100802. }
  100803. },
  100804. /**
  100805. * @function DataFlowViewModel.prototype.openPopups
  100806. * @description 打开图层要素弹窗。
  100807. */
  100808. openPopups() {
  100809. this.popupsStatus = true;
  100810. if (this.dataFlowLayer) {
  100811. const layers = this.dataFlowLayer.getLayers();
  100812. for (let i = 0; i < layers.length; i++) {
  100813. for (let j = 0; j < layers[i].getLayers().length; j++) {
  100814. layers[i].getLayers()[j].openPopup();
  100815. }
  100816. }
  100817. }
  100818. },
  100819. /**
  100820. * @function DataFlowViewModel.prototype.closePopups
  100821. * @description 关闭图层要素弹窗。
  100822. */
  100823. closePopups() {
  100824. this.popupsStatus = false;
  100825. if (this.dataFlowLayer) {
  100826. const layers = this.dataFlowLayer.getLayers();
  100827. for (let i = 0; i < layers.length; i++) {
  100828. for (let j = 0; j < layers[i].getLayers().length; j++) {
  100829. layers[i].getLayers()[j].closePopup();
  100830. }
  100831. }
  100832. }
  100833. }
  100834. });
  100835. var dataFlowViewModel = function (options) {
  100836. return new DataFlowViewModel(options);
  100837. };
  100838. ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowView.js
  100839. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  100840. * This program are made available under the terms of the Apache License, Version 2.0
  100841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  100842. /**
  100843. * @class DataFlowView
  100844. * @aliasclass Components.DataFlowView
  100845. * @deprecatedclassinstance L.supermap.components.dataFlow
  100846. * @classdesc 数据流组件类。
  100847. * @version 9.1.1
  100848. * @category Components DataFlow
  100849. * @modulecategory Components
  100850. * @param {Object} options - 参数。
  100851. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  100852. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。<br>
  100853. `function (feature) {
  100854. return {
  100855. fillColor: "red",
  100856. fillOpacity: 1,
  100857. radius: 6,
  100858. weight: 0
  100859. };
  100860. }`
  100861. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  100862. * @fires DataFlowView#dataupdated
  100863. * @extends {ComponentsViewBase}
  100864. * @usage
  100865. */
  100866. var DataFlowView = ComponentsViewBase.extend({
  100867. initialize(options) {
  100868. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  100869. },
  100870. /**
  100871. * @function DataFlowView.prototype.onAdd
  100872. * @description 给地图添加组件。
  100873. * @override
  100874. * @private
  100875. */
  100876. onAdd(map) {
  100877. //为了避免空对象为复写默认配置的现象,先判断参数是否为空
  100878. let options = {};
  100879. if (this.options.style) {
  100880. options.style = this.options.style;
  100881. }
  100882. if (this.options.onEachFeature) {
  100883. options.style = this.options.onEachFeature;
  100884. }
  100885. this.viewModel = new DataFlowViewModel(map, options);
  100886. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  100887. },
  100888. /**
  100889. * @function DataFlowView.prototype._initView
  100890. * @description 创建数据组件,用于打开本地文件。
  100891. * @returns {HTMLElement}
  100892. * @private
  100893. * @override
  100894. */
  100895. _initView() {
  100896. const containerObj = new CommonContainer({title: Lang.i18n("title_dataFlowService")});
  100897. const container = containerObj.getElement();
  100898. const componentContent = containerObj.getContentElement();
  100899. componentContent.style.padding = "10px 18px";
  100900. const dataFlowContainer1 = document.createElement("div");
  100901. dataFlowContainer1.setAttribute("class", "component-dataflow__container");
  100902. //输入框
  100903. const dataFlowInputContainer = document.createElement("div");
  100904. dataFlowInputContainer.setAttribute("class", "component-input-default");
  100905. const dataFlowInput = document.createElement("input");
  100906. dataFlowInput.setAttribute("class", "component-input-default");
  100907. dataFlowInput.type = "text";
  100908. dataFlowInput.placeholder = Lang.i18n('text_input_value_inputDataFlowUrl');
  100909. dataFlowInput.title = Lang.i18n('text_input_value_inputDataFlowUrl');
  100910. dataFlowInputContainer.appendChild(dataFlowInput);
  100911. //删除输入值按钮:
  100912. const inputClearBtn = document.createElement("span");
  100913. inputClearBtn.setAttribute("class", "supermapol-icons-close");
  100914. inputClearBtn.hidden = true;
  100915. //---清除输入值【清除按钮点击事件】
  100916. inputClearBtn.onclick = (e) => {
  100917. dataFlowInput.value = "";
  100918. e.target.hidden = true;
  100919. };
  100920. //---输入框值改变,打开清除按钮【输入框内容改变事件】
  100921. dataFlowInput.oninput = () => {
  100922. inputClearBtn.hidden = false;
  100923. };
  100924. dataFlowInputContainer.appendChild(inputClearBtn);
  100925. dataFlowContainer1.appendChild(dataFlowInputContainer);
  100926. componentContent.appendChild(dataFlowContainer1);
  100927. //复选框条件
  100928. const dataFlowContainer2 = document.createElement("div");
  100929. dataFlowContainer2.setAttribute("class", "component-dataflow__container");
  100930. const checkboxContainer = document.createElement("div");
  100931. checkboxContainer.setAttribute("class", "component-checkbox-container");
  100932. const attributesCheckbox = document.createElement("div");
  100933. attributesCheckbox.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
  100934. attributesCheckbox.checked = true;
  100935. checkboxContainer.appendChild(attributesCheckbox);
  100936. const checkboxLabel = document.createElement("div");
  100937. checkboxLabel.setAttribute("class", "component-label component-label-selected");
  100938. checkboxLabel.innerHTML = Lang.i18n('text_displayFeaturesInfo');
  100939. checkboxContainer.appendChild(checkboxLabel);
  100940. //----是否显示属性框【属性框复选框点击事件】
  100941. attributesCheckbox.onclick = (e) => {
  100942. e.target.checked = !e.target.checked;
  100943. if (e.target.checked) {
  100944. checkboxLabel.setAttribute("class", "component-label component-label-selected");
  100945. e.target.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
  100946. this.viewModel.openPopups();
  100947. } else {
  100948. checkboxLabel.setAttribute("class", "component-label");
  100949. e.target.setAttribute("class", "component-checkbox-default component-checkbox-default-img");
  100950. this.viewModel.closePopups();
  100951. }
  100952. };
  100953. dataFlowContainer2.appendChild(checkboxContainer);
  100954. componentContent.appendChild(dataFlowContainer2);
  100955. //订阅按钮,取消按钮:
  100956. const dataFlowContainer3 = document.createElement("div");
  100957. dataFlowContainer3.setAttribute("class", "component-dataflow__container component-init-center");
  100958. const subscribe = document.createElement("button");
  100959. subscribe.setAttribute("class", "component-button-default");
  100960. subscribe.innerHTML = Lang.i18n('text_subscribe');
  100961. //----订阅服务【订阅按钮点击事件】
  100962. subscribe.onclick = () => {
  100963. const urlDataFlow = dataFlowInput.value;
  100964. if (urlDataFlow === "") {
  100965. this.messageBox.showView(Lang.i18n('msg_inputDataFlowUrlFirst'));
  100966. return;
  100967. }
  100968. this.viewModel.subscribe(urlDataFlow);
  100969. };
  100970. dataFlowContainer3.appendChild(subscribe);
  100971. const cancelSubscribe = document.createElement("button");
  100972. cancelSubscribe.setAttribute("class", "component-button-default");
  100973. cancelSubscribe.innerHTML = Lang.i18n('text_cancelSubscribe');
  100974. //----取消订阅服务【取消订阅按钮点击事件】
  100975. cancelSubscribe.onclick = () => {
  100976. this.viewModel.cancelSubscribe();
  100977. };
  100978. dataFlowContainer3.appendChild(cancelSubscribe);
  100979. componentContent.appendChild(dataFlowContainer3);
  100980. //增加提示框:
  100981. this.messageBox = new MessageBox();
  100982. this.viewModel.on("dataflowservicesubscribed", () => {
  100983. this.messageBox.showView(Lang.i18n("msg_dataflowservicesubscribed"));
  100984. });
  100985. this.viewModel.on("subscribesucceeded", () => {
  100986. this.messageBox.showView(Lang.i18n("msg_subscribesucceeded"));
  100987. });
  100988. /**
  100989. * @event DataFlowView#dataupdated
  100990. * @description 数据流服务成功返回数据后触发。
  100991. * @property {Object} result - 事件返回的数据对象。
  100992. */
  100993. this.viewModel.on("dataupdated", (result) => {
  100994. this.messageBox.closeView();
  100995. this._event.fire("dataupdated", result);
  100996. });
  100997. //关闭在控件上触发地图的事件响应:
  100998. //阻止 map 默认事件
  100999. this._preventMapEvent(container, this.map);
  101000. return container;
  101001. }
  101002. });
  101003. var dataFlowView = function (options) {
  101004. return new DataFlowView(options);
  101005. };
  101006. ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJSONLayerWithName.js
  101007. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101008. * This program are made available under the terms of the Apache License, Version 2.0
  101009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101010. /**
  101011. * @class GeoJSONLayerWithName
  101012. * @aliasclass Components.GeoJSONLayerWithName
  101013. * @deprecatedclassinstance L.supermap.components.geoJSONLayerWithName
  101014. * @classdesc 含有 layerName 与 GeoJSON 图层的对象。
  101015. * @param {Object} layerObject - 图层对象。
  101016. * @param {string} layerName - 图层名称。
  101017. * @param {L.GeoJSON} layer - 图层。
  101018. * @category Components Common
  101019. * @usage
  101020. */
  101021. class GeoJSONLayerWithName {
  101022. constructor(layerName, layer) {
  101023. this.layerName = layerName;
  101024. this.layer = layer;
  101025. }
  101026. }
  101027. var geoJSONLayerWithName = function (layerName, layer) {
  101028. return new GeoJSONLayerWithName(layerName, layer);
  101029. };
  101030. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationViewModel.js
  101031. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101032. * This program are made available under the terms of the Apache License, Version 2.0
  101033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101034. /**
  101035. * @class ClientComputationViewModel
  101036. * @aliasclass Components.ClientComputationViewModel
  101037. * @deprecatedclassinstance L.supermap.components.clientComputationViewModel
  101038. * @classdesc 客户端计算组件功能类。
  101039. * @version 9.1.1
  101040. * @category Components ClientComputation
  101041. * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
  101042. * @fires ClientComputationViewModel#analysisfailed
  101043. * @fires ClientComputationViewModel#analysissucceeded
  101044. * @fires ClientComputationViewModel#layerloaded
  101045. * @fires ClientComputationViewModel#layersremoved
  101046. * @extends {L.Evented}
  101047. * @usage
  101048. */
  101049. class ClientComputationViewModel extends (external_L_default()).Evented {
  101050. initialize(workerUrl) {
  101051. this.workerUrl = workerUrl;
  101052. this.turfLayers = [];
  101053. }
  101054. /**
  101055. * @function ClientComputationViewModel.prototype.getLayersData
  101056. * @description 获取填充到 view 的数据。
  101057. * @param {Array.<L.GeoJSON>} layersArr - 图层数组。
  101058. * @returns {Object} layers 数据。
  101059. */
  101060. getLayersData(layersArr) {
  101061. let result = {};
  101062. let pointData = {}, lineData = {}, polygonData = {};
  101063. for (let i = 0; i < layersArr; i++) {
  101064. layersArr[i] = new GeoJSONLayerWithName(layersArr[i].layerName, layersArr[i].layer)
  101065. }
  101066. this.geoJsonLayersDataModel = new GeoJsonLayersDataModel(layersArr);
  101067. // 把 layersArr 转成 key = layername 对象,方便获取 fields 时遍历
  101068. let dataObj = [];
  101069. for (let i = 0; i < layersArr.length; i++) {
  101070. dataObj[layersArr[i].layerName] = {
  101071. fields: layersArr[i].fields,
  101072. layer: layersArr[i].layer.toGeoJSON()
  101073. }
  101074. }
  101075. for (let key in this.geoJsonLayersDataModel.layers) {
  101076. let fields;
  101077. if (dataObj[key].fields) {
  101078. fields = dataObj[key].fields;
  101079. } else {
  101080. fields = this.geoJsonLayersDataModel.layers[key].getAttributeNamesByType("Num");
  101081. }
  101082. let fieldsValue = [];
  101083. for (let i = 0; i < fields.length; i++) {
  101084. fieldsValue[fields[i]] = this.geoJsonLayersDataModel.layers[key].getAttributeValueByAttributeName(fields[i]);
  101085. // 去空 & 去重 & 转 number
  101086. let arr = fieldsValue[fields[i]];
  101087. for (var j = 0; j < arr.length; j++) {
  101088. if (arr[j] == "" || typeof (arr[j]) == "undefined") {
  101089. arr.splice(j, 1);
  101090. j = j - 1;
  101091. }
  101092. arr[j] = parseFloat(arr[j])
  101093. }
  101094. fieldsValue[fields[i]] = Array.from(new Set(arr.sort(function (a, b) {
  101095. return a - b;
  101096. })));
  101097. }
  101098. let obj = {
  101099. layerName: key,
  101100. fields: fields,
  101101. fieldsValue: fieldsValue,
  101102. features: dataObj[key].layer
  101103. }
  101104. let layersType = dataObj[key].layer.features[0].geometry.type;
  101105. if (layersType === "Point") {
  101106. pointData[key] = obj;
  101107. } else if (layersType === "LineString") {
  101108. lineData[key] = obj;
  101109. } else if (layersType === "Polygon") {
  101110. polygonData[key] = obj;
  101111. }
  101112. }
  101113. result['point'] = pointData;
  101114. result['lineString'] = lineData;
  101115. result['polygon'] = polygonData;
  101116. return result;
  101117. }
  101118. /**
  101119. * @function ClientComputationViewModel.prototype.analysis
  101120. * @description 客户端计算。
  101121. * @param {Object} params - 客户端计算参数。
  101122. * @param {L.Map} map - Leaflet Map 对象。
  101123. */
  101124. analysis(params, map) {
  101125. this.geoJsonLayersDataModel.setCurrentLayerDataModel(params.analysisLayers);
  101126. this.worker = new Worker(this.workerUrl);
  101127. let resultData = this.geoJsonLayersDataModel.currentLayerDataModel.layer.toGeoJSON();
  101128. if (params.analysisMethod === "isolines") {
  101129. let fieldsValue = params.analysisFieldsValue.split(",");
  101130. let pointGrid = resultData;
  101131. for (let j = 0; j < fieldsValue.length; j++) {
  101132. fieldsValue[j] = parseFloat(fieldsValue[j])
  101133. }
  101134. let me = this;
  101135. let analysisParams = {
  101136. "pointGrid": pointGrid,
  101137. "analysisMethod": params.analysisMethod,
  101138. "breaks": fieldsValue,
  101139. "zProperty": params.analysisFields,
  101140. "analysisCellSize": params.analysisCellSize,
  101141. "options": {gridType: "point", property: params.analysisFields, weight: Number(params.analysisBreaks)}
  101142. };
  101143. this.worker.postMessage(analysisParams);
  101144. this.worker.onmessage = (e) => {
  101145. if (e.data.features.length === 0) {
  101146. /**
  101147. * @event ClientComputationViewModel#analysisfailed
  101148. * @description 事件分析失败后触发,返回结果为空。
  101149. */
  101150. me.fire('analysisfailed');
  101151. } else {
  101152. /**
  101153. * @event ClientComputationViewModel#analysissucceeded
  101154. * @description 事件分析成功后触发。
  101155. * @property {Object} data - 分析成功后的数据。
  101156. */
  101157. me.fire('analysissucceeded', {'data': e.data});
  101158. let turfLayer = external_L_default().geoJSON(e.data, {
  101159. style: {
  101160. color: '#1060C2', weight: 3
  101161. },
  101162. onEachFeature: function (feature, layer) {
  101163. if (feature.properties) {
  101164. layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
  101165. }
  101166. layer.on({
  101167. 'mouseover': function () {
  101168. layer.setStyle({color: "#ffffff", weight: 5})
  101169. },
  101170. 'mouseout': function () {
  101171. layer.setStyle({color: '#1060C2', weight: 3})
  101172. },
  101173. "click": function () {
  101174. layer.setStyle({color: "#ffffff", weight: 5})
  101175. }
  101176. });
  101177. }
  101178. }).addTo(map);
  101179. me.turfLayers.push(turfLayer);
  101180. /**
  101181. * @event ClientComputationViewModel#layerloaded
  101182. * @description 结果图层加载完成后触发。
  101183. * @property {L.GeoJSON} layer - 加载完成后的结果图层。
  101184. * @property {string} name - 加载完成后的结果图层名称。
  101185. */
  101186. me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
  101187. me.worker.terminate();
  101188. }
  101189. };
  101190. } else if (params.analysisMethod === "buffer") {
  101191. let me = this;
  101192. let analysisParams = {
  101193. "analysisMethod": "buffer",
  101194. "radius": params.radius,
  101195. "unit": params.unit,
  101196. "isSave": params.isSaveStatus,
  101197. "isUnion": params.isUnion,
  101198. 'geoJson': resultData
  101199. };
  101200. this.worker.postMessage(analysisParams);
  101201. this.worker.onmessage = (e) => {
  101202. let turfLayer = external_L_default().geoJSON(e.data, {
  101203. style: {
  101204. color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5
  101205. },
  101206. onEachFeature: function (feature, layer) {
  101207. if (feature.properties) {
  101208. layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
  101209. }
  101210. layer.on({
  101211. 'mouseover': function () {
  101212. layer.setStyle({
  101213. color: "#ffffff",
  101214. fillColor: "rgb(46,40,79)",
  101215. fillOpacity: .5,
  101216. weight: 5
  101217. })
  101218. },
  101219. 'mouseout': function () {
  101220. layer.setStyle({color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5})
  101221. },
  101222. "click": function () {
  101223. layer.setStyle({
  101224. color: "#ffffff",
  101225. fillColor: "rgb(46,40,79)",
  101226. fillOpacity: .5,
  101227. weight: 2
  101228. })
  101229. }
  101230. });
  101231. }
  101232. }).addTo(map);
  101233. me.turfLayers.push(turfLayer);
  101234. me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
  101235. me.worker.terminate();
  101236. };
  101237. }
  101238. }
  101239. /**
  101240. * @function ClientComputationViewModel.prototype.clearLayers
  101241. * @description 清空分析图层。
  101242. */
  101243. clearLayers() {
  101244. for (let i in this.turfLayers) {
  101245. this.turfLayers[i].clearLayers()
  101246. }
  101247. /**
  101248. * @event ClientComputationViewModel#layersremoved
  101249. * @description 图层删除之后触发。
  101250. * @property {Array.<L.GeoJSON>} layer - 需要删除的图层数组。
  101251. */
  101252. this.fire('layersremoved', {layers: this.turfLayers});
  101253. }
  101254. /**
  101255. * @function ClientComputationViewModel.prototype.cancelAnalysis
  101256. * @description 取消分析。
  101257. */
  101258. cancelAnalysis() {
  101259. this.worker.terminate();
  101260. }
  101261. }
  101262. var clientComputationViewModel = function (options) {
  101263. return new ClientComputationViewModel(options);
  101264. };
  101265. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationView.js
  101266. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101267. * This program are made available under the terms of the Apache License, Version 2.0
  101268. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101269. /**
  101270. * @class ClientComputationView
  101271. * @aliasclass Components.ClientComputationView
  101272. * @deprecatedclassinstance L.supermap.components.clientComputation
  101273. * @classdesc 叠加图层的客户端计算类。
  101274. * @version 9.1.1
  101275. * @modulecategory Components
  101276. * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
  101277. * @param {Object} options - 参数。
  101278. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  101279. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
  101280. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  101281. * @fires ClientComputationView#analysissucceeded
  101282. * @fires ClientComputationView#analysisfailed
  101283. * @fires ClientComputationView#layersremoved
  101284. * @category Components ClientComputation
  101285. * @extends {ComponentsViewBase}
  101286. * @usage
  101287. */
  101288. var ClientComputationView = ComponentsViewBase.extend({
  101289. initialize: function (workerUrl, options) {
  101290. if (!workerUrl) {
  101291. throw new Error('workerUrl is required');
  101292. }
  101293. this.workerUrl = workerUrl;
  101294. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  101295. },
  101296. /**
  101297. * @function ClientComputationView.prototype.onAdd
  101298. * @description 添加控件。
  101299. * @private
  101300. * @override
  101301. */
  101302. onAdd: function (map) {
  101303. this.map = map;
  101304. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  101305. },
  101306. /**
  101307. * @function ClientComputationView.prototype.addLayer
  101308. * @description 添加叠加图层。
  101309. */
  101310. addLayer: function (layer) {
  101311. this.layers = this.layers || [];
  101312. this.layers.push(layer);
  101313. let fillData = this.viewModel.getLayersData(this.layers);
  101314. this.fillDataToView(fillData);
  101315. },
  101316. /**
  101317. * @function ClientComputationView.prototype.fillDataToView
  101318. * @private
  101319. * @description 填充数据到 view。
  101320. * @param {Object} fillData - 待填充的数据。
  101321. */
  101322. fillDataToView: function (fillData) {
  101323. if (!fillData) {
  101324. return;
  101325. }
  101326. this.fillData = fillData;
  101327. let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
  101328. let currentFillData = {};
  101329. switch (analysisMethod) {
  101330. case 'isolines':
  101331. currentFillData = fillData['point'];
  101332. break;
  101333. case 'buffer':
  101334. currentFillData = fillData['point'];
  101335. break;
  101336. }
  101337. if (JSON.stringify(currentFillData) == '{}') {
  101338. return;
  101339. }
  101340. // 填充分析图层下拉框
  101341. let layserArr = [];
  101342. for (let layerName in currentFillData) {
  101343. layserArr.push(layerName);
  101344. }
  101345. let layersSelect = document.getElementById('layersSelect');
  101346. let layerSelectName = document.getElementById('layerSelectName');
  101347. // 清空 layersSelect;
  101348. layersSelect.innerHTML = '';
  101349. layerSelectName.title = layserArr[0];
  101350. layerSelectName.innerHTML = layserArr[0];
  101351. this._createOptions(layersSelect, layserArr);
  101352. // 设置 layer select option 点击事件
  101353. this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
  101354. // 当前选中图层数据
  101355. let currentData = currentFillData[layerSelectName.title];
  101356. let fieldsArr = currentData.fields;
  101357. let textAreaData = currentData.fieldsValue;
  101358. // 设置当前数据
  101359. this.currentData = currentData;
  101360. this.currentFillData = currentFillData;
  101361. // 填充字段下拉框
  101362. let fieldsSelect = document.getElementById('fieldsSelect');
  101363. // 清空 fieldsSelect
  101364. fieldsSelect.innerHTML = '';
  101365. let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
  101366. fieldsSelectNameDiv.innerHTML = fieldsArr[0];
  101367. fieldsSelectNameDiv.title = fieldsArr[0];
  101368. this._createOptions(fieldsSelect, fieldsArr);
  101369. this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
  101370. // 当前选中字段
  101371. let fieldsSelectName = fieldsSelectNameDiv.title;
  101372. // 通过当前选中字段 填充 TextArea 初始值
  101373. let getValueTextArea = document.getElementById('getValueTextArea');
  101374. getValueTextArea.value = textAreaData[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  101375. getValueTextArea.setAttribute('data-value', textAreaData[fieldsSelectName]);
  101376. // 结果图层
  101377. let resultLayersName = document.getElementById('resultLayersName');
  101378. let analysisType = document.getElementById('dropDownTop').getAttribute('data-value');
  101379. switch (analysisType) {
  101380. case 'isolines':
  101381. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
  101382. break;
  101383. case 'buffer':
  101384. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
  101385. break;
  101386. }
  101387. },
  101388. /**
  101389. * @function ClientComputationView.prototype._initView
  101390. * @description 创建客户端计算组件。
  101391. * @returns {HTMLElement}
  101392. * @private
  101393. */
  101394. _initView: function () {
  101395. //初始化 ViewModel
  101396. this.workerUrl && (this.viewModel = new ClientComputationViewModel(this.workerUrl));
  101397. //初始化 view
  101398. // Container
  101399. let container = (new CommonContainer({ title: Lang.i18n('title_clientComputing') })).getElement();
  101400. container.classList.add('component-analysis');
  101401. container.children[0].style.fontSize = '12px';
  101402. let analysisOptionsArr = [{
  101403. 'title': Lang.i18n('text_isoline'),
  101404. 'dataValue': 'isolines',
  101405. 'remark': Lang.i18n('text_extractDiscreteValue'),
  101406. 'icon': {
  101407. 'className': 'component-analyst-isoline-img'
  101408. }
  101409. }, {
  101410. 'title': Lang.i18n('text_buffer'),
  101411. 'dataValue': 'buffer',
  101412. 'remark': Lang.i18n('text_specifyTheDistance'),
  101413. 'icon': {
  101414. 'className': 'component-analyst-buffer-img'
  101415. }
  101416. }];
  101417. let componentContentContainer = container.children[1];
  101418. componentContentContainer.classList.add('component-content--scroll');
  101419. componentContentContainer.classList.add('component-content--analysis');
  101420. // 下拉框
  101421. let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
  101422. componentContentContainer.appendChild(dropDownBox);
  101423. let dropDownTopContainer = dropDownBox.children[0].children[0];
  101424. let dropDownItems = dropDownBox.children[0].children[2].children[0];
  101425. dropDownTopContainer.children[0].id = 'dropDownTop';
  101426. // analysisContainer
  101427. let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  101428. // 分析图层
  101429. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisTypeContainer);
  101430. let layerSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
  101431. layerSelectControl.id = 'layerSelectControl';
  101432. let layerOptions = {
  101433. 'optionsArr': [''],
  101434. 'labelName': Lang.i18n('text_label_analysisLayer')
  101435. };
  101436. let layerSelectObj = new Select(layerOptions);
  101437. let layerSelectTool = layerSelectObj.getElement();
  101438. this.layerSelectObj = layerSelectObj;
  101439. layerSelectControl.appendChild(layerSelectTool);
  101440. // 图层选中div
  101441. let layerSelectName = layerSelectTool.children[1].children[0];
  101442. layerSelectName.id = 'layerSelectName';
  101443. // 图层下拉框select
  101444. let layersSelect = layerSelectTool.children[1].children[2].children[0].children[0];
  101445. layersSelect.id = 'layersSelect';
  101446. // ISOLINE
  101447. // 提取字段
  101448. let div = external_L_default().DomUtil.create('div', 'component-analysis__container__analysistype', analysisTypeContainer);
  101449. let isolineDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__isoline', div);
  101450. let fieldsOptions = {
  101451. 'optionsArr': [''],
  101452. 'labelName': Lang.i18n('text_label_extractField'),
  101453. 'optionsClickCb': this.fieldsSelectOnchange
  101454. };
  101455. let fieldsSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', isolineDiv);
  101456. let fieldsSelectObj = new Select(fieldsOptions);
  101457. let fieldsSelectTool = fieldsSelectObj.getElement();
  101458. this.fieldsSelectObj = fieldsSelectObj;
  101459. let fieldsSelectName = fieldsSelectTool.children[1].children[0];
  101460. fieldsSelectName.id = 'fieldsSelectName';
  101461. let fieldsSelect = fieldsSelectTool.children[1].children[2].children[0].children[0];
  101462. fieldsSelect.id = 'fieldsSelect';
  101463. fieldsSelectControl.appendChild(fieldsSelectTool);
  101464. // 提取值
  101465. let textareaContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', isolineDiv);
  101466. let textareaSpan = external_L_default().DomUtil.create('span', 'component-textarea__name', textareaContainer);
  101467. textareaSpan.innerHTML = Lang.i18n('text_label_extractedValue');
  101468. let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea', textareaContainer);
  101469. textareaControl.id = 'getValueText';
  101470. let scrollarea = external_L_default().DomUtil.create('div', '', textareaControl);
  101471. let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
  101472. scrollareaContent.setAttribute('tabindex', '1');
  101473. let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
  101474. getValueTextArea.id = 'getValueTextArea';
  101475. getValueTextArea.setAttribute('rows', '20');
  101476. // 距离衰减
  101477. let breaksDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
  101478. let breaksSpan = external_L_default().DomUtil.create('span', '', breaksDiv);
  101479. breaksSpan.innerHTML = Lang.i18n('text_label_distanceAttenuation');
  101480. let breaks = external_L_default().DomUtil.create('input', '', breaksDiv);
  101481. breaks.value = '3';
  101482. // 栅格大小
  101483. let cellSizeDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
  101484. let cellSizeSpan = external_L_default().DomUtil.create('span', '', cellSizeDiv);
  101485. cellSizeSpan.innerHTML = Lang.i18n('text_label_gridSize');
  101486. let cellSize = external_L_default().DomUtil.create('input', '', cellSizeDiv);
  101487. cellSize.value = '30';
  101488. // BUFFER
  101489. // 缓冲半径
  101490. let bufferDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer hidden', div);
  101491. let bufferRadius = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', bufferDiv);
  101492. let bufferRadiusSpan = external_L_default().DomUtil.create('span', '', bufferRadius);
  101493. bufferRadiusSpan.innerHTML = Lang.i18n('text_label_bufferRadius');
  101494. let bufferRadiusDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
  101495. let bufferRadiusInput = external_L_default().DomUtil.create('input', 'buffer-radius-input', bufferRadiusDiv);
  101496. bufferRadiusInput.id = 'bufferRadiusInput';
  101497. bufferRadiusInput.value = '10';
  101498. bufferRadiusInput.setAttribute('placeholder', Lang.i18n('text_label_defaultkilometers'));
  101499. let bufferUnit = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', bufferRadiusDiv);
  101500. bufferUnit.id = 'bufferUnit';
  101501. // 半径单位选择下拉框
  101502. let bufferUnitOptions = {
  101503. 'optionsArr': [Lang.i18n('text_option_kilometer')],
  101504. 'labelName': Lang.i18n('text_label_unit')
  101505. };
  101506. let bufferUnitSelectTool = (new Select(bufferUnitOptions)).getElement();
  101507. let bufferUnitSelectName = bufferUnitSelectTool.children[1].children[0];
  101508. bufferUnitSelectName.id = 'bufferUnitSelectName';
  101509. let bufferUnitSelect = bufferUnitSelectTool.children[1].children[2].children[0].children[0];
  101510. bufferUnitSelect.id = 'bufferUnitSelect';
  101511. bufferUnitSelectTool.children[0].style.display = 'none';
  101512. bufferUnit.appendChild(bufferUnitSelectTool);
  101513. // 保留原对象字段属性
  101514. let saveFieldDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
  101515. let saveAttrsContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--issaveattrs', saveFieldDiv);
  101516. saveAttrsContainer.id = 'saveAttrsContainer';
  101517. let saveAttrsCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', saveAttrsContainer);
  101518. saveAttrsCheckbox.id = 'saveAttrsCheckbox';
  101519. let saveAttrsLabel = external_L_default().DomUtil.create('div', 'lable', saveAttrsContainer);
  101520. saveAttrsLabel.id = 'saveAttrsLabel';
  101521. saveAttrsLabel.innerHTML = Lang.i18n('text_retainOriginal');
  101522. // 合并缓冲区
  101523. let isUnionContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--isunion', saveFieldDiv);
  101524. isUnionContainer.id = 'isUnionContainer';
  101525. let isUnionCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', isUnionContainer);
  101526. isUnionCheckbox.id = 'isUnionCheckbox';
  101527. let isUnionLabel = external_L_default().DomUtil.create('div', 'lable', isUnionContainer);
  101528. isUnionLabel.innerHTML = Lang.i18n('text_mergeBuffer');
  101529. isUnionLabel.id = 'isUnionLabel';
  101530. // 结果图层
  101531. let resultLayerDiv = external_L_default().DomUtil.create('div', 'component-analysis__container__resultLayersName', analysisTypeContainer);
  101532. let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerDiv);
  101533. resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
  101534. let resultLayersName = external_L_default().DomUtil.create('input', '', resultLayerDiv);
  101535. resultLayersName.id = 'resultLayersName';
  101536. // 分析按钮
  101537. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
  101538. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  101539. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  101540. analysisBtn.innerHTML = Lang.i18n('btn_analyze');
  101541. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  101542. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
  101543. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  101544. svgContainer.id = 'analyse_background';
  101545. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  101546. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  101547. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  101548. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  101549. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  101550. </svg>`;
  101551. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
  101552. let analysisCancelBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--cancel', analysingContainer);
  101553. analysisCancelBtn.innerHTML = Lang.i18n('btn_cancelAnalysis');
  101554. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  101555. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
  101556. for (let i = 0; i < dropDownItems.children.length; i++) {
  101557. // 点击何种分析类型 判断使用图层数据
  101558. dropDownItems.children[i].onclick = () => {
  101559. dropDownTopContainer.innerHTML = dropDownItems.children[i].outerHTML;
  101560. dropDownTopContainer.children[0].id = 'dropDownTop';
  101561. let layersSelect = document.getElementById('layersSelect');
  101562. let layerSelectName = document.getElementById('layerSelectName');
  101563. let analysisMethod = dropDownItems.children[i].getAttribute('data-value');
  101564. let currentFillData = {};
  101565. switch (analysisMethod) {
  101566. case 'buffer':
  101567. isolineDiv.classList.add('hidden');
  101568. bufferDiv.classList.remove('hidden');
  101569. componentContentContainer.style.height = '422px';
  101570. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
  101571. currentFillData = this.fillData['point'];
  101572. break;
  101573. case 'isolines':
  101574. isolineDiv.classList.remove('hidden');
  101575. bufferDiv.classList.add('hidden');
  101576. componentContentContainer.style.height = '712px';
  101577. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
  101578. currentFillData = this.fillData['point'];
  101579. break;
  101580. }
  101581. // 清空 layersSelect;
  101582. // 清空 layersSelect;
  101583. if (this.currentFillData === currentFillData) {
  101584. return;
  101585. }
  101586. layersSelect.innerHTML = '';
  101587. if (JSON.stringify(currentFillData) == '{}') {
  101588. resultLayersName.value = '';
  101589. layerSelectName.title = '';
  101590. layerSelectName.innerHTML = '';
  101591. return;
  101592. }
  101593. let layserArr = [];
  101594. for (let layerName in currentFillData) {
  101595. layserArr.push(layerName);
  101596. }
  101597. layerSelectName.title = layserArr[0];
  101598. layerSelectName.innerHTML = layserArr[0];
  101599. this._createOptions(layersSelect, layserArr);
  101600. // 设置 layer select option 点击事件
  101601. this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
  101602. if (analysisMethod === 'buffer') {
  101603. resultLayersName.value = Lang.i18n('text_label_buffer') + layserArr[0];
  101604. } else if (analysisMethod === 'isolines') {
  101605. resultLayersName.value = Lang.i18n('text_label_isolines') + layserArr[0];
  101606. }
  101607. // 当前选中图层数据
  101608. this.currentData = currentFillData[layerSelectName.title];
  101609. this.currentFillData = currentFillData;
  101610. }
  101611. }
  101612. // 字段下拉框 onchange 事件
  101613. this.fieldsSelectOnchange = fieldsSelectOnchange.bind(this);
  101614. function fieldsSelectOnchange(option) {
  101615. if (this.currentData) {
  101616. let displayData = this.currentData;
  101617. let fieldsSelectName = option.title;
  101618. getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  101619. getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
  101620. }
  101621. }
  101622. // 选中图层实时改变事件
  101623. this.layersSelectOnchange = layersSelectOnchange.bind(this);
  101624. function layersSelectOnchange(option) {
  101625. if (this.currentData) {
  101626. let layerSelectName = option.title;
  101627. let displayData = this.currentFillData[layerSelectName];
  101628. this.currentData = displayData;
  101629. fieldsSelect.innerHTML = '';
  101630. this._createOptions(fieldsSelect, displayData.fields);
  101631. let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
  101632. let field = displayData.fields[0];
  101633. fieldsSelectNameDiv.title = field;
  101634. fieldsSelectNameDiv.innerHTML = field;
  101635. let fieldsSelectName = field;
  101636. this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
  101637. getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  101638. getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
  101639. let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
  101640. switch (analysisMethod) {
  101641. case 'buffer':
  101642. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName;
  101643. break;
  101644. case 'isolines':
  101645. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName;
  101646. break;
  101647. }
  101648. }
  101649. }
  101650. //复选框事件
  101651. let isSaveStatus = true;
  101652. //合并缓冲区
  101653. //合并缓冲区,默认不选中,即为false
  101654. let isUnion = false;
  101655. //选中select
  101656. saveAttrsLabel.classList.add("selected");
  101657. saveAttrsCheckbox.classList.add("checkbox-active");
  101658. saveAttrsContainer.onclick = () => {
  101659. if (isSaveStatus) {
  101660. //将当前状态和样式->不选中的样式和状态
  101661. saveAttrsCheckbox.classList.add("checkbox-fault");
  101662. saveAttrsCheckbox.classList.remove("checkbox-active");
  101663. saveAttrsLabel.classList.remove("selected");
  101664. isSaveStatus = false;
  101665. } else {
  101666. //将当前样式和状态改为选中
  101667. saveAttrsCheckbox.classList.add("checkbox-active");
  101668. saveAttrsCheckbox.classList.remove("checkbox-fault");
  101669. saveAttrsLabel.classList.add("selected");
  101670. isSaveStatus = true;
  101671. //如果当前状态为选中的状态,则将上一个复选框的样式和状态由选中-不选中
  101672. if (isUnion) {
  101673. //移除dom样式和复选框的状态改变
  101674. isUnionCheckbox.classList.add("checkbox-fault");
  101675. isUnionCheckbox.classList.remove("checkbox-active");
  101676. isUnion = false;
  101677. }
  101678. }
  101679. }
  101680. isUnionContainer.onclick = () => {
  101681. if (isUnion) {
  101682. //将选中状态 由选中->不选中,修改其样式和状态
  101683. isUnionCheckbox.classList.add("checkbox-fault");
  101684. isUnionCheckbox.classList.remove("checkbox-active");
  101685. isUnionLabel.classList.remove("selected");
  101686. isUnion = false;
  101687. } else {
  101688. //将状态由不选中->选中,修改其样式和状态
  101689. isUnionCheckbox.classList.add("checkbox-active");
  101690. isUnionCheckbox.classList.remove("checkbox-fault");
  101691. isUnionLabel.classList.add("selected");
  101692. isUnion = true;
  101693. //如果当前状态为选中的,将上一个复选框改为不选中的状态
  101694. if (isSaveStatus) {
  101695. //修改当前样式和状态
  101696. saveAttrsCheckbox.classList.add("checkbox-fault");
  101697. saveAttrsCheckbox.classList.remove("checkbox-active");
  101698. isSaveStatus = false;
  101699. }
  101700. }
  101701. }
  101702. // 提示框
  101703. this.messageBox = new MessageBox();
  101704. // 分析按钮点击事件
  101705. analysisBtn.onclick = () => {
  101706. analysingContainer.style.display = 'block';
  101707. analysisBtn.style.display = 'none';
  101708. let dropDownTop = document.getElementById('dropDownTop');
  101709. let analysisMethod = dropDownTop.getAttribute('data-value');
  101710. let params;
  101711. switch (analysisMethod) {
  101712. case 'isolines':
  101713. params = getIsolinesAnalysisParams();
  101714. break;
  101715. case 'buffer':
  101716. params = getBufferAnalysisParams();
  101717. break;
  101718. }
  101719. this.viewModel.analysis(params, this.map);
  101720. this.viewModel.on('layerloaded', (e)=> {
  101721. analysingContainer.style.display = 'none';
  101722. analysisBtn.style.display = 'block';
  101723. /**
  101724. * @event ClientComputationView#analysissucceeded
  101725. * @description 分析完成之后触发。
  101726. * @property {L.GeoJSON} layer - 加载完成后的结果图层。
  101727. * @property {string} name - 加载完成后的结果图层名称。
  101728. */
  101729. this._event.fire('analysissucceeded', { "layer": e.layer, "name": e.name })
  101730. });
  101731. // 若分析的结果为空
  101732. this.viewModel.on('analysisfailed', ()=> {
  101733. analysingContainer.style.display = 'none';
  101734. analysisBtn.style.display = 'block';
  101735. this.messageBox.showView(Lang.i18n('msg_resultIsEmpty'), "failure");
  101736. /**
  101737. * @event ClientComputationView#analysisfailed
  101738. * @description 分析失败之后触发。
  101739. */
  101740. this._event.fire('analysisfailed')
  101741. })
  101742. }
  101743. // 取消按钮点击事件
  101744. analysisCancelBtn.onclick = () => {
  101745. analysingContainer.style.display = 'none';
  101746. analysisBtn.style.display = 'block';
  101747. this.viewModel.cancelAnalysis()
  101748. }
  101749. // 删除按钮点击事件
  101750. deleteLayersBtn.onclick = () => {
  101751. /**
  101752. * @event ClientComputationView#layersremoved
  101753. * @description 结果图层删除后触发。
  101754. * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
  101755. */
  101756. this.viewModel.on('layersremoved', (e) => {
  101757. this._event.fire('layersremoved', { 'layers': e.layers });
  101758. })
  101759. this.viewModel.clearLayers();
  101760. }
  101761. // 获取分析数据
  101762. function getIsolinesAnalysisParams() {
  101763. let dropDownTop = document.getElementById('dropDownTop');
  101764. let analysisMethod = dropDownTop.getAttribute('data-value');
  101765. let resultLayersName = document.getElementById('resultLayersName').value;
  101766. let analysisLayers = layerSelectName.title;
  101767. let analysisFields = fieldsSelectName.title;
  101768. let analysisFieldsValue = getValueTextArea.value.replace(/[\r\n]/g, "").split(',').toString();
  101769. let analysisBreaks = breaks.value;
  101770. let analysisCellSize = cellSize.value;
  101771. let param = {
  101772. 'analysisMethod': analysisMethod,
  101773. 'analysisLayers': analysisLayers,
  101774. 'analysisFields': analysisFields,
  101775. 'analysisFieldsValue': analysisFieldsValue,
  101776. 'analysisBreaks': analysisBreaks,
  101777. 'analysisCellSize': analysisCellSize,
  101778. 'resultLayersName': resultLayersName
  101779. }
  101780. return param;
  101781. }
  101782. function getBufferAnalysisParams() {
  101783. let dropDownTop = document.getElementById('dropDownTop');
  101784. let resultLayersName = document.getElementById('resultLayersName').value;
  101785. let analysisLayers = layerSelectName.title;
  101786. let analysisMethod = dropDownTop.getAttribute('data-value');
  101787. let radius = bufferRadiusInput.value;
  101788. let unit = bufferUnitSelectName.title;
  101789. let param = {
  101790. 'analysisMethod': analysisMethod,
  101791. 'analysisLayers': analysisLayers,
  101792. 'radius': radius,
  101793. 'unit': unit,
  101794. 'resultLayersName': resultLayersName,
  101795. 'isSaveStatus': isSaveStatus,
  101796. 'isUnion': isUnion
  101797. };
  101798. return param;
  101799. }
  101800. // 阻止 map 默认事件
  101801. this._preventMapEvent(container, this.map);
  101802. return container;
  101803. },
  101804. /**
  101805. * @function ClientComputationView.prototype._createOptions
  101806. * @description 创建 select 下拉框的 options。
  101807. * @private
  101808. */
  101809. _createOptions(container, optionsArr) {
  101810. for (let i in optionsArr) {
  101811. let option = document.createElement('div');
  101812. let optData = optionsArr[i];
  101813. option.className = 'component-selecttool__option';
  101814. option.title = optData;
  101815. option.innerHTML = optData;
  101816. option.setAttribute('data-value', optData);
  101817. container.appendChild(option);
  101818. }
  101819. }
  101820. });
  101821. var clientComputationView = function (options) {
  101822. return new ClientComputationView(options);
  101823. };
  101824. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationLayer.js
  101825. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101826. * This program are made available under the terms of the Apache License, Version 2.0
  101827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101828. /**
  101829. * @class ClientComputationLayer
  101830. * @aliasclass Components.ClientComputationLayer
  101831. * @deprecatedclassinstance L.supermap.components.clientComputationLayer
  101832. * @classdesc 客户端计算图层对象。
  101833. * @version 9.1.1
  101834. * @param {Object} layerObject - 图层对象。
  101835. * @param {string} layerObject.layerName - 图层名称。
  101836. * @param {L.GeoJSON} layerObject.layer - 图层。
  101837. * @param {Array.<string>} [layerObject.fields] - 字段数组。
  101838. * @category Components ClientComputation
  101839. * @usage
  101840. */
  101841. class ClientComputationLayer{
  101842. constructor(layerObject){
  101843. this.layerName = layerObject.layerName;
  101844. this.layer = layerObject.layer;
  101845. this.fields = layerObject.fields || null;
  101846. }
  101847. }
  101848. var clientComputationLayer = function(layerObject){
  101849. return new ClientComputationLayer(layerObject)
  101850. }
  101851. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisModel.js
  101852. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101853. * This program are made available under the terms of the Apache License, Version 2.0
  101854. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101855. /**
  101856. * @class DistributedAnalysisModel
  101857. * @aliasclass Components.DistributedAnalysisModel
  101858. * @deprecatedclassinstance L.supermap.components.DistributedAnalysisModel
  101859. * @classdesc 分布式分析组件数据模型。
  101860. * @private
  101861. * @category Components DistributedAnalysis
  101862. * @param {string} processingUrl - 分布式分析地址。
  101863. * @fires DistributedAnalysisModel#datasetsloaded
  101864. * @fires DistributedAnalysisModel#datasetinfoloaded
  101865. * @extends {L.Evented}
  101866. */
  101867. class DistributedAnalysisModel extends (external_L_default()).Evented {
  101868. initialize(processingUrl) {
  101869. this.processingUrl = processingUrl
  101870. }
  101871. /**
  101872. * @function DistributedAnalysisModel.prototype.getDatasetsName
  101873. * @description 获取所有可进行分布式分析的数据集名称。
  101874. * @param {string} url - 服务地址。
  101875. */
  101876. getDatasetsName() {
  101877. let url = this.processingUrl;
  101878. this.dataset = [];
  101879. this.dataset['datasetNames'] = [];
  101880. this.dataset['childUrl'] = [];
  101881. let host = 'http://' + url.split('/')[2];
  101882. let sharefileUrl = host + '/iserver/services/datacatalog/rest/datacatalog/sharefile.json';
  101883. let datasetsUrl = host + '/iserver/services/datacatalog/rest/datacatalog/relationship/datasets.json';
  101884. let me = this;
  101885. FetchRequest.get(sharefileUrl).then(function (response) {
  101886. return response.json();
  101887. }).then(function (result) {
  101888. me.dataset['datasetNames'] = me.dataset['datasetNames'].concat(result.datasetNames);
  101889. me.dataset['childUrl'] = me.dataset['childUrl'].concat(result.childUriList);
  101890. let _me = me;
  101891. FetchRequest.get(datasetsUrl).then(function (response) {
  101892. return response.json();
  101893. }).then(function (result) {
  101894. _me.dataset['datasetNames'] = _me.dataset['datasetNames'].concat(result.datasetNames);
  101895. _me.dataset['childUrl'] = _me.dataset['childUrl'].concat(result.childUriList);
  101896. let datasetHash = [];
  101897. for (let i in _me.dataset['datasetNames']) {
  101898. datasetHash[_me.dataset.datasetNames[i]] = _me.dataset.childUrl[i]
  101899. }
  101900. /**
  101901. * @event DistributedAnalysisModel#datasetsloaded
  101902. * @description 数据集获取完成之后触发。
  101903. * @property {Object} result - 数据集数据。
  101904. * @property {Array.<string>} result.dataset - 数据集名称数组。
  101905. * @property {Object} result.datasetHash - 数据集名称数组与数据集 URL 一一对应的对象。
  101906. */
  101907. _me.fire('datasetsloaded', { 'result': { 'dataset': _me.dataset, 'datasetHash': datasetHash } });
  101908. });
  101909. });
  101910. }
  101911. /**
  101912. * @function DistributedAnalysisModel.prototype.getDatasetInfo
  101913. * @description 获取数据集类型和字段。
  101914. * @param {string} datasetUrl - 数据集资源地址。
  101915. */
  101916. getDatasetInfo(datasetUrl) {
  101917. let type;
  101918. let me = this;
  101919. FetchRequest.get(datasetUrl).then(function (response) {
  101920. return response.json();
  101921. }).then(function (data) {
  101922. let datasetInfo = data.datasetInfo
  101923. if (datasetInfo.datasetType === 'LINE' || datasetInfo.type === 'LINE') {
  101924. type = 'LINE';
  101925. } else if (datasetInfo.datasetType === 'POINT' || datasetInfo.type === 'POINT' || datasetInfo.type === 'CSV') {
  101926. type = 'POINT';
  101927. } else if (datasetInfo.datasetType === 'REGION' || datasetInfo.type === 'REGION') {
  101928. type = 'REGION';
  101929. }
  101930. let fields = [];
  101931. let fieldInfos = datasetInfo.fieldInfos || datasetInfo.fieldInfo || null;
  101932. if (fieldInfos) {
  101933. for (let i in fieldInfos) {
  101934. fields.push(fieldInfos[i].name)
  101935. }
  101936. /**
  101937. * @event DistributedAnalysisModel#datasetinfoloaded
  101938. * @description 数据集查询完成之后触发。
  101939. * @property {Object} result - 数据集数据。
  101940. * @property {string} result.type - 数据集类型。
  101941. * @property {Array.<string>} result.fields - 数据集字段。
  101942. */
  101943. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  101944. } else {
  101945. let fieldsUrl = data.childUriList[0].replace('//fields', '/fields');
  101946. FetchRequest.get(fieldsUrl).then(function (response) {
  101947. return response.json();
  101948. }).then(function (data) {
  101949. let fieldNames = data.fieldNames;
  101950. let fields = [];
  101951. for (let i in fieldNames) {
  101952. fields.push(fieldNames[i])
  101953. }
  101954. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  101955. })
  101956. }
  101957. })
  101958. }
  101959. }
  101960. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisViewModel.js
  101961. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  101962. * This program are made available under the terms of the Apache License, Version 2.0
  101963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  101964. /**
  101965. * @class DistributedAnalysisViewModel
  101966. * @aliasclass Components.DistributedAnalysisViewModel
  101967. * @deprecatedclassinstance L.supermap.components.distributedAnalysisViewModel
  101968. * @classdesc 分布式分析组件功能类。
  101969. * @version 9.1.1
  101970. * @category Components DistributedAnalysis
  101971. * @param {string} processingUrl - 分布式分析地址。
  101972. * @fires DistributedAnalysisViewModel#datasetsloaded
  101973. * @fires DistributedAnalysisViewModel#datasetinfoloaded
  101974. * @fires DistributedAnalysisViewModel#analysisfailed
  101975. * @fires DistributedAnalysisViewModel#analysissucceeded
  101976. * @fires DistributedAnalysisViewModel#layerloaded
  101977. * @fires DistributedAnalysisViewModel#layersremoved
  101978. * @extends {L.Evented}
  101979. * @usage
  101980. */
  101981. class DistributedAnalysisViewModel extends (external_L_default()).Evented {
  101982. initialize(processingUrl) {
  101983. this.processingUrl = processingUrl
  101984. }
  101985. /**
  101986. * @function DistributedAnalysisViewModel.prototype.getDatasetsName
  101987. * @description 获取所有数据集名称。
  101988. * @param {string} url - 服务地址。
  101989. */
  101990. getDatasetsName() {
  101991. let processingUrl = this.processingUrl;
  101992. this.resultLayers = [];
  101993. this.datasetNames = [];
  101994. this.distributedAnalysisModel = new DistributedAnalysisModel(processingUrl);
  101995. this.distributedAnalysisModel.getDatasetsName();
  101996. let me = this;
  101997. this.distributedAnalysisModel.on('datasetsloaded', function (e) {
  101998. /**
  101999. * @event DistributedAnalysisViewModel#datasetsloaded
  102000. * @description 数据集获取完成之后触发。
  102001. * @property {Object} result - 数据集数据。
  102002. */
  102003. me.fire('datasetsloaded', { 'result': e.result });
  102004. })
  102005. }
  102006. /**
  102007. * @function DistributedAnalysisViewModel.prototype.getDatasetInfo
  102008. * @description 获取数据集类型和字段。
  102009. * @param {string} datasetUrl - 数据集资源地址。
  102010. */
  102011. getDatasetInfo(datasetUrl) {
  102012. // 判断数据集类型
  102013. this.distributedAnalysisModel.getDatasetInfo(datasetUrl);
  102014. let me = this;
  102015. this.distributedAnalysisModel.on('datasetinfoloaded', function (e) {
  102016. let type = e.result.type;
  102017. let fields = e.result.fields;
  102018. /**
  102019. * @event DistributedAnalysisViewModel#datasetinfoloaded
  102020. * @description 数据集类型与字段获取完成之后触发。
  102021. * @property {Object} result - 数据集数据。
  102022. * @property {string} result.type - 数据集类型。
  102023. * @property {Array.<string>} result.fields - 数据集所含有的字段。
  102024. */
  102025. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  102026. })
  102027. }
  102028. /**
  102029. * @function DistributedAnalysisViewModel.prototype.analysis
  102030. * @description 分布式分析。
  102031. * @param {Object.<KernelDensityJobParameter|string>} params - 参数。
  102032. * @param {KernelDensityJobParameter} params.analysisParam - 密度分析任务参数类。
  102033. * @param {string} [params.resultLayerName] - 结果图层名称。
  102034. * @param {L.Map} map - Leaflet Map 对象。
  102035. */
  102036. analysis(params, map) {
  102037. let processingService = new ProcessingService_ProcessingService(this.processingUrl);
  102038. if (params.analysisParam instanceof KernelDensityJobParameter) {
  102039. let kernelDensityJobParameter = params.analysisParam
  102040. let me = this;
  102041. processingService.addKernelDensityJob(kernelDensityJobParameter, function (serviceResult) {
  102042. if (serviceResult.error) {
  102043. /**
  102044. * @event DistributedAnalysisViewModel#analysisfailed
  102045. * @description 分析失败后触发。
  102046. */
  102047. me.fire('analysisfailed', { 'error': serviceResult.error });
  102048. return;
  102049. }
  102050. serviceResult.result.setting.serviceInfo.targetServiceInfos.map(function (info) {
  102051. if (info.serviceType === 'RESTMAP') {
  102052. FetchRequest.get(info.serviceAddress + '/maps').then(function (response) {
  102053. return response.json();
  102054. }).then(function (result) {
  102055. let mapUrl = result[0].path;
  102056. /**
  102057. * @event DistributedAnalysisViewModel#analysissucceeded
  102058. * @description 分析成功后服务器返回的数据。
  102059. */
  102060. me.fire('analysissucceed', { 'result': result });
  102061. let layer = tiledMapLayer(mapUrl, { noWrap: true, transparent: true });
  102062. me.resultLayers.push(layer);
  102063. layer.addTo(map);
  102064. /**
  102065. * @event DistributedAnalysisViewModel#layerloaded
  102066. * @description 分析结果图层加载完成后触发。
  102067. * @property {L.GeoJSON} layer - 结果图层。
  102068. * @property {string} name - 结果图层名称。
  102069. */
  102070. let date = new Date();
  102071. let resultLayerName = params.resultLayerName || date.getTime();
  102072. me.fire('layerloaded', { 'layer': layer, 'name': resultLayerName })
  102073. });
  102074. }
  102075. return info;
  102076. });
  102077. })
  102078. }
  102079. }
  102080. /**
  102081. * @function DistributedAnalysisViewModel.prototype.clearLayers
  102082. * @description 清空分析图层。
  102083. */
  102084. clearLayers() {
  102085. for (let i in this.resultLayers) {
  102086. this.resultLayers[i].remove();
  102087. }
  102088. /**
  102089. * @event DistributedAnalysisViewModel#layersremoved
  102090. * @description 图层删除后触发。
  102091. * @property {Array.<L.GeoJSON>} layers - 结果图层数组。
  102092. */
  102093. this.fire('layersremoved', { 'layers': this.resultLayers });
  102094. this.resultLayers = [];
  102095. }
  102096. }
  102097. var distributedAnalysisViewModel = function (options) {
  102098. return new DistributedAnalysisViewModel(options);
  102099. };
  102100. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisView.js
  102101. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  102102. * This program are made available under the terms of the Apache License, Version 2.0
  102103. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  102104. /**
  102105. * @class DistributedAnalysisView
  102106. * @aliasclass Components.DistributedAnalysisView
  102107. * @deprecatedclassinstance L.supermap.components.distributedAnalysis
  102108. * @classdesc 分布式分析组件类。
  102109. * @version 9.1.1
  102110. * @modulecategory Components
  102111. * @param {string} processingUrl - 分布式分析服务地址。
  102112. * @param {Object} options - 参数。
  102113. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  102114. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
  102115. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  102116. * @fires DistributedAnalysisView#analysissucceeded
  102117. * @fires DistributedAnalysisView#analysisfailed
  102118. * @fires DistributedAnalysisView#layersremoved
  102119. * @extends {ComponentsViewBase}
  102120. * @category Components DistributedAnalysis
  102121. * @usage
  102122. */
  102123. var DistributedAnalysisView = ComponentsViewBase.extend({
  102124. initialize: function (processingUrl, options) {
  102125. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  102126. //初始化 ViewModel:
  102127. this.viewModel = new DistributedAnalysisViewModel(processingUrl);
  102128. },
  102129. /**
  102130. * @function DistributedAnalysisView.prototype.onAdd
  102131. * @description 添加控件。
  102132. * @private
  102133. * @override
  102134. */
  102135. onAdd: function (map) {
  102136. this._fillDataToView();
  102137. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  102138. },
  102139. /**
  102140. * @function DistributedAnalysisView.prototype._fillDataToView
  102141. * @description 添加数据。
  102142. * @private
  102143. */
  102144. _fillDataToView: function () {
  102145. // 获取数据集
  102146. this.viewModel.on('datasetsloaded', (e) => {
  102147. let datasetOptionsArr = e.result.dataset.datasetNames;
  102148. this.datasetSelect.innerHTML = '';
  102149. this._createOptions(this.datasetSelect, datasetOptionsArr);
  102150. this.datasetSelectObj.optionClickEvent(this.datasetSelect, this.datasetSelectName, this.datasetSelectOnchange);
  102151. this.dataHash = e.result.datasetHash;
  102152. });
  102153. this.viewModel.getDatasetsName();
  102154. },
  102155. /**
  102156. * @function DistributedAnalysisView.prototype._initView
  102157. * @description 创建分布式分析组件。
  102158. * @returns {HTMLElement}
  102159. * @private
  102160. * @override
  102161. */
  102162. _initView: function () {
  102163. // 组件 container
  102164. let container = (new CommonContainer({title: Lang.i18n('title_distributedAnalysis')})).getElement();
  102165. container.classList.add('component-analysis');
  102166. container.children[0].style.fontSize = '12px';
  102167. // 组件内容 container
  102168. let componentContentContainer = external_L_default().DomUtil.create('div', 'component-content component-content--scroll component-content--analysis', container);
  102169. // 分析方式下拉框
  102170. let analysisOptionsArr = [{
  102171. 'title': Lang.i18n('text_densityAnalysis'),
  102172. 'dataValue': 'density',
  102173. 'remark': Lang.i18n('text_CalculateTheValuePerUnitArea'),
  102174. 'icon': {
  102175. 'className': 'component-analyst-density-img'
  102176. }
  102177. }];
  102178. let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
  102179. componentContentContainer.appendChild(dropDownBox);
  102180. // 选中的 dropDownItem
  102181. let dropDownTop = dropDownBox.children[0].children[0].children[0];
  102182. // 各分析参数 container
  102183. let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  102184. let analysisType = external_L_default().DomUtil.create('div', 'analysistype', analysisTypeContainer);
  102185. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
  102186. // 数据集下拉框
  102187. let datasetSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
  102188. let datasetOptions = {
  102189. 'optionsArr': [Lang.i18n('text_option_selectDataset')],
  102190. 'labelName': Lang.i18n('text_label_dataset'),
  102191. "optionsClickCb": datasetSelectOnchange.bind(this)
  102192. };
  102193. let datasetSelectObj = new Select(datasetOptions);
  102194. let datasetSelectTool = datasetSelectObj.getElement();
  102195. this.datasetSelectObj = datasetSelectObj;
  102196. datasetSelectControl.appendChild(datasetSelectTool);
  102197. // 选中的 dataset
  102198. let datasetSelectName = datasetSelectTool.children[1].children[0];
  102199. this.datasetSelectName = datasetSelectName;
  102200. // dataset select container
  102201. let datasetSelect = datasetSelectTool.children[1].children[2].children[0].children[0];
  102202. datasetSelect.children[0].style.display = 'none';
  102203. this.datasetSelect = datasetSelect;
  102204. // 分析方法下拉框 & 网格面类型下拉框
  102205. let analyseIDW = external_L_default().DomUtil.create('div', 'component-analysis__idw', analysisLayer);
  102206. let analysisOptions = [{
  102207. 'optionsArr': [Lang.i18n('text_option_simplePointDensityAnalysis'), Lang.i18n('text_option_nuclearDensityAnalysis')],
  102208. 'labelName': Lang.i18n('text_label_analyticalMethod')
  102209. // 'optionsClickCb': analysisMethodSelectOnchange.bind(this)
  102210. }, {
  102211. 'optionsArr': [Lang.i18n('text_option_quadrilateral'), Lang.i18n('text_option_hexagon')],
  102212. 'labelName': Lang.i18n('text_label_meshType')
  102213. }];
  102214. // 分析参数 select control
  102215. let analysisSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__idw__selecttool', analyseIDW);
  102216. for (let i in analysisOptions) {
  102217. let selectTool = (new Select(analysisOptions[i])).getElement();
  102218. analysisSelectControl.appendChild(selectTool);
  102219. }
  102220. // 权重选择下拉框
  102221. let weightFieldsSelectOptions = {
  102222. 'optionsArr': [Lang.i18n('text_option_notSet')],
  102223. 'labelName': Lang.i18n('text_label_weightField')
  102224. };
  102225. let weightFieldsSelectObj = new Select(weightFieldsSelectOptions);
  102226. let weightFieldsSelectTool = weightFieldsSelectObj.getElement();
  102227. analysisSelectControl.appendChild(weightFieldsSelectTool);
  102228. this.weightFieldsSelectObj = weightFieldsSelectObj;
  102229. // 分析方法选中值 & option attr设置
  102230. let analysisMethodSelectName = analysisSelectControl.children[0].children[1].children[0];
  102231. analysisMethodSelectName.setAttribute('data-value', '0');
  102232. let analysisMethodSelect = analysisSelectControl.children[0].children[1].children[2].children[0].children[0];
  102233. let analysisMethodDV = ['0', '1'];
  102234. this._setEleAtribute(analysisMethodDV, 'data-value', analysisMethodSelect.children);
  102235. // 网格面类型选中值 & option attr设置
  102236. let gridTypeSelectName = analysisSelectControl.children[1].children[1].children[0];
  102237. gridTypeSelectName.setAttribute('data-value', '0');
  102238. let gridTypeSelect = analysisSelectControl.children[1].children[1].children[2].children[0].children[0];
  102239. let gridTypeDV = ['0', '1'];
  102240. this._setEleAtribute(gridTypeDV, 'data-value', gridTypeSelect.children);
  102241. // 权重值选中值
  102242. let weightFieldsSelectName = analysisSelectControl.children[2].children[1].children[0];
  102243. let weightFieldsSelect = analysisSelectControl.children[2].children[1].children[2].children[0].children[0];
  102244. // 分析范围 & 网格大小 & 搜索半径 & 面积单位
  102245. // 分析范围
  102246. let inputOptions = [{
  102247. 'spanName': Lang.i18n('text_label_queryRange'),
  102248. 'value': ''
  102249. }];
  102250. for (let i in inputOptions) {
  102251. this._creatInputBox(inputOptions[i], analysisSelectControl)
  102252. }
  102253. let queryRangeInput = analysisSelectControl.children[3].children[1];
  102254. queryRangeInput.setAttribute('placeholder', Lang.i18n('text_label_queryRangeTips'));
  102255. queryRangeInput.title = Lang.i18n('text_label_queryRangeTips');
  102256. // 网格大小
  102257. let gridSizeUnitSelectOptions = {
  102258. 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
  102259. };
  102260. let gridSizeOptions = {
  102261. 'labelName': Lang.i18n('text_label_gridSizeInMeters'),
  102262. 'selectOptions': gridSizeUnitSelectOptions
  102263. };
  102264. let gridSizeContainer = this._creatUnitSelectBox(gridSizeOptions, analysisSelectControl);
  102265. let gridSizeInput = gridSizeContainer.children[1].children[0];
  102266. gridSizeInput.value = '1000';
  102267. let gridSizeUnitSelectName = gridSizeContainer.children[1].children[1].children[0].children[0].children[0];
  102268. // 搜索半径
  102269. let searchRadiusUnitSelectOptions = {
  102270. 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
  102271. };
  102272. let searchRadiusOptions = {
  102273. 'labelName': Lang.i18n('text_label_searchRadius'),
  102274. 'selectOptions': searchRadiusUnitSelectOptions
  102275. };
  102276. let searchRadiusContainer = this._creatUnitSelectBox(searchRadiusOptions, analysisSelectControl);
  102277. let searchRadiusInput = searchRadiusContainer.children[1].children[0];
  102278. searchRadiusInput.value = '300';
  102279. let searchRadiusSelectName = searchRadiusContainer.children[1].children[1].children[0].children[0].children[0];
  102280. // 面积单位
  102281. let areaUnitSelectOptions = {
  102282. 'labelName': Lang.i18n('text_label_areaUnit'),
  102283. 'optionsArr': ['SquareMile', 'SquareMeter', 'Hectare', 'Acre', 'SquareFoot', 'SquareYard']
  102284. };
  102285. let areaUnitSelectTool = (new Select(areaUnitSelectOptions)).getElement();
  102286. analysisSelectControl.appendChild(areaUnitSelectTool);
  102287. let areaUnitSelectName = areaUnitSelectTool.children[1].children[0];
  102288. // 专题图分段
  102289. let rangeContent = external_L_default().DomUtil.create('div', 'range-content', analysisType);
  102290. let rangeContentOptions = {
  102291. 'optionsArr': [Lang.i18n('text_option_notSet'), Lang.i18n('text_option_equidistantSegmentation'), Lang.i18n('text_option_logarithm'), Lang.i18n('text_option_equalCountingSegment'), Lang.i18n('text_option_squareRootSegmentation')],
  102292. 'labelName': Lang.i18n('text_label_thematicMapSegmentationMode'),
  102293. "optionsClickCb": themeModelSelectOnchange
  102294. };
  102295. rangeContent.appendChild((new Select(rangeContentOptions)).getElement());
  102296. let themeModelSelectName = rangeContent.children[0].children[1].children[0];
  102297. themeModelSelectName.setAttribute('data-value', 'NOTSET');
  102298. let themeModelSelect = rangeContent.children[0].children[1].children[2].children[0].children[0];
  102299. let themeModelDataValue = ['NOTSET', 'EQUALINTERVAL', 'LOGARITHM', 'QUANTILE', 'SQUAREROOT'];
  102300. this._setEleAtribute(themeModelDataValue, 'data-value', themeModelSelect.children);
  102301. let rangeContentParamInput = this._creatInputBox({
  102302. 'spanName': Lang.i18n('text_label_thematicMapSegmentationParameters'),
  102303. 'value': '20'
  102304. }, rangeContent);
  102305. rangeContentParamInput.classList.add('hidden');
  102306. let rangeContentModelSelectTool = (new Select({
  102307. 'optionsArr': [
  102308. Lang.i18n('text_option_greenOrangePurpleGradient'),
  102309. Lang.i18n('text_option_greenOrangeRedGradient'),
  102310. Lang.i18n('text_option_rainbowGradient'),
  102311. Lang.i18n('text_option_spectralGradient'),
  102312. Lang.i18n('text_option_terrainGradient')],
  102313. 'labelName': Lang.i18n('text_label_thematicMapColorGradientMode')
  102314. })).getElement();
  102315. rangeContent.appendChild(rangeContentModelSelectTool);
  102316. rangeContentModelSelectTool.classList.add('hidden');
  102317. let rangeContentModelSelect = rangeContentModelSelectTool.children[1].children[2].children[0].children[0];
  102318. let rangeContentModelSelectName = rangeContentModelSelectTool.children[1].children[0];
  102319. rangeContentModelSelectName.setAttribute('data-value', 'GREENORANGEVIOLET');
  102320. let rangeContentModelDV = ['GREENORANGEVIOLET', 'GREENORANGERED', 'RAINBOW', 'SPECTRUM', 'TERRAIN'];
  102321. this._setEleAtribute(rangeContentModelDV, 'data-value', rangeContentModelSelect.children);
  102322. // 专题图分段模式下拉框 onchange 事件
  102323. function themeModelSelectOnchange(option) {
  102324. if (option.getAttribute('data-value') !== 'NOTSET') {
  102325. rangeContentParamInput.classList.remove('hidden');
  102326. rangeContentModelSelectTool.classList.remove('hidden');
  102327. } else {
  102328. rangeContentParamInput.classList.add('hidden');
  102329. rangeContentModelSelectTool.classList.add('hidden');
  102330. }
  102331. }
  102332. // 结果图层
  102333. let resultLayerContainer = external_L_default().DomUtil.create('div', '', analysisType);
  102334. let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerContainer);
  102335. resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
  102336. let resultLayerInput = external_L_default().DomUtil.create('input', 'component-distributeanalysis__input', resultLayerContainer);
  102337. // 分析 & 分析中 & 取消 按钮
  102338. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
  102339. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  102340. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  102341. analysisBtn.innerHTML = Lang.i18n('btn_analyze');
  102342. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  102343. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
  102344. analysisingBtn.style.width = '200px';
  102345. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  102346. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  102347. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  102348. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  102349. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  102350. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  102351. </svg>`;
  102352. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
  102353. // 删除按钮
  102354. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  102355. deleteLayersBtn.id = 'deleteLayersBtn';
  102356. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
  102357. // 交互
  102358. // 弹框
  102359. this.messageBox = new MessageBox();
  102360. // 数据集下拉框 onchange 事件
  102361. this.datasetSelectOnchange = datasetSelectOnchange.bind(this);
  102362. function datasetSelectOnchange(option) {
  102363. this.messageBox.closeView();
  102364. if (this.dataHash) {
  102365. weightFieldsSelect.innerHTML = '';
  102366. // 获取当前选中数据集类型
  102367. let datasetUrl = this.dataHash[option.title];
  102368. // 判断当前选中数据集是否支持该选中分析类,并填充分析权重字段
  102369. let _me = this;
  102370. this.viewModel.on('datasetinfoloaded', function (e) {
  102371. weightFieldsSelectName.title = Lang.i18n('text_option_notSet');
  102372. weightFieldsSelectName.innerHTML = Lang.i18n('text_option_notSet');
  102373. weightFieldsSelect.innerHTML = '';
  102374. let analyseType = dropDownTop.getAttribute('data-value');
  102375. let type = e.result.type;
  102376. let fields = e.result.fields;
  102377. if (analyseType === 'density') {
  102378. if (type === 'REGION' || type === 'LINE') {
  102379. _me.messageBox.showView(Lang.i18n('msg_datasetOrMethodUnsupport'), "failure");
  102380. } else {
  102381. _me.messageBox.closeView();
  102382. _me._createOptions(weightFieldsSelect, fields);
  102383. _me.weightFieldsSelectObj.optionClickEvent(weightFieldsSelect, weightFieldsSelectName);
  102384. }
  102385. }
  102386. });
  102387. this.viewModel.getDatasetInfo(datasetUrl);
  102388. }
  102389. }
  102390. // 分析按钮点击事件
  102391. analysisBtn.onclick = () => {
  102392. this.messageBox.closeView();
  102393. let params = getAnalysisParam();
  102394. if (datasetSelectName.title === Lang.i18n('text_option_selectDataset')) {
  102395. this.messageBox.showView(Lang.i18n('msg_selectDataset'), "failure");
  102396. } else if ( weightFieldsSelectName.title === Lang.i18n('text_option_notSet')) {
  102397. this.messageBox.showView(Lang.i18n('msg_setTheWeightField'), "failure");
  102398. } else {
  102399. this.messageBox.closeView();
  102400. analysingContainer.style.display = 'block';
  102401. analysisBtn.style.display = 'none';
  102402. this.viewModel.on('layerloaded', (e) => {
  102403. analysingContainer.style.display = 'none';
  102404. analysisBtn.style.display = 'block';
  102405. /**
  102406. * @event DistributedAnalysisView#analysissucceeded
  102407. * @description 分析完成后触发。
  102408. * @property {L.GeoJSON} layer - 结果图层。
  102409. * @property {string} name - 结果图层名称。
  102410. */
  102411. this._event.fire('analysissucceeded', {'layer': e.layer, 'name': e.name})
  102412. });
  102413. this.viewModel.on('analysisfailed', (e) => {
  102414. this.messageBox.showView(Lang.i18n('msg_theFieldNotSupportAnalysis'), "failure");
  102415. analysingContainer.style.display = 'none';
  102416. analysisBtn.style.display = 'block';
  102417. /**
  102418. * @event DistributedAnalysisView#analysisfailed
  102419. * @description 分析失败后触发。
  102420. * @property {string} error - 服务器返回的错误。
  102421. */
  102422. this._event.fire('analysisfailed', {'error': e.error})
  102423. });
  102424. this.viewModel.analysis(params, this.map);
  102425. }
  102426. };
  102427. // 删除按钮点击事件
  102428. deleteLayersBtn.onclick = () => {
  102429. /**
  102430. * @event DistributedAnalysisView#layersremoved
  102431. * @description 结果图层删除后触发。
  102432. * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
  102433. */
  102434. this.viewModel.on('layersremoved', (e) => {
  102435. this._event.fire('layersremoved', { 'layers': e.layers });
  102436. });
  102437. this.viewModel.clearLayers();
  102438. };
  102439. // 获取分析参数
  102440. function getAnalysisParam() {
  102441. let analysisType = dropDownTop.getAttribute('data-value');
  102442. let analysisMethod = analysisMethodSelectName.getAttribute('data-value');
  102443. let gridType = gridTypeSelectName.getAttribute('data-value');
  102444. let queryRange = queryRangeInput.value;
  102445. let gridSizeUnit = gridSizeUnitSelectName.title;
  102446. let searchRadiusUnit = searchRadiusSelectName.title;
  102447. let areaUnit = areaUnitSelectName.title;
  102448. let colorGradientType = rangeContentModelSelectName.getAttribute('data-value');
  102449. let themeModel = themeModelSelectName.getAttribute('data-value');
  102450. let date = new Date();
  102451. let resultLayerName = resultLayerInput.value || date.getTime();
  102452. let mappingParameter;
  102453. if (themeModel === 'NOTSET') {
  102454. mappingParameter = '';
  102455. } else {
  102456. mappingParameter = {
  102457. 'rangeMode': themeModel,
  102458. 'rangeCount': rangeContentParamInput.value,
  102459. 'colorGradientType': colorGradientType
  102460. }
  102461. }
  102462. let analysisParam;
  102463. if (analysisType === 'density') {
  102464. analysisParam = new KernelDensityJobParameter({
  102465. 'datasetName': datasetSelectName.title,
  102466. 'method': analysisMethod,
  102467. 'meshType': gridType,
  102468. 'resolution': gridSizeInput.value,
  102469. 'fields': weightFieldsSelectName.title,
  102470. 'radius': searchRadiusInput.value,
  102471. 'meshSizeUnit': gridSizeUnit,
  102472. 'radiusUnit': searchRadiusUnit,
  102473. 'areaUnit': areaUnit,
  102474. 'query': queryRange,
  102475. 'mappingParameters': new MappingParameters({
  102476. 'rangeMode': mappingParameter.rangeMode,
  102477. 'rangeCount': mappingParameter.rangeCount,
  102478. 'colorGradientType': mappingParameter.colorGradientType
  102479. })
  102480. })
  102481. }
  102482. let params = {
  102483. 'analysisParam': analysisParam,
  102484. 'resultLayerName': resultLayerName
  102485. };
  102486. return params;
  102487. }
  102488. //阻止 map 默认事件
  102489. this._preventMapEvent(container, this.map);
  102490. return container;
  102491. },
  102492. /**
  102493. * @function DistributedAnalysisView.prototype._createOptions
  102494. * @description 创建下拉框。
  102495. * @private
  102496. */
  102497. _createOptions(container, optionsArr) {
  102498. for (let i in optionsArr) {
  102499. let option = document.createElement('div');
  102500. option.className = 'component-selecttool__option';
  102501. option.title = optionsArr[i];
  102502. option.innerHTML = optionsArr[i];
  102503. option.setAttribute('data-value', optionsArr[i]);
  102504. container.appendChild(option);
  102505. }
  102506. },
  102507. /**
  102508. * @function DistributedAnalysisView.prototype._creatInputBox
  102509. * @description 创建输入框。
  102510. * @private
  102511. */
  102512. _creatInputBox(inputOptions, parentEle) {
  102513. let div = external_L_default().DomUtil.create('div', '', parentEle);
  102514. let span = external_L_default().DomUtil.create('span', '', div);
  102515. span.innerHTML = inputOptions.spanName;
  102516. let input = external_L_default().DomUtil.create('input', '', div);
  102517. input.value = inputOptions.value;
  102518. input.className = 'component-distributeanalysis__input';
  102519. return div;
  102520. },
  102521. /**
  102522. * @function DistributedAnalysisView.prototype._creatUnitSelectBox
  102523. * @description 创建选择框。
  102524. * @private
  102525. */
  102526. _creatUnitSelectBox(options, parentEle) {
  102527. let unitSelectBoxContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', parentEle);
  102528. let unitSelectSpan = external_L_default().DomUtil.create('span', '', unitSelectBoxContainer);
  102529. unitSelectSpan.innerHTML = options.labelName;
  102530. let unitSelectInputContainer = external_L_default().DomUtil.create('div', '', unitSelectBoxContainer);
  102531. external_L_default().DomUtil.create('input', 'buffer-radius-input', unitSelectInputContainer);
  102532. let unitSelectUnitContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', unitSelectInputContainer);
  102533. let unitSelectOptions = options.selectOptions;
  102534. let unitSelectTool = (new Select(unitSelectOptions)).getElement();
  102535. unitSelectUnitContainer.appendChild(unitSelectTool);
  102536. return unitSelectBoxContainer;
  102537. },
  102538. /**
  102539. * @function DistributedAnalysisView.prototype._setEleAtribute
  102540. * @description 设置元素的属性名和属性值。
  102541. * @private
  102542. */
  102543. _setEleAtribute(daraValueArr, attributeName, eleArr) {
  102544. for (let i = 0; i < eleArr.length; i++) {
  102545. eleArr[i].setAttribute(attributeName, daraValueArr[i])
  102546. }
  102547. }
  102548. });
  102549. var distributedAnalysisView = function (options) {
  102550. return new DistributedAnalysisView(options);
  102551. };
  102552. ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryViewModel.js
  102553. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  102554. * This program are made available under the terms of the Apache License, Version 2.0
  102555. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  102556. /**
  102557. * @class DataServiceQueryViewModel
  102558. * @aliasclass Components.DataServiceQueryViewModel
  102559. * @deprecatedclassinstance L.supermap.components.dataServiceQueryViewModel
  102560. * @classdesc 数据服务查询组件功能类。
  102561. * @version 9.1.1
  102562. * @category Components DataServiceQuery
  102563. * @param {string} dataserviceUrl - 数据服务地址。
  102564. * @fires DataServiceQueryViewModel#getfeaturessucceeded
  102565. * @fires DataServiceQueryViewModel#getfeaturesfailed
  102566. * @extends {L.Evented}
  102567. * @usage
  102568. */
  102569. class DataServiceQueryViewModel extends (external_L_default()).Evented {
  102570. initialize(dataserviceUrl) {
  102571. this.dataserviceUrl = dataserviceUrl;
  102572. this.resultLayers = [];
  102573. }
  102574. /**
  102575. * @function DataServiceQueryViewModel.prototype.getFeatures
  102576. * @description 获取 features。
  102577. * @param {(GetFeaturesByIDsParameters|GetFeaturesByBufferParameters|GetFeaturesByBoundsParameters|GetFeaturesBySQLParameters|GetFeaturesByGeometryParameters)} queryParam - 查询参数。
  102578. * @param {L.Map} map - Leaflet Map 对象。
  102579. */
  102580. getFeatures(queryParam, map) {
  102581. let dataserviceUrl = this.dataserviceUrl;
  102582. let me = this;
  102583. let featureService = FeatureService_featureService(dataserviceUrl);
  102584. if (queryParam instanceof GetFeaturesByIDsParameters) {
  102585. featureService.getFeaturesByIDs(queryParam, function (serviceResult) {
  102586. me._getQureyResult(serviceResult, map);
  102587. });
  102588. } else if (queryParam instanceof GetFeaturesBySQLParameters) {
  102589. featureService.getFeaturesBySQL(queryParam, function (serviceResult) {
  102590. me._getQureyResult(serviceResult, map);
  102591. });
  102592. } else if (queryParam instanceof GetFeaturesByBoundsParameters) {
  102593. featureService.getFeaturesByBounds(queryParam, function (serviceResult) {
  102594. me._getQureyResult(serviceResult, map);
  102595. });
  102596. } else if (queryParam instanceof GetFeaturesByBufferParameters) {
  102597. featureService.getFeaturesByBuffer(queryParam, function (serviceResult) {
  102598. me._getQureyResult(serviceResult, map);
  102599. });
  102600. } else if (queryParam instanceof GetFeaturesByGeometryParameters) {
  102601. featureService.getFeaturesByGeometry(queryParam, function (serviceResult) {
  102602. me._getQureyResult(serviceResult, map);
  102603. });
  102604. }
  102605. }
  102606. /**
  102607. * @function DataServiceQueryViewModel.prototype._getQureyResult
  102608. * @description 获取查询结果。
  102609. * @private
  102610. * @param {Object} serviceResult - 返回查询结果。
  102611. * @param {L.Map} map - Leaflet Map 对象。
  102612. */
  102613. _getQureyResult(serviceResult, map) {
  102614. if (serviceResult.error) {
  102615. /**
  102616. * @event DataServiceQueryViewModel#getfeaturesfailed
  102617. * @description features 获取失败时触发。
  102618. * @property {string} error - 服务器返回的错误。
  102619. */
  102620. this.fire('getfeaturesfailed', { 'error': serviceResult.error });
  102621. return;
  102622. }
  102623. let resultLayer = external_L_default().geoJSON(serviceResult.result.features, {
  102624. onEachFeature: function (feature, layer) {
  102625. layer.bindPopup("ID: " + feature.properties.SMID);
  102626. },
  102627. pointToLayer: function (geoJsonPoint, latLng) {
  102628. return external_L_default().circleMarker(latLng, { radius: 6})
  102629. }
  102630. }).addTo(map);
  102631. this.resultLayers.push(resultLayer);
  102632. /**
  102633. * @event DataServiceQueryViewModel#getfeaturessucceeded
  102634. * @description features 获取成功时触发。
  102635. * @property {Object} result - 服务器返回的结果。
  102636. */
  102637. this.fire('getfeaturessucceeded', { 'result': serviceResult.result.features })
  102638. }
  102639. /**
  102640. * @function DataServiceQueryViewModel.prototype.clearLayers
  102641. * @description 清除所有结果图层。
  102642. */
  102643. clearLayers() {
  102644. for (let i in this.resultLayers) {
  102645. this.resultLayers[i].remove();
  102646. }
  102647. this.resultLayers = [];
  102648. }
  102649. }
  102650. var dataServiceQueryViewModel = function (dataserviceUrl) {
  102651. return new dataServiceQueryViewModel(dataserviceUrl);
  102652. };
  102653. ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryView.js
  102654. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  102655. * This program are made available under the terms of the Apache License, Version 2.0
  102656. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  102657. /**
  102658. * @class DataServiceQueryView
  102659. * @aliasclass Components.DataServiceQueryView
  102660. * @deprecatedclassinstance L.supermap.components.dataServiceQuery
  102661. * @classdesc 数据服务查询组件类。
  102662. * @version 9.1.1
  102663. * @modulecategory Components
  102664. * @param {string} dataServiceUrl - 数据服务地址。
  102665. * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries"。
  102666. * @param {Object} options - 参数。
  102667. * @param {(Array.<GetFeatureMode>|GetFeatureMode)} [options.getFeatureMode] - 查询方式。
  102668. * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
  102669. * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
  102670. * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
  102671. * @fires DataServiceQueryView#getfeaturessucceeded
  102672. * @fires DataServiceQueryView#getfeaturesfailed
  102673. * @category Components DataServiceQuery
  102674. * @extends {ComponentsViewBase}
  102675. * @usage
  102676. */
  102677. var DataServiceQueryView = ComponentsViewBase.extend({
  102678. initialize: function (dataServiceUrl, dataSetNames, options) {
  102679. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  102680. this.dataServiceUrl = dataServiceUrl;
  102681. if (!dataSetNames || dataSetNames.length === 0) {
  102682. throw new Error('Please configure the dataset of the query!')
  102683. }
  102684. if (dataSetNames instanceof Array) {
  102685. this.dataSetNames = dataSetNames;
  102686. } else {
  102687. this.dataSetNames = dataSetNames.split(" ");
  102688. }
  102689. },
  102690. /**
  102691. * @function DataServiceQueryView.prototype.onAdd
  102692. * @description 添加控件。
  102693. * @private
  102694. * @override
  102695. */
  102696. onAdd: function (map) {
  102697. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  102698. },
  102699. /**
  102700. * @function DataServiceQueryView.prototype.onRemove
  102701. * @description 移除控件。
  102702. * @private
  102703. */
  102704. onRemove: function () {
  102705. this.map.off('pm:create');
  102706. },
  102707. /**
  102708. * @function DataServiceQueryView.prototype.setDataSetNames
  102709. * @description 设置查询的数据集名称。
  102710. * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries";
  102711. */
  102712. setDataSetNames(dataSetNames) {
  102713. if (dataSetNames instanceof Array) {
  102714. this.dataSetNames = dataSetNames;
  102715. } else {
  102716. this.dataSetNames = dataSetNames.split(" ");
  102717. }
  102718. },
  102719. /**
  102720. * @function DataServiceQueryView.prototype.setGetFeatureMode
  102721. * @description 设置查询方式。
  102722. * @param {(Array.<GetFeatureMode>|GetFeatureMode)} getFeatureMode - 查询方式。
  102723. */
  102724. setGetFeatureMode(getFeatureMode) {
  102725. this.getFeatureMode = getFeatureMode;
  102726. this._getFeatureModeOnchange(this.getFeatureMode);
  102727. },
  102728. /**
  102729. * @function DataServiceQueryView.prototype.setDataServiceUrl
  102730. * @description 设置查询的数据服务地址。
  102731. * @param {string} dataServiceUrl - 数据服务地址。
  102732. */
  102733. setDataServiceUrl(dataServiceUrl) {
  102734. this.dataServiceUrl = dataServiceUrl;
  102735. this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
  102736. },
  102737. /**
  102738. * @function DataServiceQueryView.prototype._getFeatureModeOnchange
  102739. * @private
  102740. * @description 改变查询方式时改变 UI。
  102741. * @param {string} getFeatureMode - 查询方式。
  102742. */
  102743. _getFeatureModeOnchange(getFeatureMode) {
  102744. let queryModelOptionsArr;
  102745. if (!getFeatureMode || JSON.stringify(getFeatureMode) == '{}') {
  102746. queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
  102747. } else {
  102748. queryModelOptionsArr = getFeatureMode;
  102749. }
  102750. let queryModelControl = document.getElementById('queryModelControl');
  102751. queryModelControl.innerHTML = '';
  102752. this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl)
  102753. },
  102754. /**
  102755. * @function DataServiceQueryView.prototype._initView
  102756. * @description 创建数据服务查询组件。
  102757. * @returns {HTMLElement}
  102758. * @private
  102759. */
  102760. _initView: function () {
  102761. // 初始化 ViewModel:
  102762. this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
  102763. this.messageBox = new MessageBox();
  102764. // 组件 container
  102765. let container = (new CommonContainer({title: Lang.i18n('title_dataServiceQuery')})).getElement();
  102766. container.classList.add('component-servicequery__container');
  102767. container.children[0].classList.add('component-servicequery__title');
  102768. let componentContentContainer = container.children[1];
  102769. componentContentContainer.classList.add('component-content--scroll');
  102770. componentContentContainer.classList.add('data-services');
  102771. // 组件内容 container
  102772. let analyusisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  102773. let analysisType = external_L_default().DomUtil.create('div', 'component-servicequery__analysistype', analyusisTypeContainer);
  102774. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
  102775. let queryModelOptionsArr, getFeatureModeArr = this.options.getFeatureMode;
  102776. // 获取查询模式
  102777. if (!getFeatureModeArr || JSON.stringify(getFeatureModeArr) == '{}') {
  102778. queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
  102779. } else {
  102780. queryModelOptionsArr = getFeatureModeArr;
  102781. }
  102782. // 查询模式
  102783. let queryModelContainer = external_L_default().DomUtil.create('div', '', analysisLayer);
  102784. queryModelContainer.id = 'queryModelContainer';
  102785. let queryModelControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', queryModelContainer);
  102786. queryModelControl.id = 'queryModelControl';
  102787. this.creatQueryModeSelect = creatQueryModeSelect.bind(this);
  102788. this.queryModeltOnchange = queryModeltOnchange.bind(this);
  102789. this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl);
  102790. // 要素 ID 数组
  102791. let featuresIdArrContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container', analysisLayer);
  102792. let textareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', featuresIdArrContainer);
  102793. textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
  102794. let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--dataservice', featuresIdArrContainer);
  102795. textareaControl.id = 'getfeaturesIdArr';
  102796. let scrollarea = external_L_default().DomUtil.create('div', 'scrollarea', textareaControl);
  102797. let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
  102798. scrollareaContent.setAttribute('tabindex', '1');
  102799. let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
  102800. getValueTextArea.value = '[1,2,3]';
  102801. getValueTextArea.id = 'getValueTextArea';
  102802. // SQL 最多可返回的要素数量
  102803. let maxFeaturesContainer = external_L_default().DomUtil.create('div', 'component-servicequery__maxfeatures-container hidden', analysisLayer);
  102804. let maxFeaturesOtions = {
  102805. 'spanName': Lang.i18n('text_label_maxFeatures'),
  102806. 'value': '1000'
  102807. };
  102808. let maxFeaturesInputBox = this._creatInputBox(maxFeaturesOtions, maxFeaturesContainer);
  102809. let maxFeaturesInput = maxFeaturesInputBox.children[1];
  102810. maxFeaturesInput.classList.add('max-features-input');
  102811. // Buffer 缓冲区距离
  102812. let bufferDistanceContainer = external_L_default().DomUtil.create('div', 'component-servicequery__distance-container hidden', analysisLayer);
  102813. let bufferDistanceOtions = {
  102814. 'spanName': Lang.i18n('text_label_bufferDistance'),
  102815. 'value': '10'
  102816. };
  102817. let bufferDistanceInputBox = this._creatInputBox(bufferDistanceOtions, bufferDistanceContainer);
  102818. let bufferDistanceInput = bufferDistanceInputBox.children[1];
  102819. // Bounds 查询范围;
  102820. let queryRangeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container hidden', analysisLayer);
  102821. let queryRangetextareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', queryRangeContainer);
  102822. let queryRangeMainContent = external_L_default().DomUtil.create('div', '', queryRangeContainer);
  102823. let queryRangeIconContainer = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon-container', queryRangeMainContent);
  102824. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange1');
  102825. let queryRangeRecIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-polygon-layer bounds', queryRangeIconContainer);
  102826. let queryRangeLineIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-line-layer hidden', queryRangeIconContainer);
  102827. let queryRangePointIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-point-layer hidden', queryRangeIconContainer);
  102828. let queryRangetextareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--rangequery', queryRangeMainContent);
  102829. queryRangetextareaControl.id = 'getfeaturesIdArr';
  102830. let queryRangescrollarea = external_L_default().DomUtil.create('div', '', queryRangetextareaControl);
  102831. let queryRangescrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', queryRangescrollarea);
  102832. queryRangescrollareaContent.setAttribute('tabindex', '1');
  102833. let queryRangeTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content component-textarea--rangequery__content', queryRangescrollareaContent);
  102834. queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
  102835. // geometry 空间查询模式
  102836. let spatialQueryModeContainer = external_L_default().DomUtil.create('div', 'component-servicequery__spatialquerymode-container hidden', analysisLayer);
  102837. let spatialQueryModeOptions = {
  102838. 'optionsArr': ['CONTAIN', 'CROSS', 'DISJOINT', 'IDENTITY', 'INTERSECT', 'NONE', 'OVERLAP', 'TOUCH', 'WITHIN'],
  102839. 'labelName': Lang.i18n('text_label_spatialQueryMode')
  102840. };
  102841. let spatialQueryModeControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', spatialQueryModeContainer);
  102842. let spatialQueryModeSelectTool = (new Select(spatialQueryModeOptions)).getElement();
  102843. spatialQueryModeSelectTool.children[1].classList.add('dataservice-select');
  102844. spatialQueryModeControl.appendChild(spatialQueryModeSelectTool);
  102845. let spatialQueryModeSelectName = spatialQueryModeSelectTool.children[1].children[0];
  102846. spatialQueryModeSelectName.id = 'spatialQueryModeSelectName';
  102847. let spatialQueryModeSelectContent = spatialQueryModeSelectTool.children[1].children[2];
  102848. spatialQueryModeSelectContent.classList.add('component-servicequery__spatialquerymode__selectcontent');
  102849. // 分析按钮
  102850. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisLayer);
  102851. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  102852. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  102853. analysisBtn.innerHTML = Lang.i18n('btn_query');
  102854. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  102855. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising component-servicequery__querybtn--querying', analysingContainer);
  102856. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  102857. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  102858. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  102859. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  102860. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  102861. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  102862. </svg>`;
  102863. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_querying');
  102864. // 删除按钮
  102865. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  102866. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheRresultLayer');
  102867. // 设置当前显示参数
  102868. queryModeltOnchange(queryModelOptionsArr[0]);
  102869. // 分析按钮点击事件
  102870. let me = this;
  102871. analysisBtn.onclick = () => {
  102872. this.messageBox.closeView();
  102873. analysingContainer.style.display = 'block';
  102874. analysisBtn.style.display = 'none';
  102875. let queryParams = getQueryParams();
  102876. this.viewModel.on('getfeaturessucceeded', (e) => {
  102877. analysingContainer.style.display = 'none';
  102878. analysisBtn.style.display = 'block';
  102879. if (e.result.features.length === 0) {
  102880. this.messageBox.showView(Lang.i18n('msg_dataReturnedIsEmpty'), "success");
  102881. }
  102882. /**
  102883. * @event DataServiceQueryView#getfeaturessucceeded
  102884. * @description features 获取成功时触发。
  102885. * @property {Object} result - 服务器返回的结果。
  102886. */
  102887. this._event.fire('getfeaturessucceeded', {'result': e.result})
  102888. });
  102889. this.viewModel.on('getfeaturesfailed', (e) => {
  102890. analysingContainer.style.display = 'none';
  102891. analysisBtn.style.display = 'block';
  102892. this.messageBox.showView(e.error.errorMsg, "failure");
  102893. /**
  102894. * @event DataServiceQueryView#getfeaturesfailed
  102895. * @description features 获取失败时触发。
  102896. * @property {string} error - 服务器返回的错误。
  102897. */
  102898. this._event.fire('getfeaturesfailed', {'error': e.error})
  102899. });
  102900. this.viewModel.getFeatures(queryParams, this.map);
  102901. };
  102902. let bounds, resultLayer;
  102903. // 矩形 & 多边形绘制
  102904. queryRangeRecIcon.onclick = (e) => {
  102905. let queryModelSelectName = document.getElementById('queryModelSelectName');
  102906. let getFeatureMode = queryModelSelectName.title;
  102907. if (resultLayer) {
  102908. resultLayer.remove();
  102909. }
  102910. // 矩形
  102911. if (getFeatureMode === 'BOUNDS') {
  102912. this.map.pm.enableDraw('Rectangle');
  102913. // 多边形
  102914. } else {
  102915. this.map.pm.enableDraw('Poly');
  102916. }
  102917. e.stopPropagation();
  102918. e.preventDefault();
  102919. };
  102920. // 线绘制
  102921. queryRangeLineIcon.onclick = (e) => {
  102922. if (resultLayer) {
  102923. resultLayer.remove();
  102924. }
  102925. this.map.pm.enableDraw('Line');
  102926. e.stopPropagation();
  102927. e.preventDefault();
  102928. };
  102929. // 点绘制
  102930. queryRangePointIcon.onclick = (e) => {
  102931. if (resultLayer) {
  102932. resultLayer.remove();
  102933. }
  102934. this.map.pm.enableDraw('Marker');
  102935. e.stopPropagation();
  102936. e.preventDefault();
  102937. };
  102938. this.map.on('pm:create', (e) => {
  102939. if (e.shape === 'Rectangle') {
  102940. resultLayer = e.layer;
  102941. let boundsT = resultLayer.getBounds();
  102942. bounds = external_L_default().bounds([boundsT._southWest.lng, boundsT._southWest.lat], [boundsT._northEast.lng, boundsT._northEast.lat]);
  102943. let geo = {
  102944. 'leftBottom': {'x': boundsT._southWest.lng, 'y': boundsT._southWest.lat},
  102945. 'rightTop': {'x': boundsT._northEast.lng, 'y': boundsT._northEast.lat}
  102946. };
  102947. queryRangeTextArea.value = JSON.stringify(geo);
  102948. }
  102949. if (e.shape === 'Marker') {
  102950. resultLayer = e.layer;
  102951. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  102952. this.map.pm.disableDraw("Marker");
  102953. }
  102954. if (e.shape === 'Line') {
  102955. resultLayer = e.layer;
  102956. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  102957. }
  102958. if (e.shape === 'Polygon') {
  102959. resultLayer = e.layer;
  102960. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  102961. }
  102962. });
  102963. // 删除按钮点击事件
  102964. deleteLayersBtn.onclick = () => {
  102965. this.viewModel.clearLayers();
  102966. };
  102967. function creatQueryModeSelect(queryModelOptionsArr, queryModelControl) {
  102968. // 查询模式
  102969. let queryModelSelectName;
  102970. if (queryModelOptionsArr instanceof Array && queryModelOptionsArr.length > 1) {
  102971. let queryModelOptions = {
  102972. 'optionsArr': queryModelOptionsArr,
  102973. 'labelName': Lang.i18n('text_label_queryMode'),
  102974. 'optionsClickCb': this.queryModeltOnchange
  102975. };
  102976. let queryModelSelectTool = (new Select(queryModelOptions)).getElement();
  102977. queryModelControl.appendChild(queryModelSelectTool);
  102978. queryModelSelectName = queryModelSelectTool.children[1].children[0];
  102979. queryModelSelectTool.children[1].classList.add('dataservice-select');
  102980. let queryModelSelect = queryModelSelectTool.children[1];
  102981. queryModelSelect.classList.add('dataservice-select');
  102982. queryModelSelect.classList.add('querymodel-select');
  102983. } else {
  102984. let span = external_L_default().DomUtil.create('span', '', queryModelContainer);
  102985. span.innerHTML = Lang.i18n('text_label_queryMode');
  102986. queryModelSelectName = external_L_default().DomUtil.create('div', 'component-servicequery__querymode-selectname', queryModelContainer);
  102987. let text = external_L_default().DomUtil.create('span', '', queryModelSelectName);
  102988. if (queryModelOptionsArr instanceof Array) {
  102989. text.innerHTML = queryModelOptionsArr[0];
  102990. } else {
  102991. text.innerHTML = queryModelOptionsArr;
  102992. }
  102993. queryModelSelectName.title = text.innerHTML;
  102994. this.queryModeltOnchange(queryModelSelectName);
  102995. }
  102996. queryModelSelectName.id = 'queryModelSelectName';
  102997. return queryModelSelectName;
  102998. }
  102999. // 查询模式下拉框 onchange 事件
  103000. function queryModeltOnchange(option) {
  103001. // 获取当前选中查询模式
  103002. let queryModelSelectName;
  103003. if (option.title) {
  103004. queryModelSelectName = option.title;
  103005. } else {
  103006. queryModelSelectName = option;
  103007. }
  103008. // 控制部分查询参数元素隐藏和显示
  103009. maxFeaturesContainer.classList.add('hidden');
  103010. queryRangeContainer.classList.add('hidden');
  103011. bufferDistanceContainer.classList.add('hidden');
  103012. queryRangeLineIcon.classList.add('hidden');
  103013. queryRangePointIcon.classList.add('hidden');
  103014. queryRangeRecIcon.classList.remove('bounds');
  103015. spatialQueryModeContainer.classList.add('hidden');
  103016. textareaSpan.innerHTML = Lang.i18n('text_label_featureFilter');
  103017. getValueTextArea.value = 'SMID<10';
  103018. if (queryModelSelectName === 'BUFFER' || queryModelSelectName === 'SPATIAL') {
  103019. queryRangeContainer.classList.remove('hidden');
  103020. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_geometricObject');
  103021. queryRangeTextArea.value = '{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[84.90234375,40.25390625]}}';
  103022. queryRangeLineIcon.classList.remove('hidden');
  103023. queryRangePointIcon.classList.remove('hidden');
  103024. }
  103025. switch (queryModelSelectName) {
  103026. case 'ID':
  103027. textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
  103028. getValueTextArea.value = '[1,2,3]';
  103029. break;
  103030. case 'SQL':
  103031. maxFeaturesContainer.classList.remove('hidden');
  103032. break;
  103033. case 'BOUNDS':
  103034. queryRangeContainer.classList.remove('hidden');
  103035. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange');
  103036. queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
  103037. queryRangeRecIcon.classList.add('bounds');
  103038. break;
  103039. case 'BUFFER':
  103040. bufferDistanceContainer.classList.remove('hidden');
  103041. break;
  103042. case 'SPATIAL':
  103043. spatialQueryModeContainer.classList.remove('hidden');
  103044. break;
  103045. }
  103046. }
  103047. // 获取查询参数
  103048. function getQueryParams() {
  103049. // 数据集数组
  103050. let datasetArr = me.dataSetNames;
  103051. let queryModelSelectName = document.getElementById('queryModelSelectName');
  103052. let getFeatureMode = queryModelSelectName.title;
  103053. // 过滤条件
  103054. let attributeFilter = getValueTextArea.value;
  103055. let queryParam;
  103056. if (getFeatureMode === 'ID') {
  103057. let value = getValueTextArea.value;
  103058. let ids = value.substring(1, value.length - 1).split(',');
  103059. queryParam = new GetFeaturesByIDsParameters({
  103060. IDs: ids,
  103061. datasetNames: datasetArr
  103062. });
  103063. } else if (getFeatureMode === 'SQL') {
  103064. let maxFeatures = maxFeaturesInput.value;
  103065. queryParam = new GetFeaturesBySQLParameters({
  103066. queryParameter: {
  103067. attributeFilter: attributeFilter
  103068. },
  103069. datasetNames: datasetArr,
  103070. maxFeatures: maxFeatures
  103071. });
  103072. } else if (getFeatureMode === 'BOUNDS') {
  103073. if (!bounds) {
  103074. let value = JSON.parse(queryRangeTextArea.value);
  103075. bounds = external_L_default().bounds([value.leftBottom.x, value.leftBottom.y], [value.rightTop.x, value.rightTop.y])
  103076. }
  103077. queryParam = new GetFeaturesByBoundsParameters({
  103078. attributeFilter: attributeFilter,
  103079. datasetNames: datasetArr,
  103080. bounds: bounds
  103081. });
  103082. } else if (getFeatureMode === 'BUFFER') {
  103083. let bufferDistance = bufferDistanceInput.value;
  103084. let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
  103085. let geometryLayer = resultLayer || defaultGeometryValue;
  103086. queryParam = new GetFeaturesByBufferParameters({
  103087. attributeFilter: attributeFilter,
  103088. datasetNames: datasetArr,
  103089. bufferDistance: bufferDistance,
  103090. geometry: geometryLayer
  103091. });
  103092. } else if (getFeatureMode === 'SPATIAL') {
  103093. let spatialQueryMode = spatialQueryModeSelectName.title;
  103094. let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
  103095. let geometryLayer = resultLayer || defaultGeometryValue;
  103096. queryParam = new GetFeaturesByGeometryParameters({
  103097. attributeFilter: attributeFilter,
  103098. datasetNames: datasetArr,
  103099. spatialQueryMode: spatialQueryMode,
  103100. geometry: geometryLayer
  103101. });
  103102. }
  103103. return queryParam;
  103104. }
  103105. //阻止 map 默认事件
  103106. this._preventMapEvent(container, this.map);
  103107. return container;
  103108. },
  103109. /**
  103110. * @function DataServiceQueryView.prototype._creatInputBox
  103111. * @description 创建含有 span 的 input 框。
  103112. * @private
  103113. */
  103114. _creatInputBox(inputOptions, parentEle) {
  103115. let div = external_L_default().DomUtil.create('div', '', parentEle);
  103116. let span = external_L_default().DomUtil.create('span', '', div);
  103117. span.innerHTML = inputOptions.spanName;
  103118. let input = external_L_default().DomUtil.create('input', '', div);
  103119. input.value = inputOptions.value;
  103120. // input.className = 'distributeInput'
  103121. return div;
  103122. }
  103123. });
  103124. var dataServiceQueryView = function (dataServiceUrl, dataSetNames, options) {
  103125. return new DataServiceQueryView(dataServiceUrl, dataSetNames, options);
  103126. };
  103127. ;// CONCATENATED MODULE: ./src/leaflet/components/index.js
  103128. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103129. * This program are made available under the terms of the Apache License, Version 2.0
  103130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103131. ;// CONCATENATED MODULE: ./src/leaflet/index.js
  103132. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103133. * This program are made available under the terms of the Apache License, Version 2.0
  103134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103135. ;// CONCATENATED MODULE: ./src/leaflet/namespace.js
  103136. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  103137. * This program are made available under the terms of the Apache License, Version 2.0
  103138. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103139. // 注:命名空间重复,内容会被覆盖
  103140. // 例如SuperMap.Components=>L.supermap.Componets,再写L.supermap.Componets = {}, SuprMap的Components就不会挂在L.supermap上了
  103141. // L.supermap.d3Layer是在别的地方挂上的
  103142. (external_L_default()).supermap = { ...SuperMap, Components: { ...SuperMap.Components }, ...(external_L_default()).supermap };
  103143. (external_L_default()).supermap.components = (external_L_default()).supermap.components || {};
  103144. (external_L_default()).supermap.Components = (external_L_default()).supermap.Components || {};
  103145. (external_L_default()).supermap.control = (external_L_default()).supermap.control || {};
  103146. (external_L_default()).supermap.Util = {};
  103147. // ./core
  103148. // L.Util.supermap_callbacks = coreUtil.supermap_callbacks;
  103149. (external_L_default()).Util.toGeoJSON = toGeoJSON;
  103150. (external_L_default()).supermap.Util.toGeoJSON = toGeoJSON;
  103151. (external_L_default()).Util.toSuperMapGeometry = Util_toSuperMapGeometry;
  103152. (external_L_default()).supermap.Util.toSuperMapGeometry = Util_toSuperMapGeometry;
  103153. (external_L_default()).Util.resolutionToScale = resolutionToScale;
  103154. (external_L_default()).supermap.Util.resolutionToScale = resolutionToScale;
  103155. (external_L_default()).Util.scaleToResolution = Util_scaleToResolution;
  103156. (external_L_default()).supermap.Util.scaleToResolution = Util_scaleToResolution;
  103157. (external_L_default()).Util.getMeterPerMapUnit = Util_getMeterPerMapUnit;
  103158. (external_L_default()).supermap.Util.getMeterPerMapUnit = Util_getMeterPerMapUnit;
  103159. (external_L_default()).Util.GetResolutionFromScaleDpi = getResolutionFromScaleDpi;
  103160. (external_L_default()).supermap.Util.getResolutionFromScaleDpi = getResolutionFromScaleDpi;
  103161. (external_L_default()).supermap.Util.GetResolutionFromScaleDpi = getResolutionFromScaleDpi;
  103162. (external_L_default()).Util.NormalizeScale = normalizeScale;
  103163. (external_L_default()).supermap.Util.normalizeScale = normalizeScale;
  103164. (external_L_default()).supermap.Util.NormalizeScale = normalizeScale;
  103165. (external_L_default()).Util.transform = transform;
  103166. (external_L_default()).supermap.Util.transform = transform;
  103167. // L.Proj4Leaflet
  103168. (external_L_default()).Proj = (external_L_default()).Proj || {};
  103169. (external_L_default()).supermap.Proj = (external_L_default()).supermap.Proj || {};
  103170. (external_L_default()).Proj.CRS = crs;
  103171. (external_L_default()).supermap.Proj.crs = crs;
  103172. (external_L_default()).supermap.Proj.CRS = CRS;
  103173. // core/NonEarthCRS
  103174. (external_L_default()).Projection = {};
  103175. (external_L_default()).supermap.Projection = (external_L_default()).supermap.Projection || {};
  103176. (external_L_default()).Projection.NonProjection = nonProjection;
  103177. (external_L_default()).supermap.Projection.nonProjection = nonProjection;
  103178. (external_L_default()).supermap.Projection.NonProjection = NonProjection;
  103179. (external_L_default()).supermap.CRS = (external_L_default()).supermap.CRS || {};
  103180. (external_L_default()).CRS.NonEarthCRS = nonEarthCRS;
  103181. (external_L_default()).supermap.CRS.NonEarthCRS = NonEarthCRS;
  103182. (external_L_default()).supermap.CRS.nonEarthCRS = nonEarthCRS;
  103183. // core/ExtendsCRS
  103184. (external_L_default()).CRS.BaiduCRS = BaiduCRS;
  103185. (external_L_default()).supermap.CRS.BaiduCRS = BaiduCRS;
  103186. (external_L_default()).CRS.TianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
  103187. (external_L_default()).supermap.CRS.TianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
  103188. (external_L_default()).CRS.TianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
  103189. (external_L_default()).supermap.CRS.TianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
  103190. (external_L_default()).CRS.TianDiTu_Mercator = TianDiTu_MercatorCRS;
  103191. (external_L_default()).supermap.CRS.TianDiTu_Mercator = TianDiTu_MercatorCRS;
  103192. (external_L_default()).CRS.TianDiTu_WGS84 = TianDiTu_WGS84CRS;
  103193. (external_L_default()).supermap.CRS.TianDiTu_WGS84 = TianDiTu_WGS84CRS;
  103194. (external_L_default()).CRS.Baidu = BaiduCRS;
  103195. (external_L_default()).supermap.CRS.Baidu = BaiduCRS;
  103196. (external_L_default()).supermap.CommontypesConversion = CommontypesConversion;
  103197. // components
  103198. (external_L_default()).supermap.components.clientComputationLayer = clientComputationLayer;
  103199. (external_L_default()).supermap.Components.ClientComputationLayer = ClientComputationLayer;
  103200. (external_L_default()).supermap.components.clientComputation = clientComputationView;
  103201. (external_L_default()).supermap.Components.ClientComputation = ClientComputationView;
  103202. (external_L_default()).supermap.components.clientComputationViewModel = clientComputationViewModel;
  103203. (external_L_default()).supermap.Components.ClientComputationViewModel = ClientComputationViewModel;
  103204. (external_L_default()).supermap.components.geoJSONLayerWithName = geoJSONLayerWithName;
  103205. (external_L_default()).supermap.Components.GeoJSONLayerWithName = GeoJSONLayerWithName;
  103206. (external_L_default()).supermap.components.GeoJsonLayersDataModel = GeoJsonLayersDataModel;
  103207. (external_L_default()).supermap.Components.GeoJsonLayersDataModel = GeoJsonLayersDataModel;
  103208. (external_L_default()).supermap.components.dataFlow = dataFlowView;
  103209. (external_L_default()).supermap.Components.DataFlow = DataFlowView;
  103210. (external_L_default()).supermap.components.dataFlowViewModel = dataFlowViewModel;
  103211. (external_L_default()).supermap.Components.DataFlowViewModel = DataFlowViewModel;
  103212. (external_L_default()).supermap.components.dataServiceQuery = dataServiceQueryView;
  103213. (external_L_default()).supermap.Components.DataServiceQuery = DataServiceQueryView;
  103214. (external_L_default()).supermap.components.dataServiceQueryViewModel = dataServiceQueryViewModel;
  103215. (external_L_default()).supermap.Components.DataServiceQueryViewModel = DataServiceQueryViewModel;
  103216. (external_L_default()).supermap.components.DistributedAnalysisModel = DistributedAnalysisModel;
  103217. (external_L_default()).supermap.Components.DistributedAnalysisModel = DistributedAnalysisModel;
  103218. (external_L_default()).supermap.components.distributedAnalysis = distributedAnalysisView;
  103219. (external_L_default()).supermap.Components.DistributedAnalysis = DistributedAnalysisView;
  103220. (external_L_default()).supermap.components.distributedAnalysisViewModel = distributedAnalysisViewModel;
  103221. (external_L_default()).supermap.Components.DistributedAnalysisViewModel = DistributedAnalysisViewModel;
  103222. (external_L_default()).supermap.components.openFile = openFileView;
  103223. (external_L_default()).supermap.Components.OpenFile = OpenFileView;
  103224. (external_L_default()).supermap.components.openFileViewModel = openFileViewModel;
  103225. (external_L_default()).supermap.Components.OpenFileViewModel = OpenFileViewModel;
  103226. (external_L_default()).supermap.components.search = searchView;
  103227. (external_L_default()).supermap.Components.Search = SearchView;
  103228. (external_L_default()).supermap.components.searchViewModel = searchViewModel;
  103229. (external_L_default()).supermap.Components.SearchViewModel = SearchViewModel;
  103230. (external_L_default()).supermap.components.componentsViewBase = componentsViewBase;
  103231. (external_L_default()).supermap.Components.ComponentsViewBase = ComponentsViewBase;
  103232. // control
  103233. (external_L_default()).supermap.control.changeTileVersion = changeTileVersion;
  103234. (external_L_default()).supermap.control.ChangeTileVersion = ChangeTileVersion;
  103235. (external_L_default()).supermap.control.logo = logo;
  103236. (external_L_default()).supermap.control.Logo = Logo;
  103237. // mapping
  103238. (external_L_default()).supermap.baiduTileLayer = baiduTileLayer;
  103239. (external_L_default()).supermap.BaiduTileLayer = BaiduTileLayer;
  103240. (external_L_default()).supermap.cloudTileLayer = cloudTileLayer;
  103241. (external_L_default()).supermap.CloudTileLayer = CloudTileLayer;
  103242. (external_L_default()).supermap.imageMapLayer = imageMapLayer;
  103243. (external_L_default()).supermap.ImageMapLayer = ImageMapLayer;
  103244. (external_L_default()).supermap.imageTileLayer = imageTileLayer;
  103245. (external_L_default()).supermap.ImageTileLayer = ImageTileLayer;
  103246. (external_L_default()).supermap.tiandituTileLayer = tiandituTileLayer;
  103247. (external_L_default()).supermap.TiandituTileLayer = TiandituTileLayer;
  103248. (external_L_default()).supermap.tiledMapLayer = tiledMapLayer;
  103249. (external_L_default()).supermap.TiledMapLayer = TiledMapLayer;
  103250. (external_L_default()).supermap.wmtsLayer = wmtsLayer;
  103251. (external_L_default()).supermap.WMTSLayer = WMTSLayer;
  103252. (external_L_default()).supermap.webmap = webMap;
  103253. (external_L_default()).supermap.WebMap = WebMap;
  103254. (external_L_default()).supermap.initMap = initMap;
  103255. (external_L_default()).supermap.crsFromMapJSON = crsFromMapJSON;
  103256. // overlay
  103257. (external_L_default()).supermap.CartoCSSToLeaflet = CartoCSSToLeaflet;
  103258. (external_L_default()).supermap.DefaultStyle = DefaultStyle;
  103259. (external_L_default()).supermap.CartoStyleMap = CartoStyleMap;
  103260. (external_L_default()).supermap.ServerStyleMap = ServerStyleMap;
  103261. (external_L_default()).supermap.CompOpMap = CompOpMap;
  103262. (external_L_default()).supermap.circleStyle = circleStyle;
  103263. (external_L_default()).supermap.CircleStyle = CircleStyle;
  103264. (external_L_default()).supermap.cloverStyle = cloverStyle;
  103265. (external_L_default()).supermap.CloverStyle = CloverStyle;
  103266. (external_L_default()).supermap.graphic = graphic;
  103267. (external_L_default()).supermap.Graphic = Graphic;
  103268. (external_L_default()).supermap.imageStyle = imageStyle;
  103269. (external_L_default()).supermap.ImageStyle = ImageStyle;
  103270. (external_L_default()).supermap.themeFeature = themeFeature;
  103271. (external_L_default()).supermap.ThemeFeature = ThemeFeature;
  103272. (external_L_default()).supermap.dataFlowLayer = dataFlowLayer;
  103273. (external_L_default()).supermap.DataFlowLayer = DataFlowLayer;
  103274. (external_L_default()).supermap.echartsLayer = echartsLayer;
  103275. (external_L_default()).supermap.EchartsLayer = EchartsLayer;
  103276. (external_L_default()).supermap.graphicLayer = graphicLayer;
  103277. (external_L_default()).supermap.GraphicLayer = GraphicLayer;
  103278. (external_L_default()).supermap.graphThemeLayer = graphThemeLayer;
  103279. (external_L_default()).supermap.GraphThemeLayer = GraphThemeLayer;
  103280. (external_L_default()).supermap.heatMapFeature = heatMapFeature;
  103281. (external_L_default()).supermap.HeatMapFeature = HeatMapFeature;
  103282. (external_L_default()).supermap.heatMapLayer = heatMapLayer;
  103283. (external_L_default()).supermap.HeatMapLayer = HeatMapLayer;
  103284. (external_L_default()).supermap.labelThemeLayer = labelThemeLayer;
  103285. (external_L_default()).supermap.LabelThemeLayer = LabelThemeLayer;
  103286. (external_L_default()).supermap.mapVLayer = mapVLayer;
  103287. (external_L_default()).supermap.MapVLayer = MapVLayer;
  103288. (external_L_default()).supermap.rangeThemeLayer = rangeThemeLayer;
  103289. (external_L_default()).supermap.RangeThemeLayer = RangeThemeLayer;
  103290. (external_L_default()).supermap.rankSymbolThemeLayer = rankSymbolThemeLayer;
  103291. (external_L_default()).supermap.RankSymbolThemeLayer = RankSymbolThemeLayer;
  103292. (external_L_default()).supermap.tiledVectorLayer = tiledVectorLayer;
  103293. (external_L_default()).supermap.TileVectorLayer = TiledVectorLayer;
  103294. (external_L_default()).supermap.TiledVectorLayer = TiledVectorLayer;
  103295. (external_L_default()).supermap.turfLayer = turfLayer;
  103296. (external_L_default()).supermap.TurfLayer = TurfLayer;
  103297. (external_L_default()).supermap.FGBLayer = FGBLayer;
  103298. (external_L_default()).supermap.FGBLayer = fgbLayer;
  103299. (external_L_default()).supermap.unicodeMarker = unicodeMarker;
  103300. (external_L_default()).supermap.UnicodeMarker = UnicodeMarker;
  103301. (external_L_default()).supermap.uniqueThemeLayer = uniqueThemeLayer;
  103302. (external_L_default()).supermap.UniqueThemeLayer = UniqueThemeLayer;
  103303. (external_L_default()).supermap.VectorTileFormat = VectorTileFormat;
  103304. (external_L_default()).supermap.addressMatchService = addressMatchService;
  103305. (external_L_default()).supermap.AddressMatchService = AddressMatchService_AddressMatchService;
  103306. (external_L_default()).supermap.chartService = chartService;
  103307. (external_L_default()).supermap.ChartService = ChartService_ChartService;
  103308. (external_L_default()).supermap.dataFlowService = dataFlowService;
  103309. (external_L_default()).supermap.DataFlowService = DataFlowService_DataFlowService;
  103310. (external_L_default()).supermap.datasetService = datasetService;
  103311. (external_L_default()).supermap.DatasetService = DatasetService_DatasetService;
  103312. (external_L_default()).supermap.datasourceService = datasourceService;
  103313. (external_L_default()).supermap.DatasourceService = DatasourceService_DatasourceService;
  103314. (external_L_default()).supermap.featureService = FeatureService_featureService;
  103315. (external_L_default()).supermap.FeatureService = FeatureService_FeatureService;
  103316. (external_L_default()).supermap.fieldService = fieldService;
  103317. (external_L_default()).supermap.FieldService = FieldService_FieldService;
  103318. (external_L_default()).supermap.geoprocessingService = geoprocessingService;
  103319. (external_L_default()).supermap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  103320. (external_L_default()).supermap.gridCellInfosService = gridCellInfosService;
  103321. (external_L_default()).supermap.GridCellInfosService = GridCellInfosService;
  103322. (external_L_default()).supermap.imageCollectionService = imageCollectionService;
  103323. (external_L_default()).supermap.ImageCollectionService = ImageCollectionService_ImageCollectionService;
  103324. (external_L_default()).supermap.imageService = imageService;
  103325. (external_L_default()).supermap.ImageService = ImageService_ImageService;
  103326. (external_L_default()).supermap.layerInfoService = layerInfoService;
  103327. (external_L_default()).supermap.LayerInfoService = LayerInfoService_LayerInfoService;
  103328. (external_L_default()).supermap.mapService = mapService;
  103329. (external_L_default()).supermap.MapService = MapService_MapService;
  103330. (external_L_default()).supermap.measureService = measureService;
  103331. (external_L_default()).supermap.MeasureService = MeasureService_MeasureService;
  103332. (external_L_default()).supermap.networkAnalyst3DService = networkAnalyst3DService;
  103333. (external_L_default()).supermap.NetworkAnalyst3DService = NetworkAnalyst3DService_NetworkAnalyst3DService;
  103334. (external_L_default()).supermap.networkAnalystService = networkAnalystService;
  103335. (external_L_default()).supermap.NetworkAnalystService = NetworkAnalystService_NetworkAnalystService;
  103336. (external_L_default()).supermap.processingService = processingService;
  103337. (external_L_default()).supermap.ProcessingService = ProcessingService_ProcessingService;
  103338. (external_L_default()).supermap.queryService = queryService;
  103339. (external_L_default()).supermap.QueryService = QueryService_QueryService;
  103340. (external_L_default()).supermap.ServiceBase = ServiceBase;
  103341. (external_L_default()).supermap.spatialAnalystService = spatialAnalystService;
  103342. (external_L_default()).supermap.SpatialAnalystService = SpatialAnalystService_SpatialAnalystService;
  103343. (external_L_default()).supermap.themeService = themeService;
  103344. (external_L_default()).supermap.ThemeService = ThemeService_ThemeService;
  103345. (external_L_default()).supermap.trafficTransferAnalystService = trafficTransferAnalystService;
  103346. (external_L_default()).supermap.TrafficTransferAnalystService = TrafficTransferAnalystService_TrafficTransferAnalystService;
  103347. (external_L_default()).supermap.webPrintingJobService = webPrintingJobService;
  103348. (external_L_default()).supermap.WebPrintingJobService = WebPrintingJobService;
  103349. (external_L_default()).supermap.KnowledgeGraphService = KnowledgeGraphService_KnowledgeGraphService;
  103350. (external_L_default()).supermap.GraphMap = GraphMap;
  103351. // 处理命名空间重名
  103352. (external_L_default()).supermap.CommonUtil = Util_Util;
  103353. })();
  103354. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  103355. (() => {
  103356. "use strict";
  103357. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103358. * This program are made available under the terms of the Apache License, Version 2.0
  103359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103360. })();
  103361. /******/ })()
  103362. ;